unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
@ 2022-07-04 16:04 Sean Whitton
  2022-07-05 11:29 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Sean Whitton @ 2022-07-04 16:04 UTC (permalink / raw)
  To: 56384

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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
  2022-07-04 16:04 bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode Sean Whitton
@ 2022-07-05 11:29 ` Lars Ingebrigtsen
  2022-07-05 11:43   ` Andreas Schwab
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-05 11:29 UTC (permalink / raw)
  To: Sean Whitton; +Cc: 56384

Sean Whitton <spwhitton@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
  2022-07-05 11:29 ` Lars Ingebrigtsen
@ 2022-07-05 11:43   ` Andreas Schwab
  2022-07-05 11:52     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Andreas Schwab @ 2022-07-05 11:43 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 56384, Sean Whitton

On Jul 05 2022, Lars Ingebrigtsen wrote:

> Sean Whitton <spwhitton@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@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
  2022-07-05 11:43   ` Andreas Schwab
@ 2022-07-05 11:52     ` Lars Ingebrigtsen
  2022-07-05 14:34       ` spwhitton
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-05 11:52 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 56384, Sean Whitton

Andreas Schwab <schwab@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@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
  2022-07-05 11:52     ` Lars Ingebrigtsen
@ 2022-07-05 14:34       ` spwhitton
  2022-07-05 16:44         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: spwhitton @ 2022-07-05 14:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Andreas Schwab; +Cc: 56384, Sean Whitton

Hello,

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

> Andreas Schwab <schwab@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@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
  2022-07-05 14:34       ` spwhitton
@ 2022-07-05 16:44         ` Lars Ingebrigtsen
  2022-07-05 17:04           ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-05 16:44 UTC (permalink / raw)
  To: spwhitton; +Cc: Andreas Schwab, 56384

<spwhitton@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
  2022-07-05 16:44         ` Lars Ingebrigtsen
@ 2022-07-05 17:04           ` Eli Zaretskii
  2022-07-05 17:09             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2022-07-05 17:04 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: schwab, 56384, spwhitton

> Cc: Andreas Schwab <schwab@suse.de>, 56384@debbugs.gnu.org
> From: Lars Ingebrigtsen <larsi@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.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
  2022-07-05 17:04           ` Eli Zaretskii
@ 2022-07-05 17:09             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-05 17:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: schwab, 56384, spwhitton

Eli Zaretskii <eliz@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





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-07-05 17:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-04 16:04 bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode Sean Whitton
2022-07-05 11:29 ` Lars Ingebrigtsen
2022-07-05 11:43   ` Andreas Schwab
2022-07-05 11:52     ` Lars Ingebrigtsen
2022-07-05 14:34       ` spwhitton
2022-07-05 16:44         ` Lars Ingebrigtsen
2022-07-05 17:04           ` Eli Zaretskii
2022-07-05 17:09             ` Lars Ingebrigtsen

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).