Package: emacs;
Reported by: Michael Albinus <michael.albinus <at> gmx.de>
Date: Sat, 6 Jul 2024 11:08:01 UTC
Severity: wishlist
Found in version 31.0.50
View this message in rfc822 format
From: Jonas Bernoulli <jonas <at> bernoul.li> To: Eli Zaretskii <eliz <at> gnu.org> Cc: michael.albinus <at> gmx.de, 71971 <at> debbugs.gnu.org Subject: bug#71971: 31.0.50; Add user option server-window-alist Date: Mon, 08 Jul 2024 19:41:16 +0200
Eli Zaretskii <eliz <at> gnu.org> writes: >> From: Jonas Bernoulli <jonas <at> bernoul.li> >> Cc: 71971 <at> debbugs.gnu.org >> Date: Sat, 06 Jul 2024 16:16:21 +0200 >> >> So in summary, it is possible for the same person to want the behavior >> to be different in different situations. The fact that "committing from >> Emacs using Magit" involves the use of emacsclient, just like "quickly >> edit a file from the terminal" does, is an implementation detail, and >> should not make it necessary for the user to decide which use-case >> should be optimized to their liking, at the cost of undesirable behavior >> in the other case. > > That sounds to me like the value of $EDITOR should be "emacsclient -c" > whereas the value of $GIT_EDITOR should be just "emacsclient"? Who would set those variables to those values? Where? --- I am beginning to think that at least for Magit's needs the new --create-frame is sufficient. It could just call EDITOR="emacsclient -c" git commit Unfortunately that's a fairly new argument, so with-editor will have to keep providing an alternative. But when it comes to the question of whether server-window-alist should be added to future Emacs releases, that isn't a concern. I understand your hesitancy to add such a variable. I am not sure it is necessary anymore either. > IOW, > what you describe involves workflows some of which want a new client > frame and some want to reuse the same frame. Yes. > But the server-window variable and the proposed server-window-alist > are about having certain _buffers_ display in certain _windows_. It > is not even possible to express the "give me a new frame" preference, > because the only frame you can mention in the value is an existing > frame, and I very much doubt that "normal" users will know how to > express even a specific frame there, with the sole exception of the > selected one. So, AFAICT, to support the two varieties you described, > users will almost always need to write a function and put it into the > alist elements' SERVER-WINDOW slots, is that right? Oh, I see, there's no switch-to-buffer-new-frame, just switch-to-buffer-other-frame. So I think what happened is that "committing from Magit" needed a way the override a universal user preference of "something other than the default of server-window=nil" to go back to "server-window=nil". And then implemented it in a way that could potentially be useful for other packages, without realizing that other pieces that would make that actually useful (such as the new-frame function) weren't actually available. As I said before, had --create-frame been available, I would probably have used that. That being said, maybe adding switch-to-buffer-new-frame wouldn't be such a bad idea. > And what will > they use for the REGEXP part? are they supposed to know by heart the > names of temporary files Git and other VCSes use for editing commit > messages? Well no, Magit takes care of that, and so could VC. Other packages could also add their package-specific defaults to the alist. Users could edit these elements. Users could also express their own preferences for specific files that they want to handle differently, and whose names they are well aware of. I don't know whether anyone would want that. I am not doing it. As I said, I might have over generalized it and added a feature nobody actually uses. > My conclusion is that if we want to support the above workflows, we > need a more user-friendly feature, using which users will be able to > easily control the server's frame-creation behavior depending on some > predictably-deterministic attribute of the connection or the client. Now that we have not only --tty and --reuse-frame but also --create-frame, I personally don't need anything more. But that of course doesn't mean that I cannot imagine that others (including future me) might not want more options. It's worth considering what else could be offered. > One possibility would be to add a new protocol command telling > server.el how to create/reuse frames, and then tell users to set > $EDITOR and similar variables to invoke that command via the > emacsclient command-line arguments. Other ideas are welcome. I'm not sure what you mean by "protocol". More arguments? You mention environment variables. If I remember correctly, I did experiment with that, but ran into the problem that while it was possible to pass along additional environment variables when using "emacsclient --tty", the same was not possible when using "emacsclient --create-frame".
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.