Subject: Re: bug#22248: gnus-article-mode omits apostrophe from isearch string

From: Juri Linkov <[email-masked]>
Date: Sun, 29 Jan 2017 02:18:42 +0200

>>> Trying to put an expression like (setq var 'foo) into the isearch ring
>>> by moving point at its beginning and typing C-s C-w C-w C-w ...
>>> doesn't add apostrophe in Gnus because gnus-article-mode modifies
>>> syntax of ' to whitespace:
>>>
>>>   (defvar gnus-article-mode-syntax-table
>>>     (let ((table (copy-syntax-table text-mode-syntax-table)))
>>>       ;; make M-. in article buffers work for `foo' strings
>>>       (modify-syntax-entry ?' " " table)
>>>       (modify-syntax-entry ?` " " table)
>>>
>>> and lax-whitespace search together with isearch-yank-word-or-char
>>> squeeze apostrophe in a sequence of space characters.
>>>
>>> One solution is to modify syntax of ' and ` in gnus-article-mode-syntax-table
>>> to syntax discussed in bug#22238, i.e. not whitespace and not part
>>> of a symbol, still allowing M-. in article buffers work for `foo' strings,
>>> and allowing isearch to search in other buffers the same string yanked
>>> to the search ring from Gnus.
>>
>> Sounds good.  Could you supply a patch for doing that?
>
> Did you have a look at doing this?

Looks like the patch could be as simple as this

diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index e1af859..12fa97c 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -1708,9 +1708,10 @@ (defvar gnus-article-mode-syntax-table
     ;; (modify-syntax-entry ?- "w" table)
     (modify-syntax-entry ?> ")<" table)
     (modify-syntax-entry ?< "(>" table)
-    ;; make M-. in article buffers work for `foo' strings
-    (modify-syntax-entry ?' " " table)
-    (modify-syntax-entry ?` " " table)
+    ;; make M-. in article buffers work for `foo' strings,
+    ;; and still allow C-s C-w to yank ' to the search ring
+    (modify-syntax-entry ?' "'" table)
+    (modify-syntax-entry ?` "'" table)
     table)
   "Syntax table used in article mode buffers.
 Initialized from `text-mode-syntax-table'.")