# HG changeset patch # User Richard M. Stallman # Date 850337958 0 # Node ID bf249c4b4beb2b3765f44ca9251cea5021cb2010 # Parent 19eb807123053e57978a1a4f8bf2b0564ceb799e (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 @. diff -r 19eb80712305 -r bf249c4b4beb lisp/thingatpt.el --- a/lisp/thingatpt.el Wed Dec 11 20:25:24 1996 +0000 +++ b/lisp/thingatpt.el Wed Dec 11 20:59:18 1996 +0000 @@ -85,8 +85,22 @@ (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 @@ (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)