summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2018-01-06 11:48:32 +0000
committerAlan Mackenzie <acm@muc.de>2018-01-06 11:48:32 +0000
commitb8d74c4578a6a4f1cabe993209358eb84883b869 (patch)
tree17acb67bd2ef9925b164e9a934cd7e697e746e01 /lisp/emacs-lisp/lisp.el
parenta377c652b55db4f118076fec2cdbd65e0d61e31a (diff)
downloademacs-b8d74c4578a6a4f1cabe993209358eb84883b869.tar.gz
emacs-b8d74c4578a6a4f1cabe993209358eb84883b869.tar.bz2
emacs-b8d74c4578a6a4f1cabe993209358eb84883b869.zip
Fix mark-defun when there's no spaces between successive defuns.
The problem was a parse-partial-sexp call which tried to use the STOPBEFORE argument to detect non-syntactic WS. This fails on a "}", which does not begin a sexp. * lisp/emacs-lisp/lisp.h (beginning-of-defun--in-emptyish-line-p): Enhance to handle BOL being in a string. (beginning-of-defun-comments): Call the above function in place of the call to parse-partial-sexp.
Diffstat (limited to 'lisp/emacs-lisp/lisp.el')
-rw-r--r--lisp/emacs-lisp/lisp.el18
1 files changed, 8 insertions, 10 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 1777779b75c..68d50e6d0b2 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -405,12 +405,13 @@ whitespace."
;; See https://lists.gnu.org/r/help-gnu-emacs/2016-08/msg00141.html
(save-excursion
(forward-line 0)
- (< (line-end-position)
- (let ((ppss (syntax-ppss)))
- (when (nth 4 ppss)
- (goto-char (nth 8 ppss)))
- (forward-comment (point-max))
- (point)))))
+ (let ((ppss (syntax-ppss)))
+ (and (null (nth 3 ppss))
+ (< (line-end-position)
+ (progn (when (nth 4 ppss)
+ (goto-char (nth 8 ppss)))
+ (forward-comment (point-max))
+ (point)))))))
(defun beginning-of-defun-comments (&optional arg)
"Move to the beginning of ARGth defun, including comments."
@@ -428,10 +429,7 @@ whitespace."
(progn (skip-syntax-backward
"-" (line-beginning-position))
(not (bolp))) ; Check for blank line.
- (progn (parse-partial-sexp
- (line-beginning-position) (line-end-position)
- nil t (syntax-ppss (line-beginning-position)))
- (eolp))))) ; Check for non-comment text.
+ (beginning-of-defun--in-emptyish-line-p)))) ; Check for non-comment text.
(forward-line (if first-line-p 0 1))))
(defvar end-of-defun-function