bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24510: 25.1; Info: searching for ` does not find what looks like `


From: Juri Linkov
Subject: bug#24510: 25.1; Info: searching for ` does not find what looks like `
Date: Thu, 05 May 2022 19:20:01 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu)

>>> No, I want the default Isearch to fold `' with the fancy variants in
>>> these modes.  :-)
>>
>> So the users will have no way to search for ' literally?
>
> Yes, I don't think anybody would want to.  But like I said, I'd prefer
> if it was possible to have this as a minor mode so that people could
> switch it off (even if they probably won't want to).

If you are sure about this, here is the simplest way to implement it,
and the users can disable it easily in help-mode-hook:

diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 94bd591131..4ad8e36070 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -414,6 +414,13 @@ help-mode
   (setq-local tool-bar-map
               help-mode-tool-bar-map)
   (setq-local help-mode--current-data nil)
+  (unless search-default-mode
+    (setq-local search-default-mode
+                (lambda (string &optional _lax)
+                  (thread-last
+                    (regexp-quote string)
+                    (replace-regexp-in-string "`" "[`‘]")
+                    (replace-regexp-in-string "'" "['’]")))))
   (setq-local bookmark-make-record-function
               #'help-bookmark-make-record))
 
diff --git a/lisp/info.el b/lisp/info.el
index abfb77b055..7e0d4f646f 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -4487,6 +4487,14 @@ Info-mode
   (setq-local isearch-wrap-function #'Info-isearch-wrap)
   (setq-local isearch-push-state-function #'Info-isearch-push-state)
   (setq-local isearch-filter-predicate #'Info-isearch-filter)
+  (unless search-default-mode
+    (setq-local search-default-mode
+                (lambda (string &optional _lax)
+                  (thread-last
+                    (regexp-quote string)
+                    (replace-regexp-in-string "`" "[`‘]")
+                    (replace-regexp-in-string "'" "['’]")
+                    (replace-regexp-in-string "\"" "[\"“”]")))))
   (setq-local revert-buffer-function #'Info-revert-buffer-function)
   (setq-local font-lock-defaults '(Info-mode-font-lock-keywords t t))
   (Info-set-mode-line)
PS: ISTR, there was a discussion about supporting simultaneous replacements
instead of using thread-last.  Is this a work in progress?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]