[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 57e2ca5: Don't get fooled by open parens in column
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master 57e2ca5: Don't get fooled by open parens in column 0 within strings |
Date: |
Wed, 13 Dec 2017 14:13:17 -0500 (EST) |
branch: master
commit 57e2ca5c504fda014ba1971e850a26ef001a7bfd
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
Don't get fooled by open parens in column 0 within strings
* lisp/emacs-lisp/lisp.el (beginning-of-defun-raw):
Skip defun-prompt-regexp and open-paren-in-0 within strings and comments.
---
lisp/emacs-lisp/lisp.el | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 6952ef4..09aa510 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -339,12 +339,18 @@ is called as a function to find the defun's beginning."
((or defun-prompt-regexp open-paren-in-column-0-is-defun-start)
(and (< arg 0) (not (eobp)) (forward-char 1))
- (and (re-search-backward (if defun-prompt-regexp
- (concat (if
open-paren-in-column-0-is-defun-start
- "^\\s(\\|" "")
- "\\(?:" defun-prompt-regexp "\\)\\s(")
- "^\\s(")
- nil 'move arg)
+ (and (let (found)
+ (while
+ (and (setq found
+ (re-search-backward
+ (if defun-prompt-regexp
+ (concat (if open-paren-in-column-0-is-defun-start
+ "^\\s(\\|" "")
+ "\\(?:" defun-prompt-regexp "\\)\\s(")
+ "^\\s(")
+ nil 'move arg))
+ (nth 8 (syntax-ppss))))
+ found)
(progn (goto-char (1- (match-end 0)))
t)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 57e2ca5: Don't get fooled by open parens in column 0 within strings,
Stefan Monnier <=