Function: goto-address-at-point

goto-address-at-point is an autoloaded, interactive and byte-compiled function defined in goto-addr.el.gz.

Signature

(goto-address-at-point &optional EVENT)

Documentation

Compose a new message to the e-mail address or open URL at point.

Compose message to address at point. See documentation for goto-address-find-address-at-point.

If no e-mail address is found at point, open the URL at or before point using browse-url. With a prefix argument, open the URL using browse-url-secondary-browser-function instead.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/net/goto-addr.el.gz
;; code to find and goto addresses; much of this has been blatantly
;; snarfed from browse-url.el

;;;###autoload
(defun goto-address-at-point (&optional event)
  "Compose a new message to the e-mail address or open URL at point.

Compose message to address at point.  See documentation for
`goto-address-find-address-at-point'.

If no e-mail address is found at point, open the URL at or before
point using `browse-url'.  With a prefix argument, open the URL
using `browse-url-secondary-browser-function' instead."
  (interactive (list last-input-event))
  (save-excursion
    (if event (posn-set-point (event-end event)))
    (let ((address (save-excursion (goto-address-find-address-at-point))))
      (if (and address
               (save-excursion
                 (goto-char (previous-single-char-property-change
                             (point) 'goto-address nil
                             (line-beginning-position)))
                 (not (looking-at goto-address-url-regexp))))
          (compose-mail address)
        (if-let* ((url (browse-url-url-at-point)))
            (browse-url-button-open-url url)
          (error "No e-mail address or URL found"))))))