GNU bug report logs - #56384
29.0.50; backward-word doesn't move far enough in message-mode

Previous Next

Package: emacs;

Reported by: Sean Whitton <spwhitton <at> spwhitton.name>

Date: Mon, 4 Jul 2022 16:05:02 UTC

Severity: wishlist

Found in version 29.0.50

To reply to this bug, email your comments to 56384 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#56384; Package emacs. (Mon, 04 Jul 2022 16:05:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sean Whitton <spwhitton <at> spwhitton.name>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 04 Jul 2022 16:05:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; backward-word doesn't move far enough in message-mode
Date: Mon, 04 Jul 2022 09:04:32 -0700
Hello,

1. emacs -q
2. C-x m
3. foo>
4. C-b
5. M-b

Point does not move to the beginning of the line, as one would expect.

If a punctuation character other than '>' is used, it does to go bol.

-- 
Sean Whitton




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Mon, 04 Jul 2022 16:28:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56384; Package emacs. (Tue, 05 Jul 2022 11:30:02 GMT) Full text and rfc822 format available.

Message #10 received at 56384 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 56384 <at> debbugs.gnu.org
Subject: Re: bug#56384: 29.0.50; backward-word doesn't move far enough in
 message-mode
Date: Tue, 05 Jul 2022 13:29:44 +0200
Sean Whitton <spwhitton <at> spwhitton.name> writes:

> 1. emacs -q
> 2. C-x m
> 3. foo>
> 4. C-b
> 5. M-b
>
> Point does not move to the beginning of the line, as one would expect.
>
> If a punctuation character other than '>' is used, it does to go bol.

How strange -- it goes to the second character on the line?  Anybody
know what could be causing this?

I think message-mode is interpreting that foo> as a cited text, but I
don't quite see why that'd make point go to the second column instead of
the first.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56384; Package emacs. (Tue, 05 Jul 2022 11:45:02 GMT) Full text and rfc822 format available.

Message #13 received at 56384 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 56384 <at> debbugs.gnu.org, Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#56384: 29.0.50; backward-word doesn't move far enough in
 message-mode
Date: Tue, 05 Jul 2022 13:43:52 +0200
On Jul 05 2022, Lars Ingebrigtsen wrote:

> Sean Whitton <spwhitton <at> spwhitton.name> writes:
>
>> 1. emacs -q
>> 2. C-x m
>> 3. foo>
>> 4. C-b
>> 5. M-b
>>
>> Point does not move to the beginning of the line, as one would expect.
>>
>> If a punctuation character other than '>' is used, it does to go bol.
>
> How strange -- it goes to the second character on the line?  Anybody
> know what could be causing this?

There is a syntax-table property on the first character.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56384; Package emacs. (Tue, 05 Jul 2022 11:53:02 GMT) Full text and rfc822 format available.

Message #16 received at 56384 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Andreas Schwab <schwab <at> suse.de>
Cc: 56384 <at> debbugs.gnu.org, Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#56384: 29.0.50; backward-word doesn't move far enough in
 message-mode
Date: Tue, 05 Jul 2022 13:52:29 +0200
Andreas Schwab <schwab <at> suse.de> writes:

> There is a syntax-table property on the first character.

Ah, thanks.  This was added by:

