unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master a397fa0: Improve docstrings auto-generated by `define-minor-mode'
       [not found] ` <20191003232959.3CC4520BB4@vcs0.savannah.gnu.org>
@ 2019-10-04  9:50   ` Robert Pluim
  2019-10-04 10:11     ` Juanma Barranquero
  2019-10-04 11:49   ` Michael Albinus
  1 sibling, 1 reply; 6+ messages in thread
From: Robert Pluim @ 2019-10-04  9:50 UTC (permalink / raw)
  To: emacs-devel; +Cc: Juanma Barranquero

>>>>> On Thu,  3 Oct 2019 19:29:58 -0400 (EDT), lekktu@gmail.com (Juanma Barranquero) said:

    Juanma> branch: master
    Juanma> commit a397fa06d18d6ae37a3a1288f269e1ae9eb3b569
    Juanma> Author: Juanma Barranquero <lekktu@gmail.com>
    Juanma> Commit: Juanma Barranquero <lekktu@gmail.com>

    Juanma>     Improve docstrings auto-generated by `define-minor-mode'
    
This causes 'make bootstrap' to fail for me, although I have no clue
why:

./temacs --batch  -l loadup --temacs=pbootstrap
Loading loadup.el (source)...
dump mode: pbootstrap
Using load-path (/home/rpluim/repos/emacs-master/lisp /home/rpluim/repos/emacs-master/lisp/emacs-lisp /home/rpluim/repos/emacs-master/lisp/progmodes /home/rpluim/repos/emacs-master/lisp/language /home/rpluim/repos/emacs-master/lisp/international /home/rpluim/repos/emacs-master/lisp/textmodes /home/rpluim/repos/emacs-master/lisp/vc)
Loading emacs-lisp/byte-run (source)...
Loading emacs-lisp/backquote (source)...
Loading subr (source)...
Loading version (source)...
Loading widget (source)...
Loading custom (source)...
Loading emacs-lisp/map-ynp (source)...
Loading international/mule (source)...
Loading international/mule-conf (source)...
Loading env (source)...
Loading format (source)...
Loading bindings (source)...
Loading window (source)...
Loading /home/rpluim/repos/emacs-master/lisp/files.el (source)...
Symbol’s function definition is void: generate-new-buffer
make[2]: *** [Makefile:817: bootstrap-emacs.pdmp] Error 255
make[2]: Leaving directory '/home/rpluim/repos/emacs-master/src'
make[1]: *** [Makefile:424: src] Error 2
make[1]: Leaving directory '/home/rpluim/repos/emacs-master'
make: *** [Makefile:1119: bootstrap] Error 2



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master a397fa0: Improve docstrings auto-generated by `define-minor-mode'
  2019-10-04  9:50   ` master a397fa0: Improve docstrings auto-generated by `define-minor-mode' Robert Pluim
@ 2019-10-04 10:11     ` Juanma Barranquero
  2019-10-04 12:07       ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2019-10-04 10:11 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

On Fri, Oct 4, 2019 at 11:50 AM Robert Pluim <rpluim@gmail.com> wrote:

> This causes 'make bootstrap' to fail for me, although I have no clue
> why:

Yes, sorry. I see it too. I'll take a look asap.

[-- Attachment #2: Type: text/html, Size: 336 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master a397fa0: Improve docstrings auto-generated by `define-minor-mode'
       [not found] ` <20191003232959.3CC4520BB4@vcs0.savannah.gnu.org>
  2019-10-04  9:50   ` master a397fa0: Improve docstrings auto-generated by `define-minor-mode' Robert Pluim
@ 2019-10-04 11:49   ` Michael Albinus
  1 sibling, 0 replies; 6+ messages in thread
From: Michael Albinus @ 2019-10-04 11:49 UTC (permalink / raw)
  To: emacs-devel; +Cc: Juanma Barranquero

lekktu@gmail.com (Juanma Barranquero) writes:

> branch: master
> commit a397fa06d18d6ae37a3a1288f269e1ae9eb3b569
> Author: Juanma Barranquero <lekktu@gmail.com>
> Commit: Juanma Barranquero <lekktu@gmail.com>
>
>     Improve docstrings auto-generated by `define-minor-mode'
>
>     * lisp/emacs-lisp/easy-mmode.el (easy-mmode--mode-docstring):
>     When using `easy-mmode--arg-docstring' to auto-generate a
>     docstring, refill it up to `emacs-lisp-docstring-fill-column'.
> ---
>  lisp/emacs-lisp/easy-mmode.el | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
> index 5e7b29e..6d5b514 100644
> --- a/lisp/emacs-lisp/easy-mmode.el
> +++ b/lisp/emacs-lisp/easy-mmode.el
> @@ -95,11 +95,17 @@ if ARG is `toggle'; disable the mode otherwise.")
>  \\{%s}" mode-pretty-name keymap-sym))))
>      (if (string-match-p "\\bARG\\b" doc)
>          doc
> -      (let ((argdoc (format easy-mmode--arg-docstring
> -                            mode-pretty-name)))
> -        (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'"
> -                                  (concat argdoc "\\1")
> -                                  doc nil nil 1)))))
> +      (let* ((fill-prefix nil)
> +             (docstring-fc (bound-and-true-p emacs-lisp-docstring-fill-column))
> +             (fill-column (if (integerp docstring-fc) docstring-fc 65))
> +             (argdoc (format easy-mmode--arg-docstring
> +                             mode-pretty-name)))
> +        (with-temp-buffer
> +          (insert (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'"
> +                                            (concat argdoc "\\1")
> +                                            doc nil nil 1))
> +          (fill-region (point-min) (point-max) 'left t)
> +          (buffer-string))))))

