# HG changeset patch # User Richard M. Stallman # Date 867129909 0 # Node ID b2bc7438b6b08c160faf6350499dd8bce5de55ec # Parent 8208c168c5cc888f3414cec7e313d612f5653f36 (beginning-of-sexp): New function. (bounds-of-thing-at-point): Fix typo in computing real-beg. diff -r 8208c168c5cc -r b2bc7438b6b0 lisp/thingatpt.el --- 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))))