From 6f0e09d4d05ac66aa11e5fccb8f24eb2999ca598 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 24 Jun 1997 05:25:09 +0000 Subject: [PATCH] (beginning-of-sexp): New function. (bounds-of-thing-at-point): Fix typo in computing real-beg. --- lisp/thingatpt.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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))))