unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#71971: 31.0.50; Add user option server-window-alist
@ 2024-07-06 11:06 Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-06 11:22 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-06 11:06 UTC (permalink / raw)
  To: 71971; +Cc: Jonas Bernoulli

Severity: wishlist

A new user option `server-window-alist' shall be added to server.el. Every
entry shall be of type (REGEXP . SERVER-WINDOW). REGEXP is used to filter
for the buffer's file name, and if it matches, SERVER-WINDOW shall be
applied. SERVER-WINDOW itself has the same type as the `server-window'
user option.

If no regexp matches, the value of user option `server-window' shall be
used.

This new user option is the same as the existing
`with-editor-server-window-alist' from package with-editor.el. Mid-term,
the former shall replace the latter.


In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.42, cairo version 1.18.0) of 2024-06-30 built on gandalf
Repository revision: c6a052f2fe53a26cdb0f3624a0b9af5201f3c487
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12401000
System Description: Fedora Linux 40 (Workstation Edition)

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LIBOTF LIBSELINUX LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8

Major mode: ELisp/l

Minor modes in effect:
  display-time-mode: t
  delete-selection-mode: t
  icomplete-mode: t
  global-goto-address-mode: t
  goto-address-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/albinus/src/elpa/packages/debbugs/debbugs hides /home/albinus/.emacs.d/elpa/debbugs-0.40/debbugs
/home/albinus/src/elpa/packages/debbugs/debbugs-org hides /home/albinus/.emacs.d/elpa/debbugs-0.40/debbugs-org
/home/albinus/src/elpa/packages/debbugs/debbugs-gnu hides /home/albinus/.emacs.d/elpa/debbugs-0.40/debbugs-gnu
/home/albinus/src/elpa/packages/debbugs/debbugs-guix hides /home/albinus/.emacs.d/elpa/debbugs-0.40/debbugs-guix
/home/albinus/src/elpa/packages/debbugs/debbugs-browse hides /home/albinus/.emacs.d/elpa/debbugs-0.40/debbugs-browse
/home/albinus/src/elpa/packages/debbugs/debbugs-pkg hides /home/albinus/.emacs.d/elpa/debbugs-0.40/debbugs-pkg
/home/albinus/src/elpa/packages/debbugs/debbugs-autoloads hides /home/albinus/.emacs.d/elpa/debbugs-0.40/debbugs-autoloads
/home/albinus/src/elpa/packages/debbugs/debbugs-compat hides /home/albinus/.emacs.d/elpa/debbugs-0.40/debbugs-compat
/home/albinus/.emacs.d/elpa/helm-3.9.9/helm-packages hides /home/albinus/.emacs.d/elpa/helm-core-3.9.9/helm-packages
~/lisp/telepathy hides /home/albinus/.emacs.d/elpa/telepathy-20131209.1258/telepathy
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-autoloads hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-autoloads
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme
/home/albinus/src/elpa/packages/tramp-theme/tramp-theme-pkg hides /home/albinus/.emacs.d/elpa/tramp-theme-0.2/tramp-theme-pkg
/home/albinus/.emacs.d/elpa/hydra-0.15.0/lv hides /home/albinus/.emacs.d/elpa/lv-0.15.0/lv
/home/albinus/.emacs.d/elpa/transient-20240626.947/transient hides /usr/local/share/emacs/31.0.50/lisp/transient
/home/albinus/.emacs.d/elpa/idlwave-6.5.1/idlwave hides /usr/local/share/emacs/31.0.50/lisp/progmodes/idlwave
/home/albinus/.emacs.d/elpa/idlwave-6.5.1/idlw-shell hides /usr/local/share/emacs/31.0.50/lisp/progmodes/idlw-shell
/home/albinus/.emacs.d/elpa/idlwave-6.5.1/idlw-toolbar hides /usr/local/share/emacs/31.0.50/lisp/progmodes/idlw-toolbar
/home/albinus/.emacs.d/elpa/idlwave-6.5.1/idlw-complete-structtag hides /usr/local/share/emacs/31.0.50/lisp/progmodes/idlw-complete-structtag
/home/albinus/.emacs.d/elpa/idlwave-6.5.1/idlw-help hides /usr/local/share/emacs/31.0.50/lisp/progmodes/idlw-help
~/lisp/dbus hides /usr/local/share/emacs/31.0.50/lisp/net/dbus
/home/albinus/src/tramp/lisp/tramp-sh hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-sh
/home/albinus/src/tramp/lisp/tramp-fuse hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-fuse
/home/albinus/src/tramp/lisp/tramp-androidsu hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-androidsu
/home/albinus/src/tramp/lisp/tramp-loaddefs hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-loaddefs
/home/albinus/src/tramp/lisp/tramp-ftp hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-ftp
/home/albinus/src/tramp/lisp/tramp hides /usr/local/share/emacs/31.0.50/lisp/net/tramp
/home/albinus/src/tramp/lisp/tramp-cache hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-cache
/home/albinus/src/tramp/lisp/tramp-uu hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-uu
/home/albinus/src/tramp/lisp/tramp-rclone hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-rclone
/home/albinus/src/tramp/lisp/tramp-integration hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-integration
/home/albinus/src/tramp/lisp/tramp-archive hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-archive
/home/albinus/src/tramp/lisp/tramp-adb hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-adb
/home/albinus/src/tramp/lisp/tramp-cmds hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-cmds
/home/albinus/src/tramp/lisp/tramp-compat hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-compat
/home/albinus/src/tramp/lisp/tramp-sudoedit hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-sudoedit
/home/albinus/src/tramp/lisp/tramp-container hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-container
/home/albinus/src/tramp/lisp/tramp-gvfs hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-gvfs
/home/albinus/src/tramp/lisp/tramp-crypt hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-crypt
/home/albinus/src/tramp/lisp/tramp-message hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-message
/home/albinus/src/tramp/lisp/tramp-smb hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-smb
/home/albinus/src/tramp/lisp/trampver hides /usr/local/share/emacs/31.0.50/lisp/net/trampver
/home/albinus/src/tramp/lisp/tramp-sshfs hides /usr/local/share/emacs/31.0.50/lisp/net/tramp-sshfs
/home/albinus/.emacs.d/elpa/faceup-20170925.1946/faceup hides /usr/local/share/emacs/31.0.50/lisp/emacs-lisp/faceup

