emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c1e86203b00 2/4: Simplify erc--fill-module-docstring


From: F. Jason Park
Subject: master c1e86203b00 2/4: Simplify erc--fill-module-docstring
Date: Sun, 17 Sep 2023 19:24:04 -0400 (EDT)

branch: master
commit c1e86203b00182a478c168e3a0a0adab85ae6d47
Author: F. Jason Park <jp@neverwas.me>
Commit: F. Jason Park <jp@neverwas.me>

    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'.
---
 lisp/erc/erc-common.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lisp/erc/erc-common.el b/lisp/erc/erc-common.el
index 85971797c2f..67c2cf8535b 100644
--- a/lisp/erc/erc-common.el
+++ b/lisp/erc/erc-common.el
@@ -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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]