diff options
| author | Stefan Monnier | 2005-05-06 21:24:09 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2005-05-06 21:24:09 +0000 |
| commit | 9fd6c528c8cd52659098e6143454012c3b4e51f7 (patch) | |
| tree | 5b9a28c030e3439570c83ddf6478f7b14429eb5e | |
| parent | c5d164dc620a746b7d2ac6c833bb5e19e0a86f71 (diff) | |
| download | emacs-9fd6c528c8cd52659098e6143454012c3b4e51f7.tar.gz emacs-9fd6c528c8cd52659098e6143454012c3b4e51f7.zip | |
(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.
| -rw-r--r-- | lisp/net/goto-addr.el | 29 |
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 @@ | |||
| 1 | ;;; goto-addr.el --- click to browse URL or to send to e-mail address | 1 | ;;; goto-addr.el --- click to browse URL or to send to e-mail address |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1995, 2000, 2001 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1995, 2000, 2001, 2005 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Eric Ding <ericding@alum.mit.edu> | 5 | ;; Author: Eric Ding <ericding@alum.mit.edu> |
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| @@ -46,7 +46,7 @@ | |||
| 46 | ;; | 46 | ;; |
| 47 | ;; (setq goto-address-highlight-keymap | 47 | ;; (setq goto-address-highlight-keymap |
| 48 | ;; (let ((m (make-sparse-keymap))) | 48 | ;; (let ((m (make-sparse-keymap))) |
| 49 | ;; (define-key m [S-mouse-2] 'goto-address-at-mouse) | 49 | ;; (define-key m [S-mouse-2] 'goto-address-at-point) |
| 50 | ;; m)) | 50 | ;; m)) |
| 51 | ;; | 51 | ;; |
| 52 | 52 | ||
| @@ -118,9 +118,8 @@ A value of t means there is no limit--fontify regardless of the size." | |||
| 118 | 118 | ||
| 119 | (defvar goto-address-highlight-keymap | 119 | (defvar goto-address-highlight-keymap |
| 120 | (let ((m (make-sparse-keymap))) | 120 | (let ((m (make-sparse-keymap))) |
| 121 | (if (featurep 'xemacs) | 121 | (define-key m (if (featurep 'xemacs) (kbd "<button2>") (kbd "<mouse-2>")) |
| 122 | (define-key m (kbd "<button2>") 'goto-address-at-mouse) | 122 | 'goto-address-at-point)) |
| 123 | (define-key m (kbd "<mouse-2>") 'goto-address-at-mouse)) | ||
| 124 | (define-key m (kbd "C-c RET") 'goto-address-at-point) | 123 | (define-key m (kbd "C-c RET") 'goto-address-at-point) |
| 125 | m) | 124 | m) |
| 126 | "keymap to hold goto-addr's mouse key defs under highlighted URLs.") | 125 | "keymap to hold goto-addr's mouse key defs under highlighted URLs.") |
| @@ -165,6 +164,7 @@ and `goto-address-fontify-p'." | |||
| 165 | (this-overlay (make-overlay s e))) | 164 | (this-overlay (make-overlay s e))) |
| 166 | (and goto-address-fontify-p | 165 | (and goto-address-fontify-p |
| 167 | (overlay-put this-overlay 'face goto-address-url-face)) | 166 | (overlay-put this-overlay 'face goto-address-url-face)) |
| 167 | (overlay-put this-overlay 'evaporate t) | ||
| 168 | (overlay-put this-overlay | 168 | (overlay-put this-overlay |
| 169 | 'mouse-face goto-address-url-mouse-face) | 169 | 'mouse-face goto-address-url-mouse-face) |
| 170 | (overlay-put this-overlay | 170 | (overlay-put this-overlay |
| @@ -179,6 +179,7 @@ and `goto-address-fontify-p'." | |||
| 179 | (this-overlay (make-overlay s e))) | 179 | (this-overlay (make-overlay s e))) |
| 180 | (and goto-address-fontify-p | 180 | (and goto-address-fontify-p |
| 181 | (overlay-put this-overlay 'face goto-address-mail-face)) | 181 | (overlay-put this-overlay 'face goto-address-mail-face)) |
| 182 | (overlay-put this-overlay 'evaporate t) | ||
| 182 | (overlay-put this-overlay 'mouse-face | 183 | (overlay-put this-overlay 'mouse-face |
| 183 | goto-address-mail-mouse-face) | 184 | goto-address-mail-mouse-face) |
| 184 | (overlay-put this-overlay | 185 | (overlay-put this-overlay |
| @@ -191,24 +192,18 @@ and `goto-address-fontify-p'." | |||
| 191 | ;; snarfed from browse-url.el | 192 | ;; snarfed from browse-url.el |
| 192 | 193 | ||
| 193 | ;;;###autoload | 194 | ;;;###autoload |
| 194 | (defun goto-address-at-mouse (event) | 195 | (define-obsolete-function-alias |
| 195 | "Send to the e-mail address or load the URL clicked with the mouse. | 196 | 'goto-address-at-mouse 'goto-address-at-point "22.1") |
| 196 | Send mail to address at position of mouse click. See documentation for | ||
| 197 | `goto-address-find-address-at-point'. If no address is found | ||
| 198 | there, then load the URL at or before the position of the mouse click." | ||
| 199 | (interactive "e") | ||
| 200 | (save-excursion | ||
| 201 | (mouse-set-point event) | ||
| 202 | (goto-address-at-point))) | ||
| 203 | 197 | ||
| 204 | ;;;###autoload | 198 | ;;;###autoload |
| 205 | (defun goto-address-at-point () | 199 | (defun goto-address-at-point (&optional event) |
| 206 | "Send to the e-mail address or load the URL at point. | 200 | "Send to the e-mail address or load the URL at point. |
| 207 | Send mail to address at point. See documentation for | 201 | Send mail to address at point. See documentation for |
| 208 | `goto-address-find-address-at-point'. If no address is found | 202 | `goto-address-find-address-at-point'. If no address is found |
| 209 | there, then load the URL at or before point." | 203 | there, then load the URL at or before point." |
| 210 | (interactive) | 204 | (interactive (list last-input-event)) |
| 211 | (save-excursion | 205 | (save-excursion |
| 206 | (if event (mouse-set-point event)) | ||
| 212 | (let ((address (save-excursion (goto-address-find-address-at-point)))) | 207 | (let ((address (save-excursion (goto-address-find-address-at-point)))) |
| 213 | (if (and address | 208 | (if (and address |
| 214 | (save-excursion | 209 | (save-excursion |
| @@ -248,5 +243,5 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and | |||
| 248 | 243 | ||
| 249 | (provide 'goto-addr) | 244 | (provide 'goto-addr) |
| 250 | 245 | ||
| 251 | ;;; arch-tag: ca47c505-5661-425d-a471-62bc6e75cf0a | 246 | ;; arch-tag: ca47c505-5661-425d-a471-62bc6e75cf0a |
| 252 | ;;; goto-addr.el ends here | 247 | ;;; goto-addr.el ends here |