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

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

bug#15839: 24.3.50; `isearch-allow-scroll': be able to scroll point off


From: Juri Linkov
Subject: bug#15839: 24.3.50; `isearch-allow-scroll': be able to scroll point off screen temporarily
Date: Fri, 07 Dec 2018 01:03:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> Isn't this binding of shift-left and shift-right from Org mode?
>
> No, I simply have personal global bindings for these:
>
> (global-set-key [(shift left)]  #'backward-char)
> (global-set-key [(shift right)] #'forward-char)

Your keybindings are related to cursor motion,
so it makes sense to allow them to work in isearch-mode.

One way to do this:

(define-key isearch-mode-map [(shift left)]
  (lambda (&optional n)
    (interactive "^p")
    (setq isearch-pre-move-point (point))
    (call-interactively 'backward-char)))

(define-key isearch-mode-map [(shift right)]
  (lambda (&optional n)
    (interactive "^p")
    (setq isearch-pre-move-point (point))
    (call-interactively 'forward-char)))

Or do you want to be able to put properties to allow a command, e.g.:

(put 'backward-char 'isearch-move 'enabled)
(put 'forward-char 'isearch-move 'enabled)

with such patch

diff --git a/lisp/isearch.el b/lisp/isearch.el
index dcd119a517..6b0d9f03af 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2871,7 +2871,11 @@ isearch-pre-command-hook
                         (stringp (nth 1 (interactive-form this-command)))
                         (string-match-p "^^" (nth 1 (interactive-form 
this-command))))))
           (and (eq isearch-yank-on-move 'shift)
-               this-command-keys-shift-translated))
+               (or (and this-command-keys-shift-translated
+                        (symbolp this-command)
+                        (not (eq (get this-command 'isearch-move) 'disabled)))
+                   (and (symbolp this-command)
+                        (eq (get this-command 'isearch-move) 'enabled)))))
       (setq this-command-keys-shift-translated nil)
       (setq isearch-pre-move-point (point)))
      ;; Append control characters to the search string


I'm still not sure if this needed to be generalized more, and how far.
For example, I think that shift-left and shift-right
from org-mode should exit Isearch as well as windmove shift-keys
should exit Isearch and move focus to another window.





reply via email to

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