Features:
(shadow warnings emacsbug mule-util display-line-numbers pulse vc-git
diff-mode track-changes easy-mmode find-dired xref project grep
dired-aux cl-print server help-fns radix-tree misearch multi-isearch
time-stamp url-http url-gw url-auth url-cache shr-color color compile
comp-run comp-common oc-basic org-element org-persist org-id org-refile
org-element-ast inline avl-tree generator ol-eww eww url-queue mm-url
ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect ol-docview doc-view
filenotify image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m ol-doi
org-link-doi org org-macro org-pcomplete org-list org-footnote org-faces
org-entities noutline outline ob-emacs-lisp org-table org-loaddefs
find-func cal-menu calendar cal-loaddefs flow-fill cl-extra sort smiley
gnus-cite mm-archive mail-extr gnus-bcklg textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check gnus-async qp
gnus-ml debbugs-browse bug-reference disp-table pop3 nndraft nnmh
network-stream nsm nnml gnus-agent gnus-srvr gnus-score score-mode
nnvirtual gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime gnutls
dig gnus-cache gnus-sum shr pixel-fill kinsoku url-file svg dom nnnil
nntp gnus-group gnus-undo smtpmail gnus-start gnus-dbus dbus xml
gnus-cloud nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int
gnus-range message sendmail yank-media puny rfc822 mml mml-sec epa
derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader
gnus-win gnus nnheader gnus-util text-property-search mail-utils range
mm-util mail-prsvr face-remap ob-shell ob ob-tangle ol org-src sh-script
smie treesit executable ob-ref ob-lob ob-table ob-exp ob-comint ob-core
org-cycle org-fold org-fold-core ob-eval org-keys oc org-compat
org-version org-macs vc vc-dispatcher time tramp-sh lxc-tramp lxd-tramp
tramp trampver tramp-integration files-x tramp-message help-mode
tramp-compat xdg shell pcomplete comint ansi-osc ring parse-time iso8601
time-date format-spec ansi-color tramp-loaddefs rx delsel ido jka-compr
icomplete cus-edit pp cus-load wid-edit dired dired-loaddefs goto-addr
thingatpt alert-autoloads android-mode-autoloads
auth-source-gopass-autoloads auth-source-keytar-autoloads
auth-source-kwallet-autoloads auth-source-xoauth2-autoloads
auto-sudoedit-autoloads auto-virtualenv-autoloads
auto-virtualenvwrapper-autoloads boxquote-autoloads
clang-format-autoloads company-shell-autoloads company-autoloads
counsel-toki-autoloads counsel-tramp-autoloads counsel-autoloads
dbus-codegen-autoloads debbugs-autoloads dired-du-autoloads
dired-rsync-autoloads dired-toggle-sudo-autoloads direnv-autoloads
disk-usage-autoloads dockerfile-mode-autoloads drepl-autoloads
comint-mime-autoloads editorconfig-charset-extras-autoloads
editorconfig-custom-majormode-autoloads
editorconfig-domain-specific-autoloads editorconfig-generate-autoloads
ednc-autoloads el-get-autoloads envrc-autoloads
etc-sudoers-mode-autoloads exec-path-from-shell-autoloads
faceup-autoloads fontaine-autoloads forge-autoloads closql-autoloads
emacsql-autoloads friendly-tramp-path-autoloads fzf-autoloads
ggtags-autoloads ghub-autoloads gited-autoloads
gitlab-ci-mode-flycheck-autoloads gitlab-ci-mode-autoloads
flycheck-autoloads gntp-autoloads helm-gitlab-autoloads
helm-projectile-autoloads helm-autoloads helm-core-autoloads
async-autoloads ibuffer-tramp-autoloads idlwave-autoloads
inheritenv-autoloads ivy-gitlab-autoloads gitlab-autoloads
journalctl-mode-autoloads keepass-mode-autoloads keytar-autoloads
kubernetes-autoloads log4e-autoloads lsp-java-autoloads
dap-mode-autoloads lsp-docker-autoloads bui-autoloads
lsp-latex-autoloads consult-autoloads lsp-treemacs-autoloads
lsp-mode-autoloads f-autoloads lxc-tramp-autoloads lxd-tramp-autoloads
magit-filenotify-autoloads magit-autoloads pcase git-commit-autoloads
magit-popup-autoloads magit-section-autoloads marcopolo-autoloads
mastodon-autoloads nexus-autoloads oauth2-autoloads
ob-restclient-autoloads orderless-autoloads password-menu-autoloads
persist-autoloads pkg-info-autoloads epl-autoloads popup-autoloads
projectile-autoloads promise-autoloads pylint-autoloads
python-environment-autoloads deferred-autoloads pyvenv-autoloads
recentf-remove-sudo-tramp-prefix-autoloads request-autoloads
restclient-test-autoloads restclient-autoloads s3ed-autoloads
shell-maker-autoloads finder-inf slime-autoloads macrostep-autoloads
spinner-autoloads ssh-deploy-autoloads su-autoloads sudo-edit-autoloads
sudo-ext-autoloads sudo-utils-autoloads swiper-autoloads ivy-autoloads
sx-autoloads markdown-mode-autoloads telepathy-autoloads totp-autoloads
totp-auth-autoloads base32-autoloads tramp-nspawn-autoloads
tramp-theme-autoloads transient-dwim-autoloads transient-autoloads
treemacs-autoloads cfrs-autoloads posframe-autoloads ht-autoloads
pfuture-autoloads ace-window-autoloads avy-autoloads treepy-autoloads
uuid-autoloads vdiff-autoloads hydra-autoloads lv-autoloads
vertico-autoloads virtualenv-autoloads virtualenvwrapper-autoloads
s-autoloads dash-autoloads web-server-autoloads wfnames-autoloads info
with-editor-autoloads yaml-autoloads yaml-mode-autoloads package
browse-url url url-proxy url-privacy url-expand url-methods url-history
url-cookie generate-lisp-file url-domsuf url-util mailcap url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs icons
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset
image regexp-opt fringe tabulated-list replace newcomment text-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo gtk
x-toolkit xinput2 x multi-tty move-toolbar make-network-process
native-compile emacs)

