mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Improve filling of Emacs Lisp doc strings
* lisp/emacs-lisp/lisp-mode.el (lisp-fill-paragraph): When filling a Lisp string, try to avoid filling bits that follow it (bug#28937).
This commit is contained in:
parent
e1d54bb638
commit
9bf367e184
1 changed files with 18 additions and 1 deletions
|
|
@ -1373,7 +1373,24 @@ and initial semicolons."
|
||||||
(derived-mode-p 'emacs-lisp-mode))
|
(derived-mode-p 'emacs-lisp-mode))
|
||||||
emacs-lisp-docstring-fill-column
|
emacs-lisp-docstring-fill-column
|
||||||
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.
|
;; Never return nil.
|
||||||
t))
|
t))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue