From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: James Cloos <cloos@jhcloos.com>
Cc: 24081@debbugs.gnu.org, Eli Zaretskii <eliz@gnu.org>
Subject: bug#24081: 25.0.95; fill-paragraph in message mode no longer honours line prefixes
Date: Tue, 17 Dec 2024 12:05:32 -0500 [thread overview]
Message-ID: <jwvfrmmw9gr.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <m3wpk7iuj4.fsf@carbon.jhcloos.org> (James Cloos's message of "Wed, 27 Jul 2016 00:17:51 -0400")
[ Yes, this is a very old bug. 🙁 ]
> JC>> Since I switched from using gnus git to master's internal gnus, I've
> JC>> noticed that fill-paragraph in message mode no longer treats the line
> JC>> prefixes as a fill-prefix.
>
> JC>> Due to the other bug I had to downgrade from master to 25.0.95. It,
> JC>> too, has this bug.
> EZ> Please show a recipe to reproduce this.
> Hmm. Interesting.
> It does honour prefixes which match the re /^>+ +$/
Yet it uses `mail-citation-prefix-regexp` which is set by default to:
"\\([ \t]*\\(\\w\\|[_.]\\)+>+\\|[ \t]*[>|]\\)+"
and that "should" match prefixes like the `> JC>>` above (it's even
mentioned in the docstring).
And indeed refilling
>FOO> sdkfjha lkhakd hasdjfh kaf akhf kajdf aksdjfhajk df asdjkfh akdfh
>FOO> kadfh akdjfh adkfh akdf hakdfh adjkfh k adfh akdjfh kafh kajfh kajfh kadjfh kadjfh kadjfh akjfh akjfh kadfh kajfh kajfh
>FOO> kajdfh kadjfh
>FOO> akdjfh kadjfh
works fine for me. OTOH refilling
FOO> sdkfjha lkhakd hasdjfh kaf akhf kajdf aksdjfhajk df asdjkfh akdfh
FOO> kadfh akdjfh adkfh akdf hakdfh adjkfh k adfh akdjfh kafh kajfh kajfh kadjfh kadjfh kadjfh akjfh akjfh kadfh kajfh kajfh
FOO> kajdfh kadjfh
FOO> akdjfh kadjfh
doesn't (the `FOO>`s are treated as part of the text to be filled rather
than as a prefix, so some of them end up in the middle of the text).
My impression is that the problem is that the first char on each line is
given a syntax-table property of "start comment" which prevents the
`\w` in the regexp from matching the `F`.
The patch below fixes it for me.
Can you check if it also fixes your use cases?
Note: There have been some recentish changes/fixes to the regexp handling of
`[:word:]` w.r.t syntax-table text properties, so it's possible that the
patch doesn't work in Emacs-29, but it should work in Emacs≥30 )I tested
it in Emacs-31).
Stefan
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index a720df51d14..acb6a38436e 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -258,7 +258,9 @@ mail-citation-header
;;;###autoload
(defcustom mail-citation-prefix-regexp
- (purecopy "\\([ \t]*\\(\\w\\|[_.]\\)+>+\\|[ \t]*[>|]\\)+")
+ ;; Use [[:word:]] rather than \w so we don't get tripped up if one
+ ;; of those chars has a weird `syntax-table' text property.
+ (purecopy "\\([ \t]*\\([[:word:]]\\|[_.]\\)+>+\\|[ \t]*[>|]\\)+")
"Regular expression to match a citation prefix plus whitespace.
It should match whatever sort of citation prefixes you want to handle,
with whitespace before and after; it should also match just whitespace.
next prev parent reply other threads:[~2024-12-17 17:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-26 21:00 bug#24081: 25.0.95; fill-paragraph in message mode no longer honours line prefixes James Cloos
2016-07-27 2:41 ` Eli Zaretskii
2016-07-27 4:17 ` James Cloos
2024-12-17 17:05 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-12-17 20:38 ` James Cloos
2024-12-17 22:08 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
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=jwvfrmmw9gr.fsf-monnier+emacs@gnu.org \
--to=bug-gnu-emacs@gnu.org \
--cc=24081@debbugs.gnu.org \
--cc=cloos@jhcloos.com \
--cc=eliz@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).