Simplify erc--fill-module-docstring
* lisp/erc/erc-common.el (erc--fill-module-docstring): Don't run hooks for major mode when filling. Prefer `lisp-data-mode' to `emacs-lisp-mode'.
This commit is contained in:
parent
ef4a3c2a6d
commit
c1e86203b0
1 changed files with 9 additions and 7 deletions
|
@ -270,18 +270,20 @@ instead of a `set' state, which precludes any actual saving."
|
|||
" above."))))))
|
||||
|
||||
(defun erc--fill-module-docstring (&rest strings)
|
||||
"Concatenate STRINGS and fill as a doc string."
|
||||
;; Perhaps it's better to mimic `internal--format-docstring-line'
|
||||
;; and use basic filling instead of applying a major mode?
|
||||
(with-temp-buffer
|
||||
(emacs-lisp-mode)
|
||||
(insert "(defun foo ()\n"
|
||||
(format "%S" (apply #'concat strings))
|
||||
"\n(ignore))")
|
||||
(delay-mode-hooks
|
||||
(if (fboundp 'lisp-data-mode) (lisp-data-mode) (emacs-lisp-mode)))
|
||||
(insert (format "%S" (apply #'concat strings)))
|
||||
(goto-char (point-min))
|
||||
(forward-line 2)
|
||||
(let ((emacs-lisp-docstring-fill-column 65)
|
||||
(forward-line)
|
||||
(let ((fill-column 65)
|
||||
(sentence-end-double-space t))
|
||||
(fill-paragraph))
|
||||
(goto-char (point-min))
|
||||
(nth 3 (read (current-buffer)))))
|
||||
(read (current-buffer))))
|
||||
|
||||
(defmacro erc--find-feature (name alias)
|
||||
`(pcase (erc--find-group ',name ,(and alias (list 'quote alias)))
|
||||
|
|
Loading…
Add table
Reference in a new issue