Mercurial > emacs
annotate lisp/net/goto-addr.el @ 64556:a0c4a6096f55
(insert-image-file): Add yank-handler.
(image-file-yank-handler): Yank handler to make unique copies of
images when they are yanked into a buffer next to each other.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Thu, 21 Jul 2005 08:56:23 +0000 |
parents | 18a818a2ee7c |
children | 34bd8e434dd7 f9a65d7ebd29 |
rev | line source |
---|---|
28210 | 1 ;;; goto-addr.el --- click to browse URL or to send to e-mail address |
2 | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
3 ;; Copyright (C) 1995, 2000, 2001, 2005 Free Software Foundation, Inc. |
28210 | 4 |
30192 | 5 ;; Author: Eric Ding <ericding@alum.mit.edu> |
30285 | 6 ;; Maintainer: FSF |
28210 | 7 ;; Created: 15 Aug 1995 |
8 ;; Keywords: mh-e, www, mouse, mail | |
9 | |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;; it under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
28210 | 26 |
27 ;;; Commentary: | |
28 | |
29 ;; This package allows you to click or hit a key sequence while on a | |
30 ;; URL or e-mail address, and either load the URL into a browser of | |
31 ;; your choice using the browse-url package, or if it's an e-mail | |
32 ;; address, to send an e-mail to that address. By default, we bind to | |
33 ;; the [mouse-2] and the [C-c return] key sequences. | |
34 | |
35 ;; INSTALLATION | |
36 ;; | |
37 ;; To use goto-address in a particular mode (for example, while | |
38 ;; reading mail in mh-e), add something like this in your .emacs file: | |
39 ;; | |
40 ;; (add-hook 'mh-show-mode-hook 'goto-address) | |
41 ;; | |
29664
3e03d72fadea
(goto-address-fontify): Use keymap property, not local-map.
Dave Love <fx@gnu.org>
parents:
29653
diff
changeset
|
42 ;; The mouse click method is bound to [mouse-2] on highlighted URLs or |
28210 | 43 ;; e-mail addresses only; it functions normally everywhere else. To bind |
44 ;; another mouse click to the function, add the following to your .emacs | |
45 ;; (for example): | |
46 ;; | |
47 ;; (setq goto-address-highlight-keymap | |
48 ;; (let ((m (make-sparse-keymap))) | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
49 ;; (define-key m [S-mouse-2] 'goto-address-at-point) |
28210 | 50 ;; m)) |
51 ;; | |
52 | |
53 ;; Known bugs/features: | |
54 ;; * goto-address-mail-regexp only catches foo@bar.org style addressing, | |
55 ;; not stuff like X.400 addresses, etc. | |
56 ;; * regexp also catches Message-Id line, since it is in the format of | |
57 ;; an Internet e-mail address (like Compuserve addresses) | |
30345
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
58 ;; * If the buffer is fontified after goto-address-fontify is run |
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
59 ;; (say, using font-lock-fontify-buffer), then font-lock faces will |
28210 | 60 ;; override goto-address faces. |
61 | |
62 ;;; Code: | |
63 | |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
64 (require 'thingatpt) |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
65 (autoload 'browse-url-url-at-point "browse-url") |
28210 | 66 |
37423
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
67 ;; XEmacs needs the following definitions. |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
68 (unless (fboundp 'overlays-in) |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
69 (require 'overlay)) |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
70 (unless (fboundp 'line-beginning-position) |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
71 (defalias 'line-beginning-position 'point-at-bol)) |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
72 (unless (fboundp 'line-end-position) |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
73 (defalias 'line-end-position 'point-at-eol)) |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
74 (unless (fboundp 'match-string-no-properties) |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
75 (defalias 'match-string-no-properties 'match-string)) |
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
76 |
28210 | 77 (defgroup goto-address nil |
78 "Click to browse URL or to send to e-mail address." | |
79 :group 'mouse | |
80 :group 'hypermedia) | |
81 | |
82 | |
39568
e67950065cf9
Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
83 ;; I don't expect users to want fontify'ing without highlighting. |
28210 | 84 (defcustom goto-address-fontify-p t |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
85 "*Non-nil means URLs and e-mail addresses in buffer are fontified. |
28210 | 86 But only if `goto-address-highlight-p' is also non-nil." |
87 :type 'boolean | |
88 :group 'goto-address) | |
89 | |
90 (defcustom goto-address-highlight-p t | |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
91 "*Non-nil means URLs and e-mail addresses in buffer are highlighted." |
28210 | 92 :type 'boolean |
93 :group 'goto-address) | |
94 | |
95 (defcustom goto-address-fontify-maximum-size 30000 | |
51098
9277afae9517
(goto-address-fontify-maximum-size): Value t means no limit.
Richard M. Stallman <rms@gnu.org>
parents:
49598
diff
changeset
|
96 "*Maximum size of file in which to fontify and/or highlight URLs. |
9277afae9517
(goto-address-fontify-maximum-size): Value t means no limit.
Richard M. Stallman <rms@gnu.org>
parents:
49598
diff
changeset
|
97 A value of t means there is no limit--fontify regardless of the size." |
9277afae9517
(goto-address-fontify-maximum-size): Value t means no limit.
Richard M. Stallman <rms@gnu.org>
parents:
49598
diff
changeset
|
98 :type '(choice (integer :tag "Maximum size") (const :tag "No limit" t)) |
28210 | 99 :group 'goto-address) |
100 | |
101 (defvar goto-address-mail-regexp | |
39790
1802ca573682
(goto-address-mail-regexp): Allow + in username.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39568
diff
changeset
|
102 ;; Actually pretty much any char could appear in the username part. -stef |
59117
7aa5e44f673f
(goto-address-mail-regexp): Allow = in username.
Richard M. Stallman <rms@gnu.org>
parents:
56210
diff
changeset
|
103 "[-a-zA-Z0-9=._+]+@\\([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+" |
28210 | 104 "A regular expression probably matching an e-mail address.") |
105 | |
48068
0560d7169eba
(goto-address-url-regexp): Don't match `mailto'.
Richard M. Stallman <rms@gnu.org>
parents:
39790
diff
changeset
|
106 (defvar goto-address-url-regexp |
0560d7169eba
(goto-address-url-regexp): Don't match `mailto'.
Richard M. Stallman <rms@gnu.org>
parents:
39790
diff
changeset
|
107 (concat "\\<\\(" |
0560d7169eba
(goto-address-url-regexp): Don't match `mailto'.
Richard M. Stallman <rms@gnu.org>
parents:
39790
diff
changeset
|
108 (mapconcat 'identity |
0560d7169eba
(goto-address-url-regexp): Don't match `mailto'.
Richard M. Stallman <rms@gnu.org>
parents:
39790
diff
changeset
|
109 (delete "mailto:" (copy-sequence thing-at-point-uri-schemes)) |
0560d7169eba
(goto-address-url-regexp): Don't match `mailto'.
Richard M. Stallman <rms@gnu.org>
parents:
39790
diff
changeset
|
110 "\\|") |
0560d7169eba
(goto-address-url-regexp): Don't match `mailto'.
Richard M. Stallman <rms@gnu.org>
parents:
39790
diff
changeset
|
111 "\\)" |
0560d7169eba
(goto-address-url-regexp): Don't match `mailto'.
Richard M. Stallman <rms@gnu.org>
parents:
39790
diff
changeset
|
112 thing-at-point-url-path-regexp) |
39568
e67950065cf9
Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
113 ;; (concat "\\b\\(s?https?\\|ftp\\|file\\|gopher\\|news\\|" |
e67950065cf9
Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
114 ;; "telnet\\|wais\\):\\(//[-a-zA-Z0-9_.]+:" |
e67950065cf9
Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
115 ;; "[0-9]*\\)?[-a-zA-Z0-9_=?#$@~`%&*+|\\/.,]*" |
e67950065cf9
Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
116 ;; "[-a-zA-Z0-9_=#$@~`%&*+|\\/]") |
28210 | 117 "A regular expression probably matching a URL.") |
118 | |
119 (defvar goto-address-highlight-keymap | |
120 (let ((m (make-sparse-keymap))) | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
121 (define-key m (if (featurep 'xemacs) (kbd "<button2>") (kbd "<mouse-2>")) |
62131
ae455ff58429
Paren typo again.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
62130
diff
changeset
|
122 'goto-address-at-point) |
37423
3ab2c865a8e5
Instead of defining line-beginning-position and
Gerd Moellmann <gerd@gnu.org>
parents:
30891
diff
changeset
|
123 (define-key m (kbd "C-c RET") 'goto-address-at-point) |
28210 | 124 m) |
125 "keymap to hold goto-addr's mouse key defs under highlighted URLs.") | |
126 | |
127 (defcustom goto-address-url-face 'bold | |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
128 "Face to use for URLs." |
28210 | 129 :type 'face |
130 :group 'goto-address) | |
131 | |
132 (defcustom goto-address-url-mouse-face 'highlight | |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
133 "Face to use for URLs when the mouse is on them." |
28210 | 134 :type 'face |
135 :group 'goto-address) | |
136 | |
137 (defcustom goto-address-mail-face 'italic | |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
138 "Face to use for e-mail addresses." |
28210 | 139 :type 'face |
140 :group 'goto-address) | |
141 | |
142 (defcustom goto-address-mail-mouse-face 'secondary-selection | |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
143 "Face to use for e-mail addresses when the mouse is on them." |
28210 | 144 :type 'face |
145 :group 'goto-address) | |
146 | |
147 (defun goto-address-fontify () | |
29664
3e03d72fadea
(goto-address-fontify): Use keymap property, not local-map.
Dave Love <fx@gnu.org>
parents:
29653
diff
changeset
|
148 "Fontify the URLs and e-mail addresses in the current buffer. |
28210 | 149 This function implements `goto-address-highlight-p' |
150 and `goto-address-fontify-p'." | |
30345
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
151 ;; Clean up from any previous go. |
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
152 (dolist (overlay (overlays-in (point-min) (point-max))) |
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
153 (if (overlay-get overlay 'goto-address) |
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
154 (delete-overlay overlay))) |
28210 | 155 (save-excursion |
30345
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
156 (let ((inhibit-point-motion-hooks t)) |
28210 | 157 (goto-char (point-min)) |
51098
9277afae9517
(goto-address-fontify-maximum-size): Value t means no limit.
Richard M. Stallman <rms@gnu.org>
parents:
49598
diff
changeset
|
158 (if (or (eq t goto-address-fontify-maximum-size) |
9277afae9517
(goto-address-fontify-maximum-size): Value t means no limit.
Richard M. Stallman <rms@gnu.org>
parents:
49598
diff
changeset
|
159 (< (- (point-max) (point)) goto-address-fontify-maximum-size)) |
28210 | 160 (progn |
161 (while (re-search-forward goto-address-url-regexp nil t) | |
162 (let* ((s (match-beginning 0)) | |
163 (e (match-end 0)) | |
164 (this-overlay (make-overlay s e))) | |
165 (and goto-address-fontify-p | |
166 (overlay-put this-overlay 'face goto-address-url-face)) | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
167 (overlay-put this-overlay 'evaporate t) |
28210 | 168 (overlay-put this-overlay |
169 'mouse-face goto-address-url-mouse-face) | |
170 (overlay-put this-overlay | |
56210
92bfc3abe98f
(goto-address-fontify): Fix help-echo text.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
171 'help-echo "mouse-2, C-c RET: follow URL") |
29209
67618bef1515
(goto-address-fontify): Add help-echo property.
Dave Love <fx@gnu.org>
parents:
28210
diff
changeset
|
172 (overlay-put this-overlay |
30345
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
173 'keymap goto-address-highlight-keymap) |
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
174 (overlay-put this-overlay 'goto-address t))) |
28210 | 175 (goto-char (point-min)) |
176 (while (re-search-forward goto-address-mail-regexp nil t) | |
177 (let* ((s (match-beginning 0)) | |
178 (e (match-end 0)) | |
179 (this-overlay (make-overlay s e))) | |
180 (and goto-address-fontify-p | |
181 (overlay-put this-overlay 'face goto-address-mail-face)) | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
182 (overlay-put this-overlay 'evaporate t) |
28210 | 183 (overlay-put this-overlay 'mouse-face |
184 goto-address-mail-mouse-face) | |
29209
67618bef1515
(goto-address-fontify): Add help-echo property.
Dave Love <fx@gnu.org>
parents:
28210
diff
changeset
|
185 (overlay-put this-overlay |
56210
92bfc3abe98f
(goto-address-fontify): Fix help-echo text.
Luc Teirlinck <teirllm@auburn.edu>
parents:
52401
diff
changeset
|
186 'help-echo "mouse-2, C-c RET: mail this address") |
28210 | 187 (overlay-put this-overlay |
30345
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
188 'keymap goto-address-highlight-keymap) |
d24028985f3d
(goto-address-fontify): Don't bother with buffer-modified and read-only
Dave Love <fx@gnu.org>
parents:
30285
diff
changeset
|
189 (overlay-put this-overlay 'goto-address t)))))))) |
28210 | 190 |
39568
e67950065cf9
Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
191 ;; code to find and goto addresses; much of this has been blatantly |
e67950065cf9
Change ;;; to ;; for outline-minor-mode.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
192 ;; snarfed from browse-url.el |
28210 | 193 |
194 ;;;###autoload | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
195 (define-obsolete-function-alias |
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
196 'goto-address-at-mouse 'goto-address-at-point "22.1") |
28210 | 197 |
198 ;;;###autoload | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
199 (defun goto-address-at-point (&optional event) |
28210 | 200 "Send to the e-mail address or load the URL at point. |
201 Send mail to address at point. See documentation for | |
202 `goto-address-find-address-at-point'. If no address is found | |
203 there, then load the URL at or before point." | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
204 (interactive (list last-input-event)) |
28210 | 205 (save-excursion |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
206 (if event (mouse-set-point event)) |
28210 | 207 (let ((address (save-excursion (goto-address-find-address-at-point)))) |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48068
diff
changeset
|
208 (if (and address |
37809
5bc4eff5115e
(goto-address-at-point): Deal with URLs
Gerd Moellmann <gerd@gnu.org>
parents:
37423
diff
changeset
|
209 (save-excursion |
5bc4eff5115e
(goto-address-at-point): Deal with URLs
Gerd Moellmann <gerd@gnu.org>
parents:
37423
diff
changeset
|
210 (goto-char (previous-single-char-property-change |
5bc4eff5115e
(goto-address-at-point): Deal with URLs
Gerd Moellmann <gerd@gnu.org>
parents:
37423
diff
changeset
|
211 (point) 'goto-address nil |
5bc4eff5115e
(goto-address-at-point): Deal with URLs
Gerd Moellmann <gerd@gnu.org>
parents:
37423
diff
changeset
|
212 (line-beginning-position))) |
5bc4eff5115e
(goto-address-at-point): Deal with URLs
Gerd Moellmann <gerd@gnu.org>
parents:
37423
diff
changeset
|
213 (not (looking-at goto-address-url-regexp)))) |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
214 (compose-mail address) |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
215 (let ((url (browse-url-url-at-point))) |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
216 (if url |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
217 (browse-url url) |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
218 (error "No e-mail address or URL found"))))))) |
28210 | 219 |
220 (defun goto-address-find-address-at-point () | |
221 "Find e-mail address around or before point. | |
222 Then search backwards to beginning of line for the start of an e-mail | |
30891
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
223 address. If no e-mail address found, return nil." |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
224 (re-search-backward "[^-_A-z0-9.@]" (line-beginning-position) 'lim) |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
225 (if (or (looking-at goto-address-mail-regexp) ; already at start |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
226 (and (re-search-forward goto-address-mail-regexp |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
227 (line-end-position) 'lim) |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
228 (goto-char (match-beginning 0)))) |
42ce5997aa4a
Don't require browse-url. Require thingatpt.
Dave Love <fx@gnu.org>
parents:
30345
diff
changeset
|
229 (match-string-no-properties 0))) |
28210 | 230 |
231 ;;;###autoload | |
232 (defun goto-address () | |
233 "Sets up goto-address functionality in the current buffer. | |
234 Allows user to use mouse/keyboard command to click to go to a URL | |
235 or to send e-mail. | |
236 By default, goto-address binds to mouse-2 and C-c RET. | |
237 | |
238 Also fontifies the buffer appropriately (see `goto-address-fontify-p' and | |
239 `goto-address-highlight-p' for more information)." | |
240 (interactive) | |
241 (if goto-address-highlight-p | |
242 (goto-address-fontify))) | |
243 | |
244 (provide 'goto-addr) | |
245 | |
62130
109432f1fa94
(goto-address-fontify): Make sure the overlays
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
59117
diff
changeset
|
246 ;; arch-tag: ca47c505-5661-425d-a471-62bc6e75cf0a |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
37809
diff
changeset
|
247 ;;; goto-addr.el ends here |