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: emacs-devel@gnu.org
Subject: Re: Info-mode patch
Date: Fri, 30 Jun 2023 00:28:56 +0200	[thread overview]
Message-ID: <AM9PR09MB497797FF295C3855061F91B49625A@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <86edluyxhl.fsf@mail.linkov.net> (Juri Linkov's message of "Thu,  29 Jun 2023 20:44:22 +0300")

[-- Attachment #1: Type: text/plain, Size: 7427 bytes --]

Juri Linkov <juri@linkov.net> writes:

> I have read all your mails and whole patch carefully (but can't test it
> because your patch does not apply to master/emacs-29).  Now it's difficult
> to read this mail because quotes are no more highlighted in Gnus.
> I don't know if this is because you mail is too long, or there is
> some bug in Gnus, but this is a minor problem.

I also use Gnus, and it works fine for me, but the mail did got very long. I
have removed old parts in the response, and just left those of your last
question/comments on which I have answered. I have put this one on top, it was
somewhere in the middle; the rest is as they come in your last response.

>> Yes with-selected-frame does switch focus to a freame; I have also used it in
>> the patch, for the same purpose to switch focus back to user frame.
>
> Well, it works for you.  I don't know why it's not supported for any WM.

I believe there is a missunderstanding here. I didn't meant that
with-selected-frame is not supported; it is, I used it myself.

I mean if you switch to an info window in your wrapper, then the focus will be
on that frame by the time original command executes. Now if I have focus follow
mouse, or mouse autoselct, or something, then if the mouse cursor is in the old
frame, then the minibuffer will popup in info frame, but system will switch
focus on old frame where mouse cursor is, so I can't type in the minibuffer in
info frame. I don't know if that clears confusion :).

I have actually wrapped the prompt in interactive form(s) into
with-selected-frame in some place to correct for that bahvour, so it switches
minbibuffer to the old frame. Hopefully it is not too confusing. I think you
will have that problem with the wrapper approach. Is there some way to tell
interactive  where all propts will be placed, without parsing interactive form
and checking strings for interactive codes or something similar awkward?

> Please note that risk of prompting user more than once doesn't exist in case
> of using wrapper commands.  Only the wrapper command prompts the user.
> Then all other intermediate functions called recursively or via
> function call chain don't need to prompt the user again because
> they all work in the right window.

Yes, that is expected since you are calling old command from a new function. A
new function is a clean slate, so yepp, I am aware of that and I was aware that
you want to pre-select window before calling the original command. So yes, that
is a positive thing with wrapper approach, you get that one for free. I just
clarified what commands needed the optional window and why, since you seemed to
think that I meant all commands need it.

> I have read all your mails and whole patch carefully (but can't test it
> because your patch does not apply to master/emacs-29).

Hmm ?

When I sent the first patch, it built without any warnings or errors in current
master. Then when I built earlier today after fixing that plist hack, window.el
got stuck in loadup.el when building dump file, because of cl-lib. So I reworked
it without cl-lib. That is the one I sent last, with the help commands too, it
should build without errors, I am typing from Emacs with that patch. I have
attached patched files if you want to just eval them and test. I am not sure if
I pulled from the git today. 

>> The minibuffer does use nothing. If it is enough with just switching to the
>> buffer or you need to switch to the window depends on the work in interactive form.
>>
>> Obviously some functions need access to the content of info-buffer. For example
>> Info-menu need acces to the text of an info buffer to create a menu that will be
>> presented to the user. Obviously in that case it is enough to just switch to the
>> buffer, and since you are just using the buffer you don't need to switch to
>> other frame so input is left on the user frame. You can use with-selected-window
>> instead, if you take care of focus and input.
>
> Yes, this would be better instead of with-selected-frame.

Because with-selected-window will also make visible buffer current and select
frame as well. Notice also that you can have more than one window visible, so just
selecting the frame might not work correctly, while with-selected-window
probably will.

> I see an extra map as an advantage because users will be able
> to put both help-other-window and info-other-window commands
> on the same prefix map.  Then e.g. 'M-i l' will go back either
> in the nearest Help or Info window.

What does that mean? You are building some general
"go-back-in-help-or-info-mode" command that will work specifically for info and
help and switch based on window buffer, or what is your plan there? How will you
deal with 's' which does two completely different things, search and view
source? Are you building some key dispatcher into your wrapper? Under which name
will users file the command in that collective map?

I am not sure I understand you there. How am I supposed to go back in info
buffer, if help window is nearest, or how am I supposed to go back in some other
info buffer than the nearest one? What does "nearest" even mean?

>> The patch is massive because diff has shifted a lot of code; perhaps if I
>> stashed my functions on the end of info.el, the change would be less massive? :)
>
> Yes, probably a short section of autoloaded wrapper commands at the end of info.el
> would look nicer.

I thought it was about good work and improving things, not about looks and magic pedals.

>> I don't know, I understand your motiv, but I don't really think that is the best
>> way to do things, but seems like I am the only one :).
>
> This is just my opinion.

In my opinion, what you suggest is a good for old code and in case of few commands,
as a first aid. But you seem to want to use wrappers as some general tool in all
cases, which means lots of unnecessary duplication if that will be the only tool
offered.