Memory information:
((conses 16 1748804 228839)
 (symbols 48 31304 4)
 (strings 32 249486 10542)
 (string-bytes 1 13799666)
 (vectors 16 90231)
 (vector-slots 8 1118851 332769)
 (floats 8 635 8034)
 (intervals 56 143328 285)
 (buffers 992 37))





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-06 11:06 bug#71971: 31.0.50; Add user option server-window-alist Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-06 11:22 ` Eli Zaretskii
  2024-07-06 11:58   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-06 14:16   ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii @ 2024-07-06 11:22 UTC (permalink / raw)
  To: Michael Albinus; +Cc: jonas, 71971

> Cc: Jonas Bernoulli <jonas@bernoul.li>
> Date: Sat, 06 Jul 2024 13:06:57 +0200
> From:  Michael Albinus via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> A new user option `server-window-alist' shall be added to server.el. Every
> entry shall be of type (REGEXP . SERVER-WINDOW). REGEXP is used to filter
> for the buffer's file name, and if it matches, SERVER-WINDOW shall be
> applied. SERVER-WINDOW itself has the same type as the `server-window'
> user option.
> 
> If no regexp matches, the value of user option `server-window' shall be
> used.
> 
> This new user option is the same as the existing
> `with-editor-server-window-alist' from package with-editor.el. Mid-term,
> the former shall replace the latter.

