oantolin / embark

Emacs Mini-Buffer Actions Rooted in Keymaps
GNU General Public License v3.0
877 stars 54 forks source link

Precision scroll not working in actions window #706

Open richcarl opened 3 months ago

richcarl commented 3 months ago

With the new pixel-scroll-precision-mode in Emacs 29, trying to scroll the Actions window to see all available actions just causes the window to disappear again.

Apart from hopefully fixing this, would it also be possible to get a couple of standard scroll keys in the Actions list, similar to the embark-cycle-key? Using the scroll-other-window keys doesn't really work either when you have more than two windows.

My current workaround is to use the which-key indicator from the wiki. However, it pops up immediately. If the embark-mixed-indicator function could take the vindicator and mindicator as parameters, it would be easy to get the same delay as before but with which-key as the verbose indicator.

oantolin commented 3 months ago

I'll look into pixel scrolling, but what problem exactly did you have with scroll-other-window? The code for scroll-other-window is intended to be the keyboard-based solution to this problem; and if whatever I did for it doesn't work, adding extra key bindings won't fix that.

richcarl commented 3 months ago

what problem exactly did you have with scroll-other-window? The code for scroll-other-window is intended to be the keyboard-based solution to this problem

There is no correlation between which window is currently the "other" window that will be scrolled by C-M-v, and which window is showing the Actions list. If you're lucky they're the same, otherwise you can't scroll the actions. Trying any other key to select the Action window in order to scroll it will just close it instead.

oantolin commented 3 months ago

Embark is supposed to ensure that scroll-other-window scrolls the action list. If there are circumstances in which it does not work, I'd love to have a recipe to reproduce those starting from emacs -q.

richcarl commented 3 months ago

Embark is supposed to ensure that scroll-other-window scrolls the action list. If there are circumstances in which it does not work, I'd love to have a recipe to reproduce those starting from emacs -q.

It seems that this setting in my config is what makes Embark not work with scroll-other-window: (setq display-buffer-base-action '((display-buffer-reuse-window display-buffer-pop-up-window)))

oantolin commented 3 months ago

Thanks, I'll give that seeing a try.

oantolin commented 3 months ago

OK, so I think I've fixed the problem with pixel-scroll-precision-mode, by adding the oddly named pixel-scroll-precision to the list of commands considered as scrolling commands. 194c042ef450db7f3b77e3400e1f2e6a80a71ef8 Please test.

As for the other problem, that sometimes scroll-other-window does not scroll the embark action list buffer for you, I cannot manage to reproduce it, even with the setting you gave me for display-buffer-base-action. Also, it makes sense to me that the code works, since it temporarily sets minibuffer-scroll-window to some window displaying the buffer called " *Embark Actions*" —so it's not leaving which window will be scrolled to chance! Are you renaming the embark action list buffers?

This remaining problem is going to be very hard for me to fix since I can't reproduce it, and I would greatly appreciate a recipe that started from emacs -q.

richcarl commented 3 months ago

Put this in a file test.el:

(setopt inhibit-startup-message t)

(eval-and-compile
  (add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory))
  )

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)
(package-install 'use-package)

(setq display-buffer-base-action
        '((display-buffer-reuse-window display-buffer-pop-up-window)))

(use-package embark
  :bind
  ("C-." . embark-act))

Launch as emacs -q -l test.el test.el. Split (C-x 2) twice so you get three windows. Stand in the top window and press C-. for Embark - shows embark actions in the middle window. C-M-v scrolls middle window, all good. Cancel action. Press M-- C-x o to go directly to the lower window (or use mouse to select lower window). Press C-. for Embark. Actions show up in middle window as before, because of reuse-window setting, but C-M-v scrolls the top window since that is the "other" window from the bottom one. The same can happen when using Windmove-navigation to move between windows, e.g. if you have split windows both vertically and horizontally, or if windmove-wrap-around is t.