[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 19:39:58 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
> Anyway, pre/post hook hack is very useful, and works with many commands, but
> not
> with all, so it is not 100% failsafe and general.Try to execute Info-mode
> from other window but Info (shortcut 'm'). In my Emacs it does not work.
I tried 'm' (Info-menu), and it works nicely without any problem.
As long as key prefixes are the same in both windows.
> Another problem with the above is that this will work only for 'other-window'
> for which Emacs has an algorithm to figure out which window it is. But what
> when
> you have more then two windows, and wish to switch to a different window than
> what Emacs considers as 'other-window'? You will have to prompt the user, to
> choose one. The help or info buffers are seldom the 'other-buffer' so
> constanly
> choosing the window would be just as annoying as constantly switching to and
> from, in my opinion.
Indeed, which window to use is a separate question.
For the existing commands scroll-other-window, scroll-other-window-down,
recenter-other-window, beginning-of-buffer-other-window,
end-of-buffer-other-window, the user option that defines which window to use
is 'other-window-scroll-default', and it can be customized
to any function, for example, a function that looks for
a window with a Help/Info buffer on the current frame,
or on any other frame. Or to a function that uses
'get-mru-window' to get the most recently used/displayed window.
All this is customizable.
> I would prefer if there was a code gen in form of a macro, as suggested,
> similar
> to define-minor-mode, that does this switching on pre-defined prefixes so that
> we get uniformity, and helps people write commands so they work from
> anywhere. Since it is not possible to completely automate it, perhaps lisp
> manual could mention how to write commands so they are callable from other
> windows then just selected one.
The downside is that every command needs to be modified and its body
wrapped with a macro. An alternative would be to put a new property
on the command symbol with a function that selects a window to redirect
input to. Implementation-wise this is like repeat-mode works.
Additionally, this will allow making redirected keys repeatable
like Manuel asked to do. Then:
Currently:
C-x o SPC SPC SPC DEL C-x o
With a prefix before every key:
C-h M-i SPC C-h M-i SPC C-h M-i SPC C-h M-i DEL
or with a shorter prefix key:
M-i SPC M-i SPC M-i SPC M-i DEL
With repeatable key sequences:
C-h M-i SPC SPC SPC DEL + some key to terminate the sequence
of redirecting input to another window
> I don't say you should not include the pre/post hack into Emacs if you want,
> it
> is better then what already is there for the similar purpose (don't remember
> longer the one included since I don't use it). I am just saying that we should
> perhaps write better commands in the future, so we don't need the hack :).
And I don't say that the pre/post approach is more reliable.
There are other alternatives for general code to select a window
before executing a command as opposed to modifying every command.
- Re: Control help- and Info-mode buffers from other buffers, (continued)
- Re: Control help- and Info-mode buffers from other buffers, Eli Zaretskii, 2023/06/04
- RE: [External] : Re: Control help- and Info-mode buffers from other buffers, Drew Adams, 2023/06/04
- Re: [External] : Re: Control help- and Info-mode buffers from other buffers, Eli Zaretskii, 2023/06/04
- Re: [External] : Re: Control help- and Info-mode buffers from other buffers, Arthur Miller, 2023/06/04
- RE: [External] : Re: Control help- and Info-mode buffers from other buffers, Drew Adams, 2023/06/04
- Re: Control help- and Info-mode buffers from other buffers, Manuel Giraud, 2023/06/04
- Re: Control help- and Info-mode buffers from other buffers, Juri Linkov, 2023/06/04
Re: Control help- and Info-mode buffers from other buffers, Arthur Miller, 2023/06/01
Re: Control help- and Info-mode buffers from other buffers,
Juri Linkov <=
Re: Control help- and Info-mode buffers from other buffers, Eli Zaretskii, 2023/06/01
Re: Control help- and Info-mode buffers from other buffers, Arthur Miller, 2023/06/02
Re: Control help- and Info-mode buffers from other buffers, Juri Linkov, 2023/06/02
Re: Control help- and Info-mode buffers from other buffers, Arthur Miller, 2023/06/04
Re: Control help- and Info-mode buffers from other buffers, Juri Linkov, 2023/06/04
Re: Control help- and Info-mode buffers from other buffers, Juri Linkov, 2023/06/01