Is it possible to describe the typical use cases which this option
targets?  Given that client frames/windows are not meant for specific
buffers (IOW, a client frame/window can be used for editing several
buffers), what kind of workflow will benefit from this option?

(And please don't say "the same cases as those where server-window is
useful", because I don't understand its usefulness, either.)

Thanks.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-06 11:22 ` Eli Zaretskii
@ 2024-07-06 11:58   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-06 14:16   ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 12+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-06 11:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: jonas, 71971

Eli Zaretskii <eliz@gnu.org> writes:

Hi Eli,

>> A new user option `server-window-alist' shall be added to server.el. Every
>> entry shall be of type (REGEXP . SERVER-WINDOW). REGEXP is used to filter
>> for the buffer's file name, and if it matches, SERVER-WINDOW shall be
>> applied. SERVER-WINDOW itself has the same type as the `server-window'
>> user option.
>>
>> If no regexp matches, the value of user option `server-window' shall be
>> used.
>>
>> This new user option is the same as the existing
>> `with-editor-server-window-alist' from package with-editor.el. Mid-term,
>> the former shall replace the latter.
>
> Is it possible to describe the typical use cases which this option
> targets?  Given that client frames/windows are not meant for specific
> buffers (IOW, a client frame/window can be used for editing several
> buffers), what kind of workflow will benefit from this option?
>
> (And please don't say "the same cases as those where server-window is
> useful", because I don't understand its usefulness, either.)

I would let this to Jonas. Perhaps a short description which would be
good for "(emacs) Invoking emacsclient".

> Thanks.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-06 11:22 ` Eli Zaretskii
  2024-07-06 11:58   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-06 14:16   ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-06 14:47     ` Eli Zaretskii
  1 sibling, 1 reply; 12+ messages in thread
From: Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-06 14:16 UTC (permalink / raw)
  To: Eli Zaretskii, Michael Albinus; +Cc: 71971

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: Jonas Bernoulli <jonas@bernoul.li>
>> Date: Sat, 06 Jul 2024 13:06:57 +0200
>> From:  Michael Albinus via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> 
>> A new user option `server-window-alist' shall be added to server.el. Every
>> entry shall be of type (REGEXP . SERVER-WINDOW). REGEXP is used to filter
>> for the buffer's file name, and if it matches, SERVER-WINDOW shall be
>> applied. SERVER-WINDOW itself has the same type as the `server-window'
>> user option.
>> 
>> If no regexp matches, the value of user option `server-window' shall be
>> used.
>> 
>> This new user option is the same as the existing
>> `with-editor-server-window-alist' from package with-editor.el. Mid-term,
>> the former shall replace the latter.
>
> Is it possible to describe the typical use cases which this option
> targets?  Given that client frames/windows are not meant for specific
> buffers (IOW, a client frame/window can be used for editing several
> buffers), what kind of workflow will benefit from this option?
>
> (And please don't say "the same cases as those where server-window is
> useful", because I don't understand its usefulness, either.)

It is possible for the same person to want the behavior to be different
in different situations.

I, for example, generally prefer switch-to-buffer-other-frame.  If I
invoke "emacsclient" multiple times, then I don't want the same
frame/window to be reused. I want a new frame for each invocation, so
that I can think of them as "dialogues" that can be handled individually
and not necessarily in order.  Using dedicated frames helps with that.

Other people might feel the same way and use the same value for
server-window -- after all it is one of the suggested values.

Usually I only edit one file via emacsclient at a time.  That file most
often has absolutely nothing to do with whatever else is happening in
the emacs instance it connects to.  Basically I want emacsclient to
behave as much like another emacs instance as possible.  If not for the
startup time, I would actually use a new instance to guarantee a clean
slate.  Using a new frame is both a good enough alternative to full
separation and the absolute minimal amount of separation I in such
cases.

However, when creating a commit from within Emacs using Magit, then the
situation is different.  Many users do not even realize that this
involves the use of $EDITOR=emacsclient.  And indeed it doesn't have to
be implemented that way.  Magit's commit command could instead create
a buffer to write the message itself and once the user indicates that
they are done, it would call "git commit -m (buffer-string)".

Especially if the latter is one's mental modal of what happens when
creating a commit, and one generally doesn't create many frames and
instead relies on buffer switching inside existing frame(s), then it
would be surprising if a new frame were created.  And even I who knows
what is going on and generally rely heavily on short-lived frames, would
not want a new frame to popup in this case.

I common sequence of tasks would be.
1. Edit file.
2. Bring up Magit status buffer.  The status buffer is displayed in the
   window previously displaying the file-visiting buffer.
3. Stage all or some of the changes.
4. Invoke the commit command.

At this point one would expect the commit command to behave the same as
the show-status command.  The current buffer is replaced with the new
"dialog like" buffer.  But if one configured server-window as I have
described above, to handle a completely different situation to one's
liking, then that is not what would happen.

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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-06 14:16   ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-06 14:47     ` Eli Zaretskii
  2024-07-08 17:41       ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2024-07-06 14:47 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: michael.albinus, 71971

> From: Jonas Bernoulli <jonas@bernoul.li>
> Cc: 71971@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"?  IOW,
what you describe involves workflows some of which want a new client
frame and some want to reuse the same frame.

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?  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?

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.
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.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-06 14:47     ` Eli Zaretskii
@ 2024-07-08 17:41       ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-08 17:56         ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-08 17:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael.albinus, 71971

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Jonas Bernoulli <jonas@bernoul.li>
>> Cc: 71971@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".





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-08 17:41       ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-08 17:56         ` Eli Zaretskii
  2024-07-09 19:05           ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2024-07-08 17:56 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: michael.albinus, 71971

> From: Jonas Bernoulli <jonas@bernoul.li>
> Cc: michael.albinus@gmx.de, 71971@debbugs.gnu.org
> Date: Mon, 08 Jul 2024 19:41:16 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> >> From: Jonas Bernoulli <jonas@bernoul.li>
> >> Cc: 71971@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?

The user, of course.  But see below.

> Where?

In the system's or shell's init files, depending on the system and the
user's needs.

> 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

"New"? AFAICT, it exists since Emacs 23.1, i.e. for the last 15 years.

> 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.

Agreed.

> That being said, maybe adding switch-to-buffer-new-frame wouldn't be
> such a bad idea.

I'm quite sure you can have that already by using a suitable
display-buffer-alist.  All you want is to force
switch-to-buffer-other-frame always create a new frame.

> > 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.

Takes care how? what do you use for REGEXP?

> > 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?

No, the protocol between emacsclient and the server.  So that the
client could tell the server how to create/reuse frames in a more
flexible manner than what we have now.

> 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".

I meant to use environment variables only if the preference to reuse
an existing frame when editing commit log messages for Git is a
globally fixed preference for the user.  In any other case,
environment variables are not a good means, because they have global
effect and are by default inherited by child processes.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-08 17:56         ` Eli Zaretskii
@ 2024-07-09 19:05           ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-10 11:35             ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-09 19:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael.albinus, 71971

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Jonas Bernoulli <jonas@bernoul.li>
>> Cc: michael.albinus@gmx.de, 71971@debbugs.gnu.org
>> Date: Mon, 08 Jul 2024 19:41:16 +0200
>> 
>> Eli Zaretskii <eliz@gnu.org> writes:
>> 
>> >> From: Jonas Bernoulli <jonas@bernoul.li>
>> >> Cc: 71971@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?
>
> The user, of course.  But see below.
>
>> Where?
>
> In the system's or shell's init files, depending on the system and the
> user's needs.

[[[ Re-reading the message I am responding to, I realize that you are
already aware of what I am about to say:

> I meant to use environment variables only if the preference to reuse
> an existing frame when editing commit log messages for Git is a
> globally fixed preference for the user.

I am leaving it in my response anyway, to make it a bit more explicit.
]]]

The fault line isn't between "creating a Git commit" and "everything
else that uses $EDITOR".

If I type "git commit" in a terminal, then I want a new frame to popup
instead of the frame being reused in which I am writing this email.

If I have staged changes to Emacs in the Magit status buffer for that
repository and then invoke Magit's command for creating a commit, then
I do want that frame to be used to write the commit message.

Only being able to define the behavior globally is exactly what is not
desirable and taking advantage of the fact that Git allows overriding
$EDITOR for Git by using $GIT_EDITOR instead, does not solve that
problem.

(with-editor.el also fails to solve that problem either, but that's not
what we are discussing here.)

>
>> 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
>
> "New"? AFAICT, it exists since Emacs 23.1, i.e. for the last 15 years.

Ah sorry, it is "-r"/"--reuse-frame" that was added in Emacs 29.1.  The
evidence thickens that I should/could just have used "emacsclient -c".

I was only trying to reconstruct why I have made the decision to add
`with-editor-server-window-alist' back when I did that.  It's possible
that I didn't realize back then that I could have used "-c" instead.
Or it is possible, that I had some good (or otherwise) reason not to
do it despite knowing about that 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.
>
> Agreed.
>
>> That being said, maybe adding switch-to-buffer-new-frame wouldn't be
>> such a bad idea.
>
> I'm quite sure you can have that already by using a suitable
> display-buffer-alist.  All you want is to force
> switch-to-buffer-other-frame always create a new frame.

I made that suggestion in response to you writing:

> 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.

I tough you were saying "there is no way to trivially say 'give me a new
frame' (so users have to use a mechanism that is to complex for many of
them)" and responded by saying "we could make it trivial by making
switch-to-buffer-new-frame available".

