diff options
author | Richard M. Stallman <rms@gnu.org> | 1997-06-24 05:25:09 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1997-06-24 05:25:09 +0000 |
commit | 6f0e09d4d05ac66aa11e5fccb8f24eb2999ca598 (patch) | |
tree | 0e11fc974d2f9f05e0fd4a5e59a947e2d62d142a /lisp/thingatpt.el | |
parent | 5352051926d473dffa380f36ef38d723ff43b5eb (diff) | |
download | emacs-6f0e09d4d05ac66aa11e5fccb8f24eb2999ca598.tar.gz |
(beginning-of-sexp): New function.
(bounds-of-thing-at-point): Fix typo in computing real-beg.
Diffstat (limited to 'lisp/thingatpt.el')
-rw-r--r-- | lisp/thingatpt.el | 11 |
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)))) |