[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 21:11:04 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
>> 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.
> Where it fails? For me it prompts me on correct frame. I didn't want to switch
> focus on the info frame. I am aware of select-frame-set-input-focus, have used
> it in some test actually.
Probably the behaviour depends on the window manager.
With my window manager with-selected-frame displays
the prompt in another frame, but input is inserted
into the original buffer. Maybe we should have
a new option whether to use select-frame-set-input-focus?
> Have you tested *everything*? Interactively and from lisp?
I see no problems with this both interactively and from lisp:
#+begin_src emacs-lisp
(defmacro with-selected-window-frame (window &rest body)
`(let ((old-frame (selected-frame))
(frame (window-frame ,window)))
(unless (eq frame old-frame)
(select-frame frame 'norecord)
(select-frame-set-input-focus frame 'norecord))
(prog1 (with-selected-window ,window
,@body)
(select-frame old-frame 'norecord)
(select-frame-set-input-focus old-frame 'norecord))))
(defun Info-index-other-window (topic &optional window)
(interactive
(with-selected-window-frame (info-window)
(append (eval (cadr (interactive-form 'Info-index)))
(list (selected-window)))))
(with-selected-window (or window (info-window))
(Info-index topic)))
#+end_src
You can't avoid adding the window argument. Otherwise, you need
to invent such hacks as sending the window selected by the user
to the command body via a symbol property.
But in the wrapper command like above there is no problem
of adding the window argument to the new command.
Maybe it's possible even to write a macro that will generate
such wrapper commands automatically from existing commands.
It seems you assume that all commands should take a window.
But there are no such assumption for most commands that work
only in the selected window. OTOH, only -other-window commands
switch the window.
- Info-mode patch, Arthur Miller, 2023/06/26
- Re: Info-mode patch, Juri Linkov, 2023/06/26
- Re: Info-mode patch, Arthur Miller, 2023/06/26
- Re: Info-mode patch, Juri Linkov, 2023/06/27
- Re: Info-mode patch, Arthur Miller, 2023/06/27
- Re: Info-mode patch,
Juri Linkov <=
- Re: Info-mode patch, Arthur Miller, 2023/06/27
- Re: Info-mode patch, Juri Linkov, 2023/06/28
- Re: Info-mode patch, Arthur Miller, 2023/06/29
- Re: Info-mode patch, Juri Linkov, 2023/06/29
- Re: Info-mode patch, Arthur Miller, 2023/06/29
- RE: [External] : Re: Info-mode patch, Drew Adams, 2023/06/29
- Re: [External] : Re: Info-mode patch, Arthur Miller, 2023/06/29
- Re: Info-mode patch, Juri Linkov, 2023/06/29
- Re: Info-mode patch, Arthur Miller, 2023/06/30
- Re: Info-mode patch, Juri Linkov, 2023/06/30