* gnus-cus.el (()): Make sure that calling `gnus-visual-p' during
[bpt/emacs.git] / lisp / goto-addr.el
index 89645ec..4c40232 100644 (file)
@@ -42,7 +42,7 @@
 ;; By default, goto-address now sends using `mail' instead of `mh-send'.
 ;; To use mh-e to send mail, add the following to your .emacs file:
 ;;
-;; (setq goto-address-mail-method 'goto-address-send-using-mhe)
+;; (setq goto-address-mail-method 'goto-address-send-using-mh-e)
 ;;
 ;; The mouse click method is bound to [mouse-2] on highlighted URL's or
 ;; e-mail addresses only; it functions normally everywhere else.  To bind
@@ -98,7 +98,7 @@ But only if `goto-address-highlight-p' is also non-nil.")
   'goto-address-send-using-mail
   "*Function to compose mail.
 Two pre-made functions are `goto-address-send-using-mail' (sendmail);
-and `goto-address-send-using-mhe' (MH-E).")
+and `goto-address-send-using-mh-e' (MH-E).")
 
 (defvar goto-address-highlight-keymap
   (let ((m (make-sparse-keymap)))
@@ -106,6 +106,18 @@ and `goto-address-send-using-mhe' (MH-E).")
     m)
   "keymap to hold goto-addr's mouse key defs under highlighted URLs.")
 
+(defvar goto-address-url-face 'bold
+  "*Face to use for URLs.")
+
+(defvar goto-address-url-mouse-face 'highlight
+  "*Face to use for URLs when the mouse is on them.")
+
+(defvar goto-address-mail-face 'italic
+  "*Face to use for e-mail addresses.")
+
+(defvar goto-address-mail-mouse-face 'secondary-selection
+  "*Face to use for e-mail addresses when the mouse is on them.")
+
 (defun goto-address-fontify ()
   "Fontify the URL's and e-mail addresses in the current buffer.
 This function implements `goto-address-highlight-p'
@@ -120,22 +132,18 @@ and `goto-address-fontify-p'."
            (while (re-search-forward goto-address-url-regexp nil t)
               (let ((s (match-beginning 0))
                     (e (match-end 0)))
-               (goto-char e)
                (and goto-address-fontify-p
-                    (put-text-property s e 'face 'bold))
-               (put-text-property s e 'mouse-face 'highlight)
+                    (put-text-property s e 'face goto-address-url-face))
+               (put-text-property s e 'mouse-face goto-address-url-mouse-face)
                (put-text-property
                 s e 'local-map goto-address-highlight-keymap)))
            (goto-char (point-min))
            (while (re-search-forward goto-address-mail-regexp nil t)
               (let ((s (match-beginning 0))
                     (e (match-end 0)))
-               (goto-char (match-end 0))
                (and goto-address-fontify-p
-                    (put-text-property (match-beginning 0) (match-end 0)
-                                       'face 'italic))
-               (put-text-property (match-beginning 0) (match-end 0)
-                                  'mouse-face 'secondary-selection)
+                    (put-text-property s e 'face goto-address-mail-face))
+               (put-text-property s e 'mouse-face goto-address-mail-mouse-face)
                (put-text-property
                 s e 'local-map goto-address-highlight-keymap)))))
       (and (buffer-modified-p)
@@ -194,7 +202,8 @@ address.  If no e-mail address found, return the empty string."
        (buffer-substring (match-beginning 0) (match-end 0))
       "")))
 
-(defun goto-address-send-using-mhe (to)
+(defun goto-address-send-using-mh-e (to)
+  (require 'mh-comp)
   (mh-find-path)
   (let ((cc (mh-read-address "Cc: "))
        (subject (read-string "Subject: "))
@@ -202,6 +211,8 @@ address.  If no e-mail address found, return the empty string."
     (delete-other-windows)
     (mh-send-sub to cc subject config)))
 
+(fset 'goto-address-send-using-mhe 'goto-address-send-using-mh-e)
+
 (defun goto-address-send-using-mail (to)
   (mail-other-window nil to)
   (and (goto-char (point-min))