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

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

Emacs 26.2 - Scroll command breaks if allowed during Isearch


From: Andrea Greselin
Subject: Emacs 26.2 - Scroll command breaks if allowed during Isearch
Date: Wed, 13 Nov 2019 17:06:33 +0100

Hello,

I noticed that a command that uses `set-window-hscroll' doesn't work the
same way during an isearch if `isearch-allow-scroll' is non nil and the
command has the properties `scroll-command' or `isearch-scroll'.

To reproduce, run `emacs -Q' and evaluate
--------------------------------------------------------------------------------
;;
0123456789

;; Set up the window and enable scrolling during isearch.
(set-frame-width nil 80)
(setq hscroll-margin 5)
(toggle-truncate-lines)
(setq isearch-allow-scroll t)

(defun h-scroll ()
  (interactive)
  (set-window-hscroll (selected-window) 10))

(defun h-not-so-scroll ()
  (interactive)
  (set-window-hscroll (selected-window) 10))

;; Even if you comment out one of these two settings the behaviour is the
same
(put 'h-scroll 'scroll-command t)
(put 'h-scroll 'isearch-scroll t)

(global-set-key (kbd "C-S-l") #'h-scroll)
(global-set-key (kbd "C-S-k") #'h-not-so-scroll)
--------------------------------------------------------------------------------
Now `h-scroll' (C-S-l) never quits isearch but
 - when I search for 0 in the first line and type C-S-l nothing happens
(`window-hscroll' remains 0);
 - if I search for 1 <= n <= 5 (columns 74 to 78, within `hscroll-margin'
from the right edge), isearch scrolls the window left, C-S-l then brings it
back all the way to the right (`window-hscroll' is brought back to 0);
 - if I search for n >= 6 then type C-S-l, `window-hscroll' is set to 10,
as expected.
C-S-k always sets `window-hscroll' to 10, but it exits isearch. Outside of
isearch both commands always work correctly.

What's the reason for this behaviour? Can I change it so that `h-scroll'
always sets the `window-hscroll' to 10 without exiting isearch?

Thanks,
Andrea


reply via email to

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