emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog thingatpt.el


From: Chong Yidong
Subject: [Emacs-diffs] emacs/lisp ChangeLog thingatpt.el
Date: Sat, 18 Apr 2009 03:39:31 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Chong Yidong <cyd>      09/04/18 03:39:31

Modified files:
        lisp           : ChangeLog thingatpt.el 

Log message:
        * thingatpt.el (thing-at-point-bounds-of-list-at-point): New
        function (Bug#3027).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.15597&r2=1.15598
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/thingatpt.el?cvsroot=emacs&r1=1.49&r2=1.50

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.15597
retrieving revision 1.15598
diff -u -b -r1.15597 -r1.15598
--- ChangeLog   17 Apr 2009 02:31:20 -0000      1.15597
+++ ChangeLog   18 Apr 2009 03:39:28 -0000      1.15598
@@ -1,3 +1,8 @@
+2009-04-18  Chong Yidong  <address@hidden>
+
+       * thingatpt.el (thing-at-point-bounds-of-list-at-point): New
+       function (Bug#3027).
+
 2009-04-17  Kenichi Handa  <address@hidden>
 
        * international/uni-decomposition.el: Re-generated.

Index: thingatpt.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/thingatpt.el,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- thingatpt.el        5 Jan 2009 03:19:49 -0000       1.49
+++ thingatpt.el        18 Apr 2009 03:39:31 -0000      1.50
@@ -188,8 +188,26 @@
 
 ;;  Lists
 
-(put 'list 'end-op (lambda () (up-list 1)))
-(put 'list 'beginning-op 'backward-sexp)
+(put 'list 'bounds-of-thing-at-point 'thing-at-point-bounds-of-list-at-point)
+
+(defun thing-at-point-bounds-of-list-at-point ()
+  (save-excursion
+    (let ((opoint (point))
+         (beg (condition-case nil
+                  (progn (up-list -1)
+                         (point))
+                (error nil))))
+      (condition-case nil
+         (if beg
+             (progn (forward-sexp)
+                    (cons beg (point)))
+           ;; Are we are at the beginning of a top-level sexp?
+           (forward-sexp)
+           (let ((end (point)))
+             (backward-sexp)
+             (if (>= opoint (point))
+                 (cons opoint end))))
+       (error nil)))))
 
 ;;  Filenames and URLs  www.com/foo%32bar
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]