[Top][All Lists]

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

Re: master a397fa0: Improve docstrings auto-generated by `define-minor-m

From: Juanma Barranquero
Subject: Re: master a397fa0: Improve docstrings auto-generated by `define-minor-mode'
Date: Fri, 4 Oct 2019 15:34:39 +0200

On Fri, Oct 4, 2019 at 3:01 PM Stefan Monnier <address@hidden> wrote:

> > I've riveted the change.

Or even "reverted"... Lesson for today: do not write messages while skipping bedtime.

> I just fixed the `generate-new-buffer` dependency.


> But I have a question: your patch re-fills the whole docstring (after
> adding the arg-docstring chunk to it).  Was that really the intention?
> I thought this was considered too risky and we wanted to only refill the
> arg-docstring paragraph (i.e. before inserting it into the rest of the
> docstring).

Yes, my mistake. (Another one, I mean).

This was intended:

diff --git i/lisp/emacs-lisp/easy-mmode.el w/lisp/emacs-lisp/easy-mmode.el
index 5e7b29eddf..3224d5b985 100644
--- i/lisp/emacs-lisp/easy-mmode.el
+++ w/lisp/emacs-lisp/easy-mmode.el
@@ -96,8 +96,16 @@ easy-mmode--mode-docstring
     (if (string-match-p "\\bARG\\b" doc)
-      (let ((argdoc (format easy-mmode--arg-docstring
-                            mode-pretty-name)))
+      (let* ((fill-prefix nil)
+             (docs-fc (bound-and-true-p emacs-lisp-docstring-fill-column))
+             (fill-column (if (integerp docs-fc) docs-fc 65))
+             (argdoc (format easy-mmode--arg-docstring mode-pretty-name))
+             (filled (if (fboundp 'fill-region)
+                         (with-temp-buffer
+                           (insert argdoc)
+                           (fill-region (point-min) (point-max) 'left t)
+                           (buffer-string))
+                       argdoc)))                    
         (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'"
-                                  (concat argdoc "\\1")
+                                  (concat filled "\\1")
                                   doc nil nil 1)))))

reply via email to

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