>> > 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.
>
> Takes care how? what do you use for REGEXP?

It adds an entry to with-editor-server-window-alist (which due to an
advice takes precedence over window-alist), using this regexp:

"/\\(\
\\(\\(COMMIT\\|NOTES\\|PULLREQ\\|MERGEREQ\\|TAG\\)_EDIT\\|MERGE_\\|\\)MSG\
\\|\\(BRANCH\\|EDIT\\)_DESCRIPTION\\)\\'"

>> > 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?
>
> No, the protocol between emacsclient and the server.  So that the
> client could tell the server how to create/reuse frames in a more
> flexible manner than what we have now.

I still don't understand what kind of suggestion you are looking for.

Without looking up commonly accepted definitions of the term "protocol",
I assume(d) that you either meant:

1. The mechanism by which two or more entities exchange information,
   and/or
2. The kind of values and/or concrete values/"commands", that can be
   exchanged over said channel.

You also said,

> Other ideas are welcome.

So for (1) I suggested "environment variables" and for (2)
"implement switch-to-buffer-new-frame".

I'm not saying those are necessarily good suggestions, but that is what
came to mind, and they seem at least applicable and should be mentioned
in the idea collection phase.

>> 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".
>
> I meant to use environment variables only if the preference to reuse
> an existing frame when editing commit log messages for Git is a
> globally fixed preference for the user.  In any other case,
> environment variables are not a good means, because they have global
> effect and are by default inherited by child processes.

