From: "João Távora" <joaotavora@gmail.com>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: emacs-devel@gnu.org
Subject: Re: master 78fc49407b8 1/3: Improve filling of ChangeLog entries
Date: Tue, 30 Jan 2024 22:07:18 +0000 [thread overview]
Message-ID: <8734ue327d.fsf@gmail.com> (raw)
In-Reply-To: <540cc339-b7d4-4c1a-b084-c7f739ad4947@gutov.dev> (Dmitry Gutov's message of "Sun, 28 Jan 2024 15:22:59 +0200")
Dmitry Gutov <dmitry@gutov.dev> writes:
> On 28/01/2024 10:58, Po Lu via Mailing list for Emacs changes wrote:
>> (log-edit-fill-entry): Abandon pcase and cl-lib.
>
> That seems like a gratuitous change.
Seems like this much simpler patch would have done the job. If cl-loop
is so toxic, even macroexpanding these trivial ones away yields much
less code and much simpler code. Tests are a welcome addition though.
João
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 72867f14d2f..0ce21c5c473 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -578,15 +578,17 @@ log-edit--insert-filled-defuns
(unless (or (memq (char-before) '(?\n ?\s))
(> (current-column) fill-column))
(insert " "))
- (cl-loop for first-fun = t then nil
- for def in func-names do
- (when (> (+ (current-column) (string-width def)) fill-column)
- (unless first-fun
- (insert ")"))
- (insert "\n"))
- (insert (if (memq (char-before) '(?\n ?\s))
- "(" ", ")
- def))
+ (cl-loop with first-fun = t
+ for (def . more) on func-names do
+ (when (> (+ (current-column) (string-width def)
+ (if first-fun 1 2)
+ (if (null more) 1 0))
+ fill-column)
+ (unless first-fun (insert ")"))
+ (unless (eq (char-before) ?\n) (insert "\n"))
+ (setq first-fun t))
+ (insert (if first-fun "(" ", ") def)
+ (setq first-fun nil))
(insert "):")))
(defun log-edit-fill-entry (&optional justify)
@@ -611,10 +613,11 @@ log-edit-fill-entry
(copy-marker (match-end 1)))
;; Fill prose between log entries.
do (let ((fill-indent-according-to-mode t)
- (end (if defuns-beg (match-beginning 0) end))
- (beg (progn (goto-char beg) (line-beginning-position))))
+ (end (if defuns-beg (match-beginning 0) end)))
+ (goto-char beg)
+ (skip-chars-backward "^ \t\n")
(when (<= (line-end-position) end)
- (fill-region beg end justify)))
+ (fill-region (point) end justify)))
while defuns-beg
for defuns = (progn (goto-char defuns-beg)
(change-log-read-defuns end))
next prev parent reply other threads:[~2024-01-30 22:07 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <170643232559.30479.16631610453249222615@vcs2.savannah.gnu.org>
[not found] ` <20240128085846.187A2C1DAE4@vcs2.savannah.gnu.org>
2024-01-28 13:22 ` master 78fc49407b8 1/3: Improve filling of ChangeLog entries Dmitry Gutov
2024-01-28 13:37 ` Po Lu
2024-01-30 22:07 ` João Távora [this message]
2024-01-31 6:43 ` Po Lu
2024-01-31 10:28 ` João Távora
2024-01-31 11:19 ` Po Lu
2024-01-31 13:22 ` João Távora
2024-01-31 14:01 ` Po Lu
2024-01-31 14:30 ` João Távora
2024-01-31 15:15 ` Dmitry Gutov
2024-01-31 15:32 ` Alan Mackenzie
2024-01-31 16:46 ` João Távora
2024-01-31 18:29 ` Alan Mackenzie
2024-01-31 17:05 ` Dmitry Gutov
2024-01-31 18:45 ` Alan Mackenzie
2024-01-31 20:39 ` Dmitry Gutov
2024-01-29 20:13 ` Stefan Kangas
2024-01-30 1:26 ` Po Lu
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8734ue327d.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=dmitry@gutov.dev \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.