From: Arthur Miller <arthur.miller@live.com>
To: Juri Linkov <juri@linkov.net>
Cc: emacs-devel@gnu.org
Subject: Re: Info-mode patch
Date: Tue, 27 Jun 2023 09:54:27 +0200 [thread overview]
Message-ID: <AM9PR09MB4977EA084A010E4025FE03069627A@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <86wmzpqva6.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 27 Jun 2023 09:32:25 +0300")
Juri Linkov <juri@linkov.net> writes:
>> Also I didn't wanted to change API. Not that I believe that there are many 3rd
>> party packages for Info and Help modes, and that people actually customize
>> those, but anyway. Wrappers would be a new API, which all require at least some
>> documentation etc.
>
> Actually adding new arguments to existing functions counts as changing API.
Yes, but I have added just an optional argument at the end which shouldn't break
anything, right? I ment to document 'window' in the function doc but I forgott,
remembered after your mail last night :).
> Whereas not changing existing functions means keeping the current API unchanged.
> Since you need to bind commands to new keys anyway, there is no difference
> whether you bind old commands or new other-window commands.
I have introduced four new commands where I couldn't do otherwise. But I didn't
want to duplicate all commands by wrapping. There is problem of documentation, people
wondering why they are duplicate similar functions, more commands in Emacs, and
in non-trivial examples it is not possible to just "wrap" stuff in
with-selected-window anyway. I think doing it properly from the beginning and
adapting stuff under the hood without changing the API or visible commands is a
better alternative.
>> Can you control on which frame the input goes when prompted by original
>> function with a wrapper approach? I changed quite few prompts a wrapped stuff
>> with both with-current-buffer, and with-selected-frame to achive that. I don't
>> think I could do that if I wrapped stuff. But what do I know, perhaps there is
>> some way?
>
> I see that you added with-selected-frame to Info-index.
> 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. The reasoning was like this:
There are (possibly) two frames: "the user frame", one whith some other buffer and
possibly on other frame than info, and "the info frame". We need to switch
potential prompts that ask user for the input from info frame to the user frame,
and execute the effects of the command on info buffer. We don't want to switch
frames and user selected window, that is the point of the patch. If user wish to
switch to info frame, they can do so already, as they would do pre-patch. At
least that was my reasoning for the patch.
> Since neither with-selected-window nor with-selected-frame
> can switch focus, we could add a new macro like
>
> #+begin_src emacs-lisp
> (defmacro with-selected-window-frame (window &rest body)
> `(let ((frame (window-frame ,window)))
> (unless (eq frame (selected-frame))
> (select-frame frame 'norecord)
> (select-frame-set-input-focus frame 'norecord))
> (with-selected-window ,window
> ,@body)))
> #+end_src
>
>
> Then everything works nicely with
Have you tested *everything*? Interactively and from lisp?
> #+begin_src emacs-lisp
> (defun Info-index-other-window (topic)
> (interactive (with-selected-window-frame (info-window)
> (eval (cadr (interactive-form 'Info-index)))))
> (with-selected-window-frame (info-window)
> (Info-index topic)))
> #+end_src
That would be a different behaviour for *all commands* if you would to apply
that macro to all commands consistently, but I don't think that is what you
would want. In the end, I think you still have to go through each and every
command and do something different on the basis if you want to switch window
focus or not.
Otherwise, if you gonna leave focus in info window, then just introduce a simple
way to switch to info window, as I did with the "Info-jump" which I have removed
in this patch. I think the reasons to jump over are less due to being able to
create "connection" to an info window and use that as the default, without the
need to prompt the user or type the numeric prefix. It also works with window
created via "C-1/u m" which creates names based on chosen node for visit, for
example *info-Elisp* instead of *info<N>.
Notice that select-frame-set-input-focus won't move the mouse cursor, which
means that mouse will possible (not necessary) be left on the old frame. If a
user has, like I did, enabled "focus follow cursor" than depending on the window
manager user has, Emacs will be fighting for focus with the wm. Not all managers
respect X11 hints and requests.
Perhaps, you could save the frame that has the mouse cursor underneath and
restore it afterwards too when needed, or warp mouse just somewhere into the
info frame, and restore the position afterwards, but I wouldn't bother, that
sounds like more troubles then worth.
next prev parent reply other threads:[~2023-06-27 7:54 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 [this message]
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
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=AM9PR09MB4977EA084A010E4025FE03069627A@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).