unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juanma Barranquero <lekktu@gmail.com>
To: "Basil L. Contovounesios" <contovob@tcd.ie>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: Filling the docstring generated by define-minor-mode
Date: Mon, 10 Jun 2019 15:35:12 +0200	[thread overview]
Message-ID: <CAAeL0ST8c+yYdSJe2z1rQaKD4OcxZ7_RbhHR71Ezp3sb2GOahw@mail.gmail.com> (raw)
In-Reply-To: <878su9bv0z.fsf@tcd.ie>

On Mon, Jun 10, 2019 at 12:21 PM Basil L. Contovounesios
<contovob@tcd.ie> wrote:

> FWIW, I find this useful.

Thanks.

> My only questions are a) whether we'd want to
> introduce optional docstring filling more systematically, e.g. during
> *Help* buffer generation,

I don't think so. Usually, docstrings are hand-crafted to be readable,
and random-filling them isn't going to be an improvement per se. In
this specific case, the docstring is mostly auto-generated, with
variable substitution, so filling *is* an improvement. But not
generally.

> and b) whether the fill-column can be
> controlled by emacs-lisp-docstring-fill-column or some new user option
> along the same lines.

IMO, a new option would be unnecessary clutter, but using
emacs-lisp-docstring-fill-column is a good idea. Thanks.


diff --git i/lisp/emacs-lisp/easy-mmode.el w/lisp/emacs-lisp/easy-mmode.el
index be531aab84..2cfbe726e5 100644
--- i/lisp/emacs-lisp/easy-mmode.el
+++ w/lisp/emacs-lisp/easy-mmode.el
@@ -96,9 +96,16 @@ easy-mmode--mode-docstring
     (if (string-match-p "\\bARG\\b" doc)
         doc
-      (let ((argdoc (format easy-mmode--arg-docstring
+      (let ((fill-prefix nil)
+            (fill-column (if (integerp emacs-lisp-docstring-fill-column)
+                             emacs-lisp-docstring-fill-column
+                           65)) ; default value of e-l-d-f-c
+            (argdoc (format easy-mmode--arg-docstring
                             mode-pretty-name)))
-        (replace-regexp-in-string "\\(\n\n\\|\\'\\)\\(.\\|\n\\)*\\'"
-                                  (concat argdoc "\\1")
-                                  doc nil nil 1)))))
+        (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))))))

 ;;;###autoload



  reply	other threads:[~2019-06-10 13:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-10  4:55 Filling the docstring generated by define-minor-mode Juanma Barranquero
2019-06-10 10:21 ` Basil L. Contovounesios
2019-06-10 13:35   ` Juanma Barranquero [this message]
2019-06-10 17:37 ` Stefan Monnier
2019-06-10 18:08   ` Juanma Barranquero
2019-06-10 18:24     ` Drew Adams
2019-06-10 19:26       ` Juanma Barranquero
2019-06-10 20:15         ` Drew Adams
2019-06-10 20:25           ` Juanma Barranquero
2019-06-10 18:33     ` Stefan Monnier
2019-06-10 19:15       ` Juanma Barranquero
2019-06-11  7:14         ` Stefan Monnier
2019-06-11 10:37           ` Juanma Barranquero
2019-06-11 18:19             ` Stefan Monnier
2019-10-01 20:23               ` Juanma Barranquero
2019-10-01 21:04                 ` Lars Ingebrigtsen
2019-10-01 21:51                 ` Stefan Monnier
2019-10-03 23:30                   ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAeL0ST8c+yYdSJe2z1rQaKD4OcxZ7_RbhHR71Ezp3sb2GOahw@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=contovob@tcd.ie \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).