diff options
| author | Richard M. Stallman | 1996-12-11 20:59:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-12-11 20:59:18 +0000 |
| commit | 02807c95d318a13b7bc56ab320916686437aeb83 (patch) | |
| tree | f468c145720a35637aa8a33805141621c8fb6db8 | |
| parent | 79062c6c2fc05af1f00a043d3ea560fdd0abac5d (diff) | |
| download | emacs-02807c95d318a13b7bc56ab320916686437aeb83.tar.gz emacs-02807c95d318a13b7bc56ab320916686437aeb83.zip | |
(bounds-of-thing-at-point): Allow the end
to be at the same place as ORIG.
Try harder to find a thing that ends at ORIG.
(url): Move forward over colons.
Move back over colons at the end.
(thing-at-point-file-name-chars): Include @.
| -rw-r--r-- | lisp/thingatpt.el | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index 61f1890e75b..fda31632aa1 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el | |||
| @@ -85,8 +85,22 @@ of the textual entity that was found." | |||
| 85 | (or (get thing 'beginning-op) | 85 | (or (get thing 'beginning-op) |
| 86 | (function (lambda () (forward-thing thing -1))))) | 86 | (function (lambda () (forward-thing thing -1))))) |
| 87 | (point)))) | 87 | (point)))) |
| 88 | (if (and beg end (<= beg orig) (< orig end)) | 88 | (if (and beg end (<= beg orig) (<= orig end)) |
| 89 | (cons beg end)))) | 89 | (cons beg end) |
| 90 | ;; Try a second time, moving backward first and forward after, | ||
| 91 | ;; so that we can find a thing that ends at ORIG. | ||
| 92 | (let ((beg (progn | ||
| 93 | (funcall | ||
| 94 | (or (get thing 'beginning-op) | ||
| 95 | (function (lambda () (forward-thing thing -1))))) | ||
| 96 | (point))) | ||
| 97 | (end (progn | ||
| 98 | (funcall | ||
| 99 | (or (get thing 'end-op) | ||
| 100 | (function (lambda () (forward-thing thing 1))))) | ||
| 101 | (point)))) | ||
| 102 | (if (and beg end (<= beg orig) (<= orig end)) | ||
| 103 | (cons beg end)))))) | ||
| 90 | (error nil)))) | 104 | (error nil)))) |
| 91 | 105 | ||
| 92 | ;;;###autoload | 106 | ;;;###autoload |
| @@ -156,12 +170,12 @@ a symbol as a valid THING." | |||
| 156 | (put 'filename 'beginning-op | 170 | (put 'filename 'beginning-op |
| 157 | '(lambda () (skip-chars-backward thing-at-point-file-name-chars))) | 171 | '(lambda () (skip-chars-backward thing-at-point-file-name-chars))) |
| 158 | 172 | ||
| 159 | (defvar thing-at-point-url-chars "~/A-Za-z0-9---_$%&=.," | 173 | (defvar thing-at-point-url-chars "~/A-Za-z0-9---_@$%&=.," |
| 160 | "Characters allowable in a URL.") | 174 | "Characters allowable in a URL.") |
| 161 | 175 | ||
| 162 | (put 'url 'end-op | 176 | (put 'url 'end-op |
| 163 | '(lambda () (skip-chars-forward thing-at-point-url-chars) | 177 | '(lambda () (skip-chars-forward (concat ":" thing-at-point-url-chars)) |
| 164 | (skip-chars-backward ".,"))) | 178 | (skip-chars-backward ".,:"))) |
| 165 | (put 'url 'beginning-op | 179 | (put 'url 'beginning-op |
| 166 | '(lambda () | 180 | '(lambda () |
| 167 | (skip-chars-backward thing-at-point-url-chars) | 181 | (skip-chars-backward thing-at-point-url-chars) |