aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-04-18 03:39:28 +0000
committerChong Yidong2009-04-18 03:39:28 +0000
commit965b9376cfde6ff247695ae277671df58cdcbb7a (patch)
tree23f1a18de288d0f3a1ef829979529d35581a75eb
parentbc323c0489c158d8014cf52f8646e7080a5b27f1 (diff)
downloademacs-965b9376cfde6ff247695ae277671df58cdcbb7a.tar.gz
emacs-965b9376cfde6ff247695ae277671df58cdcbb7a.zip
* thingatpt.el (thing-at-point-bounds-of-list-at-point): New
function (Bug#3027).
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/thingatpt.el22
2 files changed, 25 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 76fd5df25de..c7628f28198 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12009-04-18 Chong Yidong <cyd@stupidchicken.com>
2
3 * thingatpt.el (thing-at-point-bounds-of-list-at-point): New
4 function (Bug#3027).
5
12009-04-17 Kenichi Handa <handa@m17n.org> 62009-04-17 Kenichi Handa <handa@m17n.org>
2 7
3 * international/uni-decomposition.el: Re-generated. 8 * international/uni-decomposition.el: Re-generated.
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 96a79247790..dfd2fc91678 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -188,8 +188,26 @@ a symbol as a valid THING."
188 188
189;; Lists 189;; Lists
190 190
191(put 'list 'end-op (lambda () (up-list 1))) 191(put 'list 'bounds-of-thing-at-point 'thing-at-point-bounds-of-list-at-point)
192(put 'list 'beginning-op 'backward-sexp) 192
193(defun thing-at-point-bounds-of-list-at-point ()
194 (save-excursion
195 (let ((opoint (point))
196 (beg (condition-case nil
197 (progn (up-list -1)
198 (point))
199 (error nil))))
200 (condition-case nil
201 (if beg
202 (progn (forward-sexp)
203 (cons beg (point)))
204 ;; Are we are at the beginning of a top-level sexp?
205 (forward-sexp)
206 (let ((end (point)))
207 (backward-sexp)
208 (if (>= opoint (point))
209 (cons opoint end))))
210 (error nil)))))
193 211
194;; Filenames and URLs www.com/foo%32bar 212;; Filenames and URLs www.com/foo%32bar
195 213