diff options
author | Eli Zaretskii <eliz@gnu.org> | 2021-02-04 18:02:27 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2021-02-04 18:02:27 +0200 |
commit | a304b22bc9f1396cd6958b0a6fc6092437e36d96 (patch) | |
tree | 51ede22e8e6ea764bf124107be844d44f62e9520 | |
parent | 914cb7a1d666a87994e0492635f262396a839d4c (diff) | |
parent | 9bf367e18486b8f89ff1e0a4c4f4b5b4da4d9a75 (diff) | |
download | emacs-a304b22bc9f1396cd6958b0a6fc6092437e36d96.tar.gz |
Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
-rw-r--r-- | lisp/emacs-lisp/lisp-mode.el | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 5dda3a8f8e9..f5ce107185a 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -1373,7 +1373,24 @@ and initial semicolons." (derived-mode-p 'emacs-lisp-mode)) emacs-lisp-docstring-fill-column fill-column))) - (fill-paragraph justify)) + (save-restriction + (save-excursion + (let ((ppss (syntax-ppss))) + ;; If we're in a string, then narrow (roughly) to that + ;; string before filling. This avoids filling Lisp + ;; statements that follow the string. + (when (ppss-string-terminator ppss) + (goto-char (ppss-comment-or-string-start ppss)) + (beginning-of-line) + ;; The string may be unterminated -- in that case, don't + ;; narrow. + (when (ignore-errors + (progn + (forward-sexp 1) + t)) + (narrow-to-region (ppss-comment-or-string-start ppss) + (point)))) + (fill-paragraph justify))))) ;; Never return nil. t)) |