summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-06-24 05:25:09 +0000
committerRichard M. Stallman <rms@gnu.org>1997-06-24 05:25:09 +0000
commita45d7c986aeab1cf162ce5bec02e18dbd77295ec (patch)
tree43e861f8aa394eddd2448a28d50c7d214cedbe3c
parent6b4409928002b71f610f1a46a2b455cfe5ec1e25 (diff)
downloademacs-a45d7c986aeab1cf162ce5bec02e18dbd77295ec.tar.gz
(beginning-of-sexp): New function.
(bounds-of-thing-at-point): Fix typo in computing real-beg.
-rw-r--r--lisp/thingatpt.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index de97e761e0f..c163b05a7f4 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -114,7 +114,7 @@ of the textual entity that was found."
(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 @@ a symbol as a valid THING."
(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))))