[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] fix/bug-21072 aa779b0 5/5: Modify `beginning-of-defun-comm
From: |
Marcin Borkowski |
Subject: |
[Emacs-diffs] fix/bug-21072 aa779b0 5/5: Modify `beginning-of-defun-comments' |
Date: |
Fri, 12 May 2017 05:40:50 -0400 (EDT) |
branch: fix/bug-21072
commit aa779b0f15faa114fa5e3f59b17e628b1a837af8
Author: Noam Postavsky <address@hidden>
Commit: Marcin Borkowski <address@hidden>
Modify `beginning-of-defun-comments'
* lisp/emacs-lisp/lisp.el (beginning-of-defun-comments): Try not to stop
in the middle of a multiline comment.
---
lisp/emacs-lisp/lisp.el | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 71c27d0..0c1fe42 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -417,14 +417,22 @@ whitespace."
(interactive "^p")
(unless arg (setq arg 1))
(beginning-of-defun arg)
- (let (nbobp)
- (while (progn
- (setq nbobp (zerop (forward-line -1)))
- (and (not (looking-at "^\\s-*$"))
- (beginning-of-defun--in-emptyish-line-p)
- nbobp)))
- (when nbobp
- (forward-line 1))))
+ (let (first-line-p)
+ (while (let ((ppss (progn (setq first-line-p (= (forward-line -1) -1))
+ (syntax-ppss (line-end-position)))))
+ (while (and (nth 4 ppss) ; If eol is in a line-spanning comment,
+ (< (nth 8 ppss) (line-beginning-position)))
+ (goto-char (nth 8 ppss)) ; skip to comment start.
+ (setq ppss (syntax-ppss (line-end-position))))
+ (and (not first-line-p)
+ (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.
+ (forward-line (if first-line-p 0 1))))
(defvar end-of-defun-function
(lambda () (forward-sexp 1))
- [Emacs-diffs] branch fix/bug-21072 created (now aa779b0), Marcin Borkowski, 2017/05/12
- [Emacs-diffs] fix/bug-21072 0397f85 3/5: * lisp/emacs-lisp/lisp.el (mark-defun): Simplify moving the point., Marcin Borkowski, 2017/05/12
- [Emacs-diffs] fix/bug-21072 aa779b0 5/5: Modify `beginning-of-defun-comments',
Marcin Borkowski <=
- [Emacs-diffs] fix/bug-21072 6d58dda 1/5: Add elisp-tests-with-temp-buffer, a new testing macro, Marcin Borkowski, 2017/05/12
- [Emacs-diffs] fix/bug-21072 cb8fcbc 4/5: Fix elisp-tests-with-temp-buffer compilation, Marcin Borkowski, 2017/05/12
- [Emacs-diffs] fix/bug-21072 22fc917 2/5: Fix Bug#21072 and rework `mark-defun', Marcin Borkowski, 2017/05/12