commit 25449e7296fe6e5cd9bca49ae1bc52d1552d5324
Author:     João Távora <joaotavora <at> gmail.com>
AuthorDate: Sun Apr 12 13:12:27 2015 +0100

    Summary: Improve sexp-based movement in message-mode
    
    Works by giving citations and smileys a different syntax.  This helps
    modes like `show-paren-mode', `electric-pair-mode', and C-M-*
    sexp-based movement.
    
    * lisp/gnus/message.el (message--syntax-propertize): New function.
    (message-mode): Set syntax-related vars.
    (message-smileys): New variable.
    
    * test/automated/message-mode-tests.el: New file

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2964,0 +2969,18 @@
+(defun message--syntax-propertize (beg end)
+  "Syntax-propertize certain message text specially."
+  (let ((citation-regexp (concat "^" message-cite-prefix-regexp ".*$"))
+        (smiley-regexp (regexp-opt message-smileys)))
+    (goto-char beg)
+    (while (search-forward-regexp citation-regexp
+                                  end 'noerror)
+      (let ((start (match-beginning 0))
+            (end (match-end 0)))
+        (add-text-properties start (1+ start)
+                             `(syntax-table ,(string-to-syntax "<")))
+        (add-text-properties end (min (1+ end) (point-max))
+                             `(syntax-table ,(string-to-syntax ">")))))
+    (goto-char beg)
+    (while (search-forward-regexp smiley-regexp
+            end 'noerror)
+      (add-text-properties (match-beginning 0) (match-end 0)
+                           `(syntax-table ,(string-to-syntax "."))))))


So it's giving the first character of each cited line a "<" syntax...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56384; Package emacs. (Tue, 05 Jul 2022 14:35:02 GMT) Full text and rfc822 format available.

Message #19 received at 56384 <at> debbugs.gnu.org (full text, mbox):

From: <spwhitton <at> spwhitton.name>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Andreas Schwab <schwab <at> suse.de>
Cc: 56384 <at> debbugs.gnu.org, Sean Whitton <spwhitton <at> spwhitton.name>
Subject: Re: bug#56384: 29.0.50; backward-word doesn't move far enough in
 message-mode
Date: Tue, 05 Jul 2022 07:34:49 -0700
Hello,

On Tue 05 Jul 2022 at 01:52PM +02, Lars Ingebrigtsen wrote:

> Andreas Schwab <schwab <at> suse.de> writes:
>
>> There is a syntax-table property on the first character.
>
> Ah, thanks.  This was added by:
>
> commit 25449e7296fe6e5cd9bca49ae1bc52d1552d5324
> Author:     João Távora <joaotavora <at> gmail.com>
> AuthorDate: Sun Apr 12 13:12:27 2015 +0100
>
>     Summary: Improve sexp-based movement in message-mode
>
>     Works by giving citations and smileys a different syntax.  This helps
>     modes like `show-paren-mode', `electric-pair-mode', and C-M-*
>     sexp-based movement.
>     
>     * lisp/gnus/message.el (message--syntax-propertize): New function.
>     (message-mode): Set syntax-related vars.
>     (message-smileys): New variable.
>
>     * test/automated/message-mode-tests.el: New file

I noticed this bug because it breaks expanding abbrevs at the beginning
of the line.  E.g. you've just pressed 'R' to reply with quoting the
original message in Gnus, and point is at the beginning of the first
quoted line.  Then if you type a word that is the key for an abbrev, and
then whitespace, it won't expand.  I wonder if that can be fixed without
losing the benefits of João's change.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56384; Package emacs. (Tue, 05 Jul 2022 16:45:01 GMT) Full text and rfc822 format available.

Message #22 received at 56384 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: <spwhitton <at> spwhitton.name>
Cc: Andreas Schwab <schwab <at> suse.de>, 56384 <at> debbugs.gnu.org
Subject: Re: bug#56384: 29.0.50; backward-word doesn't move far enough in
 message-mode
Date: Tue, 05 Jul 2022 18:44:40 +0200
<spwhitton <at> spwhitton.name> writes:

> I noticed this bug because it breaks expanding abbrevs at the beginning
> of the line.  E.g. you've just pressed 'R' to reply with quoting the
> original message in Gnus, and point is at the beginning of the first
> quoted line.  Then if you type a word that is the key for an abbrev, and
> then whitespace, it won't expand.  I wonder if that can be fixed without
> losing the benefits of João's change.

I'm not quite sure the change makes all that much sense.  If you have
this:

---
foo

> bar

zot
---

with point after foo, `M-C-f' takes you to the end of zot, which is
surprising.

I guess the idea is that you'd never want to edit quoted text?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56384; Package emacs. (Tue, 05 Jul 2022 17:05:01 GMT) Full text and rfc822 format available.

Message #25 received at 56384 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: schwab <at> suse.de, 56384 <at> debbugs.gnu.org, spwhitton <at> spwhitton.name
Subject: Re: bug#56384: 29.0.50;
 backward-word doesn't move far enough in message-mode
Date: Tue, 05 Jul 2022 20:04:20 +0300
> Cc: Andreas Schwab <schwab <at> suse.de>, 56384 <at> debbugs.gnu.org
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Date: Tue, 05 Jul 2022 18:44:40 +0200
> 
> ---
> foo
> 
> > bar
> 
> zot
> ---
> 
> with point after foo, `M-C-f' takes you to the end of zot, which is
> surprising.
> 
> I guess the idea is that you'd never want to edit quoted text?

I think the idea is that quoted text is treated like comments.  M-C-f
skips comments when you do that in a programming mode.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#56384; Package emacs. (Tue, 05 Jul 2022 17:11:02 GMT) Full text and rfc822 format available.

Message #28 received at 56384 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: schwab <at> suse.de, 56384 <at> debbugs.gnu.org, spwhitton <at> spwhitton.name
Subject: Re: bug#56384: 29.0.50; backward-word doesn't move far enough in
 message-mode
Date: Tue, 05 Jul 2022 19:09:52 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> I think the idea is that quoted text is treated like comments.  M-C-f
> skips comments when you do that in a programming mode.

Yes, that's true, so I guess the functionality does make sense.

Anybody know what should be adjusted here to make `M-b' do the right
thing?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 76 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.