unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Andreas Schwab <schwab@suse.de>
Cc: 56384@debbugs.gnu.org, Sean Whitton <spwhitton@spwhitton.name>
Subject: bug#56384: 29.0.50; backward-word doesn't move far enough in message-mode
Date: Tue, 05 Jul 2022 13:52:29 +0200	[thread overview]
Message-ID: <87o7y33hfm.fsf@gnus.org> (raw)
In-Reply-To: <mvmv8sbn5s7.fsf@suse.de> (Andreas Schwab's message of "Tue, 05 Jul 2022 13:43:52 +0200")

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





  reply	other threads:[~2022-07-05 11:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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=87o7y33hfm.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=56384@debbugs.gnu.org \
    --cc=schwab@suse.de \
    --cc=spwhitton@spwhitton.name \
    /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).