I think if we just take care how to write commands in the future, no magic
pedals would be needed, so at least put a few words in the manual on things to
think about when writing commands, and possibly create a macro that abstracts
those parts that make a command callable from other window. That would benefit
Emacs in longer run much better in my opinion. With other words, to wrapper
approach you suggest certainly has its place, but I wouldn't use it as a general
tool for the future commands, and I wouldn't throw away written and tested work,
just to replace it with the generated code.

>                           If people would think your patch is a good way
> to go, that would be fine with me.

My patch was not some general suggestion; I have just rewrote info and help modes
specifically, but I certainly don't think rewriting each and every command is "a
way to go". Interested that Eli said I was looking for some generic solution.

I do suggest automation in form of a codegen, a little macro helper, as said in
pevious discussion, some sort of define-command, similar to define-minor-mode,
but I didn't want to do it as part of this patch.

I am ok to help, and the patch was a suggestion; I have done it for myself
anyway. I would probably just skipped the frames part, since I don't use
multiple frames.

Anyway, attached is patched version of files if anyone is interested to try it, if
the prevously sent patch does not apply. If you find a bug let me know. 


[-- Attachment #2: window.el --]
[-- Type: application/emacs-lisp, Size: 468020 bytes --]

[-- Attachment #3: help-mode.el --]
[-- Type: application/emacs-lisp, Size: 44814 bytes --]

[-- Attachment #4: info.el --]
[-- Type: application/emacs-lisp, Size: 237477 bytes --]

  reply	other threads:[~2023-06-29 22:28 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 16:09 Info-mode patch Arthur Miller
2023-06-26 17:56 ` Juri Linkov
2023-06-26 20:17   ` Arthur Miller
2023-06-27  6:32     ` Juri Linkov
2023-06-27  7:54       ` Arthur Miller
2023-06-27 18:11         ` Juri Linkov
2023-06-27 23:09           ` Arthur Miller
2023-06-28  6:50             ` Juri Linkov
2023-06-28 21:52               ` Arthur Miller
2023-06-29  6:44                 ` Juri Linkov
2023-06-29 12:42                   ` Arthur Miller
2023-06-29 15:00                     ` [External] : " Drew Adams
2023-06-29 16:24                       ` Arthur Miller
2023-06-29 17:44                     ` Juri Linkov
2023-06-29 22:28                       ` Arthur Miller [this message]
2023-06-30  7:13                         ` Juri Linkov
2023-06-30  8:41                           ` Arthur Miller
2023-06-30 17:57                             ` Juri Linkov
2023-07-01  9:11                               ` Arthur Miller
2023-07-02 17:53                                 ` Juri Linkov
2023-07-02 18:39                                   ` Eli Zaretskii
2023-07-02 22:43                                     ` Arthur Miller
2023-07-03 11:46                                       ` Eli Zaretskii
2023-07-03 12:57                                         ` Arthur Miller
2023-07-03 13:17                                           ` Eli Zaretskii
2023-07-03 18:40                                             ` Juri Linkov
2023-07-03 18:57                                               ` Eli Zaretskii
2023-07-04  6:50                                                 ` easy-menu-define keys for key-valid-p (was: Info-mode patch) Juri Linkov
2023-07-04 11:33                                                   ` Eli Zaretskii
2023-07-03 21:07                                               ` Info-mode patch Arthur Miller
2023-07-04  7:59                                                 ` Andreas Schwab
2023-07-04  8:44                                                   ` Arthur Miller
2023-07-03 17:07                                       ` Eli Zaretskii
2023-07-04 23:58                                         ` Stefan Monnier
2023-07-08  8:14                                           ` Eli Zaretskii
2023-07-02 22:05                                   ` Arthur Miller
2023-07-03 18:45                                     ` Juri Linkov
2023-07-03 22:24                                       ` Arthur Miller
2023-07-04  6:54                                         ` Juri Linkov
2023-07-04  9:43                                           ` Arthur Miller
2023-07-04 17:51                                             ` Juri Linkov
2023-07-04 21:40                                               ` Arthur Miller
2023-07-05  6:17                                                 ` Juri Linkov
2023-07-05 14:25                                                   ` Arthur Miller
2023-07-01  9:59                         ` Getting Gnus to highlight citations in long mails (was: Info-mode patch) Kévin Le Gouguec
2023-07-01 12:40                           ` Getting Gnus to highlight citations in long mails Arthur Miller
2023-07-02 17:56                           ` Juri Linkov
2023-06-27 11:45   ` Info-mode patch Eli Zaretskii
2023-06-27 12:15     ` Arthur Miller
2023-06-27 12:42       ` Eli Zaretskii
2023-06-27 15:28         ` Arthur Miller
2023-06-27 16:03           ` Eli Zaretskii
2023-06-27 16:33             ` Arthur Miller

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=AM9PR09MB497797FF295C3855061F91B49625A@AM9PR09MB4977.eurprd09.prod.outlook.com \
    --to=arthur.miller@live.com \
    --cc=emacs-devel@gnu.org \
    --cc=juri@linkov.net \
    /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).