emacs-devel
[Top][All Lists]
Advanced

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

Re: Control help- and Info-mode buffers from other buffers


From: Juri Linkov
Subject: Re: Control help- and Info-mode buffers from other buffers
Date: Thu, 01 Jun 2023 09:31:58 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>   (progn
>     (add-hook 'pre-command-hook (lambda () (other-window 1)))
>     (add-hook 'post-command-hook (lambda () (other-window -1))))

Sorry, this is wrong, it tried to run the same command
that was bound in the original window buffer.

This is the correct implementation that works in all cases:

#+begin_src emacs-lisp
(progn
  (add-hook 'pre-command-hook
            (lambda ()
              (other-window 1)
              (setq this-command (key-binding (this-command-keys)))))
  (add-hook 'post-command-hook (lambda () (other-window -1))))
#+end_src



reply via email to

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