summaryrefslogtreecommitdiff
path: root/lisp/net/goto-addr.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2005-05-06 21:24:09 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2005-05-06 21:24:09 +0000
commit9fd6c528c8cd52659098e6143454012c3b4e51f7 (patch)
tree5b9a28c030e3439570c83ddf6478f7b14429eb5e /lisp/net/goto-addr.el
parentc5d164dc620a746b7d2ac6c833bb5e19e0a86f71 (diff)
downloademacs-9fd6c528c8cd52659098e6143454012c3b4e51f7.tar.gz
(goto-address-fontify): Make sure the overlays
evaporate if their text is deleted. (goto-address-at-point): Make it work as a mouse binding as well. (goto-address-at-mouse): Obsolete it. Update users.
Diffstat (limited to 'lisp/net/goto-addr.el')
-rw-r--r--lisp/net/goto-addr.el29
1 files changed, 12 insertions, 17 deletions
diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el
index 95a13b620a2..b15acbbc730 100644
--- a/lisp/net/goto-addr.el
+++ b/lisp/net/goto-addr.el
@@ -1,6 +1,6 @@
;;; goto-addr.el --- click to browse URL or to send to e-mail address
-;; Copyright (C) 1995, 2000, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2000, 2001, 2005 Free Software Foundation, Inc.
;; Author: Eric Ding <ericding@alum.mit.edu>
;; Maintainer: FSF
@@ -46,7 +46,7 @@
;;
;; (setq goto-address-highlight-keymap
;; (let ((m (make-sparse-keymap)))
-;; (define-key m [S-mouse-2] 'goto-address-at-mouse)
+;; (define-key m [S-mouse-2] 'goto-address-at-point)
;; m))
;;
@@ -118,9 +118,8 @@ A value of t means there is no limit--fontify regardless of the size."
(defvar goto-address-highlight-keymap
(let ((m (make-sparse-keymap)))
- (if (featurep 'xemacs)
- (define-key m (kbd "<button2>") 'goto-address-at-mouse)
- (define-key m (kbd "<mouse-2>") 'goto-address-at-mouse))
+ (define-key m (if (featurep 'xemacs) (kbd "<button2>") (kbd "<mouse-2>"))
+ 'goto-address-at-point))
(define-key m (kbd "C-c RET") 'goto-address-at-point)
m)
"keymap to hold goto-addr's mouse key defs under highlighted URLs.")
@@ -165,6 +164,7 @@ and `goto-address-fontify-p'."
(this-overlay (make-overlay s e)))
(and goto-address-fontify-p
(overlay-put this-overlay 'face goto-address-url-face))
+ (overlay-put this-overlay 'evaporate t)
(overlay-put this-overlay
'mouse-face goto-address-url-mouse-face)
(overlay-put this-overlay
@@ -179,6 +179,7 @@ and `goto-address-fontify-p'."
(this-overlay (make-overlay s e)))
(and goto-address-fontify-p
(overlay-put this-overlay 'face goto-address-mail-face))
+ (overlay-put this-overlay 'evaporate t)
(overlay-put this-overlay 'mouse-face
goto-address-mail-mouse-face)
(overlay-put this-overlay
@@ -191,24 +192,18 @@ and `goto-address-fontify-p'."
;; snarfed from browse-url.el
;;;###autoload
-(defun goto-address-at-mouse (event)
- "Send to the e-mail address or load the URL clicked with the mouse.
-Send mail to address at position of mouse click. See documentation for
-`goto-address-find-address-at-point'. If no address is found
-there, then load the URL at or before the position of the mouse click."
- (interactive "e")
- (save-excursion
- (mouse-set-point event)
- (goto-address-at-point)))
+(define-obsolete-function-alias
+ 'goto-address-at-mouse 'goto-address-at-point "22.1")
;;;###autoload
-(defun goto-address-at-point ()
+(defun goto-address-at-point (&optional event)
"Send to the e-mail address or load the URL at point.
Send mail to address at point. See documentation for
`goto-address-find-address-at-point'. If no address is found
there, then load the URL at or before point."
- (interactive)
+ (interactive (list last-input-event))
(save-excursion
+ (if event (mouse-set-point event))
(let ((address (save-excursion (goto-address-find-address-at-point))))
(if (and address
(save-excursion
@@ -248,5 +243,5 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and
(provide 'goto-addr)
-;;; arch-tag: ca47c505-5661-425d-a471-62bc6e75cf0a
+;; arch-tag: ca47c505-5661-425d-a471-62bc6e75cf0a
;;; goto-addr.el ends here