Environment variables do _not_ have global effect per se, i.e., unless
they are set in the global environment.  Magit essentially calls

  EDITOR="emacsclient [...]" git commit

That $EDITOR only affects this one "git" invocation and its children.

If the "protocol" could be extended to pass along other preferences,
that would be useful (and it was my impression that you requested input
on how that could be done).  Environment variables could be used, as
could new arguments

  SERVER_WINDOW=switch-to-buffer-new-frame EDITOR=emacsclient git commit

or

  EDITOR="emacsclient --server-window=switch-to-buffer-new-frame" git commit

Of course if the only choices we care about are "--create-frame" and
"--reuse-frame", well, these already exist.

[[[Side-note: And these are actually the only choices *I* have come
to care about.  So I am not particularly interested, in making other
choices available anymore.  This limited interest likely affect the
quality of my suggestions.]]]

But you said

> 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.

I.e., "having the choice between -c/-r/-t is not enough".  In this
context my suggestion to support --server-window=SENSIBLE-FUNCTION
continues to make sense to me.

I guess it's this part that is too vague for me:

> ... depending on some predictably-deterministic attribute ...

because, to me, command-line arguments, environment variables and
server-window-alist all satisfy this requirement, i.e., they are
channels that could be used to "communicate" that "attribute".





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-09 19:05           ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-10 11:35             ` Eli Zaretskii
  2024-07-10 16:32               ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2024-07-10 11:35 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: michael.albinus, 71971

> From: Jonas Bernoulli <jonas@bernoul.li>
> Cc: michael.albinus@gmx.de, 71971@debbugs.gnu.org
> Date: Tue, 09 Jul 2024 21:05:03 +0200
> 
> The fault line isn't between "creating a Git commit" and "everything
> else that uses $EDITOR".
> 
> If I type "git commit" in a terminal, then I want a new frame to popup
> instead of the frame being reused in which I am writing this email.
> 
> If I have staged changes to Emacs in the Magit status buffer for that
> repository and then invoke Magit's command for creating a commit, then
> I do want that frame to be used to write the commit message.
> 
> Only being able to define the behavior globally is exactly what is not
> desirable and taking advantage of the fact that Git allows overriding
> $EDITOR for Git by using $GIT_EDITOR instead, does not solve that
> problem.

One way of solving this is to set $EDITOR outside Emacs, and set
$GIT_EDITOR in process-environment inside Emacs.

> > I'm quite sure you can have that already by using a suitable
> > display-buffer-alist.  All you want is to force
> > switch-to-buffer-other-frame always create a new frame.
> 
> I made that suggestion in response to you writing:
> 
> > 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.
> 
> I tough you were saying "there is no way to trivially say 'give me a new
> frame' (so users have to use a mechanism that is to complex for many of
> them)" and responded by saying "we could make it trivial by making
> switch-to-buffer-new-frame available".

What I meant that it's impossible using the server-window like
options.

> >> > 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.
> >
> > Takes care how? what do you use for REGEXP?
> 
> It adds an entry to with-editor-server-window-alist (which due to an
> advice takes precedence over window-alist), using this regexp:
> 
> "/\\(\
> \\(\\(COMMIT\\|NOTES\\|PULLREQ\\|MERGEREQ\\|TAG\\)_EDIT\\|MERGE_\\|\\)MSG\
> \\|\\(BRANCH\\|EDIT\\)_DESCRIPTION\\)\\'"

That's exactly what I thought: to do something like that the user
needs to know the possible names of files created by Git (and other
VCSes) for editing log messages.  Many/most people don't know that,
and so will have trouble customizing such options.  IOW, the REGEXP
part makes this option work on a very low level, and thus less
friendly than it could be.

> >> > 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?
> >
> > No, the protocol between emacsclient and the server.  So that the
> > client could tell the server how to create/reuse frames in a more
> > flexible manner than what we have now.
> 
> I still don't understand what kind of suggestion you are looking for.

How does server.el know whether to create a new client frame or reuse
the current one, and what kind of frame to create?  Answer:
emacsclient tells it, via the appropriate commands that are part of
the emacs server to emacsclient protocol.  The protocol is documented
in the doc string of server-process-filter.  In particular, the
command -current-frame tells the server not to create new frames; -tty
tells it to create a TTY frame; etc.

> > I meant to use environment variables only if the preference to reuse
> > an existing frame when editing commit log messages for Git is a
> > globally fixed preference for the user.  In any other case,
> > environment variables are not a good means, because they have global
> > effect and are by default inherited by child processes.
> 
> Environment variables do _not_ have global effect per se, i.e., unless
> they are set in the global environment.  Magit essentially calls
> 
>   EDITOR="emacsclient [...]" git commit
> 
> That $EDITOR only affects this one "git" invocation and its children.

That's unportable.  On some systems, environment variables will be
inherited by subprocesses of "git commit".

> If the "protocol" could be extended to pass along other preferences,
> that would be useful (and it was my impression that you requested input
> on how that could be done).  Environment variables could be used, as
> could new arguments
> 
>   SERVER_WINDOW=switch-to-buffer-new-frame EDITOR=emacsclient git commit
> 
> or
> 
>   EDITOR="emacsclient --server-window=switch-to-buffer-new-frame" git commit
> 
> Of course if the only choices we care about are "--create-frame" and
> "--reuse-frame", well, these already exist.
> 
> [[[Side-note: And these are actually the only choices *I* have come
> to care about.  So I am not particularly interested, in making other
> choices available anymore.  This limited interest likely affect the
> quality of my suggestions.]]]
> 
> But you said
> 
> > 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.
> 
> I.e., "having the choice between -c/-r/-t is not enough".  In this
> context my suggestion to support --server-window=SENSIBLE-FUNCTION
> continues to make sense to me.
> 
> I guess it's this part that is too vague for me:
> 
> > ... depending on some predictably-deterministic attribute ...
> 
> because, to me, command-line arguments, environment variables and
> server-window-alist all satisfy this requirement, i.e., they are
> channels that could be used to "communicate" that "attribute".

Not when commands (such as emacsclient) are invoked from Emacs by Lisp
programs.  In that case, it is the Lisp program that must decide which
command-line switches of emacsclient to use, and my bothr is how to
let users specify that in a way that is both powerful and flexible,
and user-friendly.  Using regexps that match files or buffers is not
user-friendly enough to my palate in this case.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-10 11:35             ` Eli Zaretskii
@ 2024-07-10 16:32               ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-10 18:02                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 12+ messages in thread
From: Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-10 16:32 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: michael.albinus, 71971

