Subject: bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 05 Jul 2022 13:52:29 +0200

Andreas Schwab <[email-masked]> writes:

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

Ah, thanks.  This was added by:

commit 25449e7296fe6e5cd9bca49ae1bc52d1552d5324
Author:     João Távora <[email-masked]>
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