changeset 18432:b2bc7438b6b0

(beginning-of-sexp): New function. (bounds-of-thing-at-point): Fix typo in computing real-beg.
author Richard M. Stallman <rms@gnu.org>
date Tue, 24 Jun 1997 05:25:09 +0000
parents 8208c168c5cc
children 1de7cef26431
files lisp/thingatpt.el
diffstat 1 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/thingatpt.el	Tue Jun 24 03:33:33 1997 +0000
+++ b/lisp/thingatpt.el	Tue Jun 24 05:25:09 1997 +0000
@@ -114,7 +114,7 @@
 		    (real-beg
 		     (progn 
 		       (funcall 
-			(or (get thing 'end-op) 
+			(or (get thing 'beginning-op) 
 			    (function (lambda () (forward-thing thing -1)))))
 		       (point))))
 		(if (and real-beg end (<= real-beg orig) (<= orig end))
@@ -173,6 +173,15 @@
 
 (put 'sexp 'end-op 'end-of-sexp)
 
+(defun beginning-of-sexp ()
+  (let ((char-syntax (char-syntax (char-before (point)))))
+    (if (or (eq char-syntax ?\()
+	    (and (eq char-syntax ?\") (in-string-p)))
+	(forward-char -1)
+      (forward-sexp -1))))
+
+(put 'sexp 'beginning-op 'beginning-of-sexp)
+
 ;;  Lists 
 
 (put 'list 'end-op (function (lambda () (up-list 1))))