summaryrefslogtreecommitdiff
path: root/lisp/thingatpt.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-12-11 20:59:18 +0000
committerRichard M. Stallman <rms@gnu.org>1996-12-11 20:59:18 +0000
commitc0e0df0407bd94de13245e05d321c0e6d688f26c (patch)
tree7f467b534774e4e3d5b168a4ace311b424b3a078 /lisp/thingatpt.el
parenta2afff836c597fa2c7ef762d8a0558034305f019 (diff)
downloademacs-c0e0df0407bd94de13245e05d321c0e6d688f26c.tar.gz
(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 @.
Diffstat (limited to 'lisp/thingatpt.el')
-rw-r--r--lisp/thingatpt.el24
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."
(or (get thing 'beginning-op)
(function (lambda () (forward-thing thing -1)))))
(point))))
- (if (and beg end (<= beg orig) (< orig end))
- (cons beg end))))
+ (if (and beg end (<= beg orig) (<= orig end))
+ (cons beg end)
+ ;; Try a second time, moving backward first and forward after,
+ ;; so that we can find a thing that ends at ORIG.
+ (let ((beg (progn
+ (funcall
+ (or (get thing 'beginning-op)
+ (function (lambda () (forward-thing thing -1)))))
+ (point)))
+ (end (progn
+ (funcall
+ (or (get thing 'end-op)
+ (function (lambda () (forward-thing thing 1)))))
+ (point))))
+ (if (and beg end (<= beg orig) (<= orig end))
+ (cons beg end))))))
(error nil))))
;;;###autoload
@@ -156,12 +170,12 @@ a symbol as a valid THING."
(put 'filename 'beginning-op
'(lambda () (skip-chars-backward thing-at-point-file-name-chars)))
-(defvar thing-at-point-url-chars "~/A-Za-z0-9---_$%&=.,"
+(defvar thing-at-point-url-chars "~/A-Za-z0-9---_@$%&=.,"
"Characters allowable in a URL.")
(put 'url 'end-op
- '(lambda () (skip-chars-forward thing-at-point-url-chars)
- (skip-chars-backward ".,")))
+ '(lambda () (skip-chars-forward (concat ":" thing-at-point-url-chars))
+ (skip-chars-backward ".,:")))
(put 'url 'beginning-op
'(lambda ()
(skip-chars-backward thing-at-point-url-chars)