emacs-devel
[Top][All Lists]
Advanced

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

Re: Let's make C-M-w in isearch yank symbol, not delete character


From: Juri Linkov
Subject: Re: Let's make C-M-w in isearch yank symbol, not delete character
Date: Wed, 07 Mar 2018 00:07:46 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> >>   Error in pre-command-hook (isearch-pre-command-hook):
>> >>   (wrong-type-argument characterp right)
>> >> 
>> >>   Error in pre-command-hook (isearch-pre-command-hook):
>> >>   (wrong-type-argument characterp 134217830)
>> >
>> > That's a bug that needs to be fixed, I think.
>> 
>> Unfortunately, I have no idea what characters to append to the
>> search string in such cases.
>
> How about nothing?

This reduces the usefulness of this feature.
But OK, here is a new option for it:

diff --git a/lisp/isearch.el b/lisp/isearch.el
index 96faa27..b22a775 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -82,6 +82,7 @@ search-exit-option
                  (const :tag "Edit the search string" edit)
                  (const :tag "Extend the search string by motion commands" 
move)
                  (const :tag "Extend the search string by shifted motion keys" 
shift-move)
+                 (const :tag "Append control characters to the search string" 
append)
                  (const :tag "Don't terminate incremental search" nil))
   :version "27.1")
 
@@ -2452,13 +2453,18 @@ isearch-pre-command-hook
                this-command-keys-shift-translated))
       (setq this-command-keys-shift-translated nil)
       (setq isearch-pre-move-point (point)))
+     ;; Append control characters to the search string
+     ((eq search-exit-option 'append)
+      (when (cl-every #'characterp key)
+        (isearch-process-search-string key key))
+      (setq this-command 'ignore))
      ;; Other characters terminate the search and are then executed normally.
      (search-exit-option
       (isearch-done)
       (isearch-clean-overlays))
      ;; If search-exit-option is nil, run the command without exiting Isearch.
      (t
-      (isearch-process-search-string key key)))))
+      ))))
 
 (defun isearch-post-command-hook ()
   (cond



reply via email to

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