[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master a397fa0: Improve docstrings auto-generated by `define-minor-m
From: |
Stefan Monnier |
Subject: |
Re: master a397fa0: Improve docstrings auto-generated by `define-minor-mode' |
Date: |
Fri, 04 Oct 2019 09:01:42 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
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