emacs-devel
[Top][All Lists]
Advanced

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

Re: Info-mode patch


From: Juri Linkov
Subject: Re: Info-mode patch
Date: Tue, 27 Jun 2023 09:32:25 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> Also I didn't wanted to change API. Not that I believe that there are many 3rd
> party packages for Info and Help modes, and that people actually customize
> those, but anyway. Wrappers would be a new API, which all require at least 
> some
> documentation etc.

Actually adding new arguments to existing functions counts as changing API.
Whereas not changing existing functions means keeping the current API unchanged.
Since you need to bind commands to new keys anyway, there is no difference
whether you bind old commands or new other-window commands.

> Can you control on which frame the input goes when prompted by original
> function with a wrapper approach? I changed quite few prompts a wrapped stuff
> with both with-current-buffer, and with-selected-frame to achive that. I don't
> think I could do that if I wrapped stuff. But what do I know, perhaps there is
> some way?

I see that you added with-selected-frame to Info-index.
But it seems this is not enough because with-selected-frame
still fails to switch focus to another frame.  You need also
to use select-frame-set-input-focus.

Since neither with-selected-window nor with-selected-frame
can switch focus, we could add a new macro like

#+begin_src emacs-lisp
(defmacro with-selected-window-frame (window &rest body)
  `(let ((frame (window-frame ,window)))
     (unless (eq frame (selected-frame))
       (select-frame frame 'norecord)
       (select-frame-set-input-focus frame 'norecord))
     (with-selected-window ,window
       ,@body)))
#+end_src

Then everything works nicely with

#+begin_src emacs-lisp
(defun Info-index-other-window (topic)
  (interactive (with-selected-window-frame (info-window)
                (eval (cadr (interactive-form 'Info-index)))))
  (with-selected-window-frame (info-window)
   (Info-index topic)))
#+end_src



reply via email to

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