This has broken the build on emba. See <https://emba.gnu.org/emacs/emacs/-/jobs/3602/raw>.

Best regards, Michael.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master a397fa0: Improve docstrings auto-generated by `define-minor-mode'
  2019-10-04 10:11     ` Juanma Barranquero
@ 2019-10-04 12:07       ` Juanma Barranquero
  2019-10-04 13:01         ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Juanma Barranquero @ 2019-10-04 12:07 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Emacs developers

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

I've riveted the change.

There's a circular dependency between files and easy-mmode, and the code
also uses fill-region which is loaded later.

I'd be grateful if someone with more bootstrap chops than me could
investigate it further. Even if the change cannot be used for the minor
modes defined when loading up, it's still useful for subsequent uses of
define-minor-mode.

[-- Attachment #2: Type: text/html, Size: 478 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: master a397fa0: Improve docstrings auto-generated by `define-minor-mode'
  2019-10-04 12:07       ` Juanma Barranquero
@ 2019-10-04 13:01         ` Stefan Monnier
  2019-10-04 13:34           ` Juanma Barranquero
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2019-10-04 13:01 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: Robert Pluim, Emacs developers

Hi Juanma,

> I've riveted the change.

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

> There's a circular dependency between files and easy-mmode, and the code
> also uses fill-region which is loaded later.

This can be avoided with a simple (when (fboundp 'fill-region) ...), at
the cost of not filling those docstrings generated "too early",
e.g. with the patch below.

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).


        Stefan


diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index 6d5b5141aa..1125000e5c 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -84,8 +84,8 @@ easy-mmode-pretty-mode-name
 (defconst easy-mmode--arg-docstring
   "
 
-If called interactively, enable %s if ARG is positive, and
-disable it if ARG is zero or negative.  If called from Lisp,
+If called interactively, enable %s if ARG is positive,
+and disable it if ARG is zero or negative.  If called from Lisp,
 also enable the mode if ARG is omitted or nil, and toggle it
 if ARG is `toggle'; disable the mode otherwise.")
 
@@ -104,7 +104,8 @@ easy-mmode--mode-docstring
           (insert (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'"
                                             (concat argdoc "\\1")
                                             doc nil nil 1))
-          (fill-region (point-min) (point-max) 'left t)
+          (when (fboundp 'fill-region)
+            (fill-region (point-min) (point-max) 'left t))
           (buffer-string))))))
 
 ;;;###autoload




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: master a397fa0: Improve docstrings auto-generated by `define-minor-mode'
  2019-10-04 13:01         ` Stefan Monnier
@ 2019-10-04 13:34           ` Juanma Barranquero
  0 siblings, 0 replies; 6+ messages in thread
From: Juanma Barranquero @ 2019-10-04 13:34 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Robert Pluim, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 1792 bytes --]

On Fri, Oct 4, 2019 at 3:01 PM Stefan Monnier <monnier@iro.umontreal.ca>
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.

Thanks.

> 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)
         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)))))

[-- Attachment #2: Type: text/html, Size: 2430 bytes --]

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-04 13:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20191003232958.28978.83739@vcs0.savannah.gnu.org>
     [not found] ` <20191003232959.3CC4520BB4@vcs0.savannah.gnu.org>
2019-10-04  9:50   ` master a397fa0: Improve docstrings auto-generated by `define-minor-mode' Robert Pluim
2019-10-04 10:11     ` Juanma Barranquero
2019-10-04 12:07       ` Juanma Barranquero
2019-10-04 13:01         ` Stefan Monnier
2019-10-04 13:34           ` Juanma Barranquero
2019-10-04 11:49   ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).