Thanks for the clarifications, I understand better now and agree its
a worthwhile goal.  Unfortunately I have no idea how to do it, but I
look forward to see what you and others come up with.  I can't think
of anything myself, for now at least.

Cheers!





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-10 16:32               ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-10 18:02                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-07-19 16:45                   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-10 18:02 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: Eli Zaretskii, 71971

Jonas Bernoulli <jonas@bernoul.li> writes:

Hi,

> Thanks for the clarifications, I understand better now and agree its
> a worthwhile goal.  Unfortunately I have no idea how to do it, but I
> look forward to see what you and others come up with.  I can't think
> of anything myself, for now at least.

What I could imagine is, that emacsclient gets the option to send an
identification, a string, to the server. With this, on the server side,
a set of preferences (variables) could be set for a given
identification, which matches a regexp. Not only for server-window, but
any variable. This would look like

((REGEXP (VAR . VALUE) .. (VAR . VALUE))
 (REGEXP (VAR . VALUE) .. (VAR . VALUE))
 ...)

Any VAR, like server-window, would use its related VALUE, which has
precedence.

Packages, like magit, could prepare such preferences, and activate if
the corresponding emacsclient sends an identification which matches a
regexp. User could prepare their own preferences, and invoke emacsclient
with their private identification, like 'emacsclient --ident="my-identification"'.

