aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1997-06-24 05:25:09 +0000
committerRichard M. Stallman1997-06-24 05:25:09 +0000
commit6f0e09d4d05ac66aa11e5fccb8f24eb2999ca598 (patch)
tree0e11fc974d2f9f05e0fd4a5e59a947e2d62d142a
parent5352051926d473dffa380f36ef38d723ff43b5eb (diff)
downloademacs-6f0e09d4d05ac66aa11e5fccb8f24eb2999ca598.tar.gz
emacs-6f0e09d4d05ac66aa11e5fccb8f24eb2999ca598.zip
(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."
114 (real-beg 114 (real-beg
115 (progn 115 (progn
116 (funcall 116 (funcall
117 (or (get thing 'end-op) 117 (or (get thing 'beginning-op)
118 (function (lambda () (forward-thing thing -1))))) 118 (function (lambda () (forward-thing thing -1)))))
119 (point)))) 119 (point))))
120 (if (and real-beg end (<= real-beg orig) (<= orig end)) 120 (if (and real-beg end (<= real-beg orig) (<= orig end))
@@ -173,6 +173,15 @@ a symbol as a valid THING."
173 173
174(put 'sexp 'end-op 'end-of-sexp) 174(put 'sexp 'end-op 'end-of-sexp)
175 175
176(defun beginning-of-sexp ()
177 (let ((char-syntax (char-syntax (char-before (point)))))
178 (if (or (eq char-syntax ?\()
179 (and (eq char-syntax ?\") (in-string-p)))
180 (forward-char -1)
181 (forward-sexp -1))))
182
183(put 'sexp 'beginning-op 'beginning-of-sexp)
184
176;; Lists 185;; Lists
177 186
178(put 'list 'end-op (function (lambda () (up-list 1)))) 187(put 'list 'end-op (function (lambda () (up-list 1))))