unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Arthur Miller <arthur.miller@live.com>
To: Juri Linkov <juri@linkov.net>
Cc: Eli Zaretskii <eliz@gnu.org>, larsi@gnus.org, emacs-devel@gnu.org
Subject: Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer
Date: Fri, 24 Sep 2021 21:34:57 +0200	[thread overview]
Message-ID: <AM9PR09MB49775F8C0CC6A36B3BB559CD96A49@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <87a6k2nlr6.fsf@mail.linkov.net> (Juri Linkov's message of "Fri,  24 Sep 2021 18:31:59 +0300")

Juri Linkov <juri@linkov.net> writes:

>> I came up with another idea last night and sent a patch, but I am not sure if it
>> got to right place, I don't see it myself. It was an answer longer in the thread
>> to Lars.
>>
>> This one makes it possible to run any command in *Help* buffer, not just those
>> defined in help-mode.el, and those not need any patching or wrapping of existing
>> commands.
>>
>> I don't know if it is correct place to put define-key for the global map, and I
>> am not sure if C-h M-h is the right, but that's just a detail.
>
> This would be a nice command.  But why it's limited only to help-window?
> It could allow reading and running the key sequences in any next-window.

Yeah, sure, you could have it for next, previous or one found via
compleating-read, ot any buffer you can make current. 

This was meant as a quick fix to control help buffer so we don't need
to switch back and forth.

>> +(defun help-do-command ()
>> +  "Run a key-sequence in \"*Help*\" buffer from other buffers.
>> +
>> +If *Help* buffer is not visible, the HELP-DO-COMMAND will be aborterd."
>> +  (interactive)
>> +  (if (get-buffer-window (help-buffer))
>
> I meant to replace '(get-buffer-window (help-buffer))' with '(next-window)'.

Next-window could be anything, it could be just as annoying as switching
forth-and back, so I think it is better to have a specialized function that
works only on this buffer.
>
>> +      (let ((__key (read-key-sequence "Run command in *Help* buffer: ")))
>> +        (with-current-buffer (help-buffer)
>> +          (call-interactively
>> +           (key-binding
>> +            (kbd (edmacro-format-keys (vector last-input-event)))))))
>> +    (call-interactively (global-key-binding "\C-g"))))
>> +
>> +(define-key global-map (kbd "C-h M-h") 'help-do-command)

This was a quick fix, I just came up with that idea based on what I suggested
earlier, but sure it can be generalized. I think personally it is better that
every mode exports a named function, like foo-do-command or something, but one
where user chooses a buffer and one 'dwim' style one there are only two buffers
would be good to have too.

By the way, this let statement is unnecessary too, it is a leftover from refactoring.



  parent reply	other threads:[~2021-09-24 19:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AxtnEw.onqlxb7Mkpry.ig9TynsmAb80jvlU3CY7@freemail.hu>
     [not found] ` <87mtrrq7t7.fsf@gnus.org>
     [not found]   ` <AM9PR09MB4977DAFB86D88A4714C1C64196A29@AM9PR09MB4977.eurprd09.prod.outlook.com>
     [not found]     ` <87pmt0qomh.fsf@gnus.org>
     [not found]       ` <AM9PR09MB49770845B0C1B7CBB331E68A96A39@AM9PR09MB4977.eurprd09.prod.outlook.com>
     [not found]         ` <87wnn7xbdg.fsf@gnus.org>
2021-09-23 22:18           ` bug#36767: 26.1; request: add more quick keys to the *Help* buffer Arthur Miller
     [not found]   ` <87eed0nsez.fsf@mail.linkov.net>
     [not found]     ` <83bl83zp5h.fsf@gnu.org>
     [not found]       ` <AM9PR09MB49779C8B93EFFB329EB8E5A596A29@AM9PR09MB4977.eurprd09.prod.outlook.com>
     [not found]         ` <83y27nvnb4.fsf@gnu.org>
     [not found]           ` <AM9PR09MB497767EDF180DE0C3EE15F4396A39@AM9PR09MB4977.eurprd09.prod.outlook.com>
     [not found]             ` <83ilyrvgda.fsf@gnu.org>
     [not found]               ` <AM9PR09MB497720FA603D3B7FC4D4739196A39@AM9PR09MB4977.eurprd09.prod.outlook.com>
     [not found]                 ` <83h7ebv39d.fsf@gnu.org>
     [not found]                   ` <AM9PR09MB49771D1ECD11701DEFB77C7A96A39@AM9PR09MB4977.eurprd09.prod.outlook.com>
     [not found]                     ` <838rznusle.fsf@gnu.org>
2021-09-24  7:16                       ` Arthur Miller
2021-09-24 15:31                         ` Juri Linkov
2021-09-24 16:12                           ` Eli Zaretskii
2021-09-24 19:36                             ` Arthur Miller
2021-09-24 19:39                             ` Arthur Miller
2021-09-24 19:57                             ` Arthur Miller
2021-09-25  6:09                               ` Eli Zaretskii
2021-09-25 14:41                                 ` Arthur Miller
2021-09-25 14:59                                   ` Eli Zaretskii
2021-09-25 16:22                                     ` Arthur Miller
2021-09-25 16:26                                       ` Eli Zaretskii
2021-09-25 17:08                                         ` Arthur Miller
2021-09-25 17:20                                           ` Eli Zaretskii
2021-09-25 20:15                                             ` Arthur Miller
2021-09-26 21:52                                               ` Arthur Miller
2021-09-26  9:11                                           ` martin rudalics
2021-09-26 16:11                                             ` Arthur Miller
2021-09-26 16:54                                               ` [External] : " Drew Adams
2021-09-26 21:51                                                 ` Arthur Miller
2021-09-26 22:38                                                   ` Drew Adams
2021-09-26 22:46                                                     ` Arthur Miller
2021-09-26 17:51                                               ` martin rudalics
2021-09-26 21:48                                                 ` Arthur Miller
2021-09-27 11:07                                 ` Exec help commands from other buffer (was bug#36767: 26.1; request: add more quick keys to the *Help* buffer) Arthur Miller
2021-09-27 19:59                                   ` Arthur Miller
2021-09-24 18:34                           ` [External] : Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer Drew Adams
2021-09-24 19:34                           ` Arthur Miller [this message]
2021-09-24 20:20                           ` Arthur Miller
2021-09-24 20:33                           ` Arthur Miller
2021-09-25 18:46                             ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM9PR09MB49775F8C0CC6A36B3BB559CD96A49@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).