On protocol level between emacsclient and server.el, we would need a new
command '-ident'. Or, if we must be backwards compatible, we could use
'eval' to set it, or we could use a special formatted '-comment'.

This doesn't say which variables we recommend to use for
preferences. Just a mean to communicate between emacsclient and
server.el.

> Cheers!

Best regards, Michael.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#71971: 31.0.50; Add user option server-window-alist
  2024-07-10 18:02                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-07-19 16:45                   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 0 replies; 12+ messages in thread
From: Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-07-19 16:45 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: Eli Zaretskii, 71971

Michael Albinus <michael.albinus@gmx.de> writes:

Hi,

> What I could imagine is, that emacsclient gets the option to send an
> identification, a string, to the server. With this, on the server side,
> a set of preferences (variables) could be set for a given
> identification, which matches a regexp. Not only for server-window, but
> any variable. This would look like
>
> ((REGEXP (VAR . VALUE) .. (VAR . VALUE))
>  (REGEXP (VAR . VALUE) .. (VAR . VALUE))
>  ...)
>
> Any VAR, like server-window, would use its related VALUE, which has
> precedence.
>
> Packages, like magit, could prepare such preferences, and activate if
> the corresponding emacsclient sends an identification which matches a
> regexp. User could prepare their own preferences, and invoke emacsclient
> with their private identification, like 'emacsclient --ident="my-identification"'.
>
> On protocol level between emacsclient and server.el, we would need a new
> command '-ident'. Or, if we must be backwards compatible, we could use
> 'eval' to set it, or we could use a special formatted '-comment'.
>
> This doesn't say which variables we recommend to use for
> preferences. Just a mean to communicate between emacsclient and
> server.el.

Unfortunately, no reaction yet. I'm undecided whether we shall go this way.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2024-07-19 16:45 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-06 11:06 bug#71971: 31.0.50; Add user option server-window-alist Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-06 11:22 ` Eli Zaretskii
2024-07-06 11:58   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-06 14:16   ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-06 14:47     ` Eli Zaretskii
2024-07-08 17:41       ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-08 17:56         ` Eli Zaretskii
2024-07-09 19:05           ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-10 11:35             ` Eli Zaretskii
2024-07-10 16:32               ` Jonas Bernoulli via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-10 18:02                 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-19 16:45                   ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).