diff options
| author | Noam Postavsky | 2017-05-09 09:38:49 +0200 |
|---|---|---|
| committer | Marcin Borkowski | 2017-05-12 11:40:57 +0200 |
| commit | aa779b0f15faa114fa5e3f59b17e628b1a837af8 (patch) | |
| tree | 6fdfebea817af3e55e856e33f3e0b61d9ce32786 | |
| parent | cb8fcbc3cbd8f6cf95bb858b72188d752672cf6b (diff) | |
| download | emacs-fix/bug-21072.tar.gz emacs-fix/bug-21072.zip | |
Modify `beginning-of-defun-comments'fix/bug-21072
* lisp/emacs-lisp/lisp.el (beginning-of-defun-comments): Try not to stop
in the middle of a multiline comment.
| -rw-r--r-- | lisp/emacs-lisp/lisp.el | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index 71c27d08a2f..0c1fe42fedb 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el | |||
| @@ -417,14 +417,22 @@ whitespace." | |||
| 417 | (interactive "^p") | 417 | (interactive "^p") |
| 418 | (unless arg (setq arg 1)) | 418 | (unless arg (setq arg 1)) |
| 419 | (beginning-of-defun arg) | 419 | (beginning-of-defun arg) |
| 420 | (let (nbobp) | 420 | (let (first-line-p) |
| 421 | (while (progn | 421 | (while (let ((ppss (progn (setq first-line-p (= (forward-line -1) -1)) |
| 422 | (setq nbobp (zerop (forward-line -1))) | 422 | (syntax-ppss (line-end-position))))) |
| 423 | (and (not (looking-at "^\\s-*$")) | 423 | (while (and (nth 4 ppss) ; If eol is in a line-spanning comment, |
| 424 | (beginning-of-defun--in-emptyish-line-p) | 424 | (< (nth 8 ppss) (line-beginning-position))) |
| 425 | nbobp))) | 425 | (goto-char (nth 8 ppss)) ; skip to comment start. |
| 426 | (when nbobp | 426 | (setq ppss (syntax-ppss (line-end-position)))) |
| 427 | (forward-line 1)))) | 427 | (and (not first-line-p) |
| 428 | (progn (skip-syntax-backward | ||
| 429 | "-" (line-beginning-position)) | ||
| 430 | (not (bolp))) ; Check for blank line. | ||
| 431 | (progn (parse-partial-sexp | ||
| 432 | (line-beginning-position) (line-end-position) | ||
| 433 | nil t (syntax-ppss (line-beginning-position))) | ||
| 434 | (eolp))))) ; Check for non-comment text. | ||
| 435 | (forward-line (if first-line-p 0 1)))) | ||
| 428 | 436 | ||
| 429 | (defvar end-of-defun-function | 437 | (defvar end-of-defun-function |
| 430 | (lambda () (forward-sexp 1)) | 438 | (lambda () (forward-sexp 1)) |