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: Arthur Miller
Subject: Re: Control help- and Info-mode buffers from other buffers
Date: Tue, 30 May 2023 15:31:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Manuel Giraud <manuel@ledu-giraud.fr> writes:

> Arthur Miller <arthur.miller@live.com> writes:
>
>> I would like to be able to control Info and Help buffers from other buffers, 
>> to
>> lessen switch between windows.
>
> Hi Arthur,
>
> I like this.  I'm often reading some documentation while testing things
> into the current buffer so I think I would be a great addition.  I'm
> testing your patch now (and will report any issue if needed).

Hi Manuel;

thank you very much for testing it, and for the kind words. I have reworked
somewhat the patch, because of some unnecessary warnings. I am attaching the
reworked version in this mail too (I have send it in another mail). Sorry for
the inconvenience, but if you test, I suggest testing with the later one. It is
very much the same, minus some re-furnituring for the code, some local variables
renaming and some doc string changes.

> As a potential future user, I have some comments/requests:
>
>      - Could it be extend to Man buffers?  I think it would even be more
>        useful than *Help* buffers which are short most of the time (or
>        maybe it is just me).

Probably, I don't use man a lot so I am not sure to be honest.

The technique can be extended to "remotely" control any buffer, but it works
well only with "unique" buffers (one of a kind), like Help buffer for
example. Even with *info* buffers it is a bit less clean since there can be few
of those. But technically it is possible (I have been doing this
programmatically too).

>      - Is it possible to have repeat mode for this?  So one could do
>        "C-h M-i SPC SPC SPC DEL" to browse some info pages.

I am not a repeat-mode user myself to be honest, so IDK, but I guess there
should be no problems. These are just commands that can be called very well via
M-x as any other command, so I guess it should work with repeat mode as well?

Also I suggest rebinding to M-i instead of C-h M-i for more pleasant experience
(or whichever key suits the best :)). I have chosen C-h M-i just to be on the
conservative side to spare GNU server maintainers from excessive electrical
bills, which may result every time we suggest rebinding a default key on this
list. M-i does something in Outline mode by default, likewise, M-h is bound to
mark-pragraph by default, so I have opted for C-h M-h.

>      - Could we have a "umbrella" keybinding that does this for some
>        common denominator functions the other "documentation" buffer
>        (be it *info*, *Help* or a man page)?

Basicly yes. The idea is:

1. switch to desired buffer
2. do whatever needed in that buffer
3. switch back to original buffer

I have been doing this for quite a while, and I have a little mode were I do
this programmatically as mentioned above. I have a little library < 100 sloc,
where I iterate through help/info mode-maps, check if the command starts with
help- or Info- prefix and attch an advice around the command where I do this
switching between windows and call original function in-between. If it does not,
I create a new symbol with the correct prefix, alias it to the old function, and
then advise the new symbol.

It worked very well with help-mode, but some commands in Info-mode are not
possible to advice that way, about a couple of those. Info-menu was one for
example.

But in Info-mode there are some nested char-tables in the keymap which turns out
to be quite slow to process programmatically. Also, even if it was fast, doing
that every time Emacs starts is unnecessary, it is probably better to do it once
and for all, so I have implemented it now manually. Similar can be implemented
for any command to make it "buffer specific", but as said, works well only in
cases where there is just one buffer at a time, so I doubt in generality of this
technique. I have actually tried to find some general way to do this
programmatically with any buffer, but thus far, I don't see any general way
that is both efficient and 100% failsafe.

> Best regards,

Best regards and thanks for testing!

Attachment: 0001-Use-help-and-Info-mode-commands-from-any-buffer.patch
Description: Text Data


reply via email to

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