update packages

This commit is contained in:
2025-03-11 21:14:26 +01:00
parent 45d49daef0
commit 14dcaaddde
440 changed files with 13229 additions and 8718 deletions

View File

@@ -1,12 +1,12 @@
(define-package "with-editor" "20230917.958" "Use the Emacsclient as $EDITOR"
'((emacs "25.1")
(compat "29.1.4.1"))
:commit "fcd186d1e684c2dca6497c89af77b27b2b036c11" :authors
'(("Jonas Bernoulli" . "jonas@bernoul.li"))
(define-package "with-editor" "20241201.1419" "Use the Emacsclient as $EDITOR"
'((emacs "26.1")
(compat "30.0.0.0"))
:commit "ca902ae02972bdd6919a902be2593d8cb6bd991b" :authors
'(("Jonas Bernoulli" . "emacs.with-editor@jonas.bernoulli.dev"))
:maintainers
'(("Jonas Bernoulli" . "jonas@bernoul.li"))
'(("Jonas Bernoulli" . "emacs.with-editor@jonas.bernoulli.dev"))
:maintainer
'("Jonas Bernoulli" . "jonas@bernoul.li")
'("Jonas Bernoulli" . "emacs.with-editor@jonas.bernoulli.dev")
:keywords
'("processes" "terminals")
:url "https://github.com/magit/with-editor")

View File

@@ -1,13 +1,13 @@
;;; with-editor.el --- Use the Emacsclient as $EDITOR -*- lexical-binding:t -*-
;; Copyright (C) 2014-2023 The Magit Project Contributors
;; Copyright (C) 2014-2024 The Magit Project Contributors
;; Author: Jonas Bernoulli <jonas@bernoul.li>
;; Author: Jonas Bernoulli <emacs.with-editor@jonas.bernoulli.dev>
;; Homepage: https://github.com/magit/with-editor
;; Keywords: processes terminals
;; Package-Version: 3.3.2
;; Package-Requires: ((emacs "25.1") (compat "29.1.4.1"))
;; Package-Version: 3.4.3
;; Package-Requires: ((emacs "26.1") (compat "30.0.0.0"))
;; SPDX-License-Identifier: GPL-3.0-or-later
@@ -86,8 +86,6 @@
(declare-function dired-get-filename "dired"
(&optional localp no-error-if-not-filep))
(declare-function term-emulate-terminal "term" (proc str))
(declare-function vterm-send-return "vterm" ())
(declare-function vterm-send-string "vterm" (string &optional paste-p))
(defvar eshell-preoutput-filter-functions)
(defvar git-commit-post-finish-hook)
(defvar vterm--process)
@@ -113,24 +111,29 @@ Determining an Emacsclient executable suitable for the
current Emacs instance failed. For more information
please see https://github.com/magit/magit/wiki/Emacsclient."))))
(defvar with-editor-emacsclient-program-suffixes
(list "-snapshot" ".emacs-snapshot")
"Suffixes to append to append when looking for a Emacsclient executables.")
(defun with-editor-locate-emacsclient-1 (path depth)
(let* ((version-lst (cl-subseq (split-string emacs-version "\\.") 0 depth))
(version-reg (concat "^" (mapconcat #'identity version-lst "\\."))))
(version-reg (concat "^" (string-join version-lst "\\."))))
(or (locate-file
(cond ((equal (downcase invocation-name) "remacs")
"remacsclient")
((bound-and-true-p emacsclient-program-name))
("emacsclient"))
path
(cl-mapcan
(lambda (v) (cl-mapcar (lambda (e) (concat v e)) exec-suffixes))
(nconc (and (boundp 'debian-emacs-flavor)
(list (format ".%s" debian-emacs-flavor)))
(cl-mapcon (lambda (v)
(setq v (mapconcat #'identity (reverse v) "."))
(list v (concat "-" v) (concat ".emacs" v)))
(reverse version-lst))
(list "" "-snapshot" ".emacs-snapshot")))
(mapcan (lambda (v) (cl-mapcar (lambda (e) (concat v e)) exec-suffixes))
(nconc (and (boundp 'debian-emacs-flavor)
(list (format ".%s" debian-emacs-flavor)))
(cl-mapcon (lambda (v)
(setq v (string-join (reverse v) "."))
(list v
(concat "-" v)
(concat ".emacs" v)))
(reverse version-lst))
(cons "" with-editor-emacsclient-program-suffixes)))
(lambda (exec)
(ignore-errors
(string-match-p version-reg
@@ -415,11 +418,15 @@ And some tools that do not handle $EDITOR properly also break."
(define-minor-mode with-editor-mode
"Edit a file as the $EDITOR of an external process."
:lighter with-editor-mode-lighter
;; Protect the user from killing the buffer without using
;; either `with-editor-finish' or `with-editor-cancel',
;; and from removing the key bindings for these commands.
(unless with-editor-mode
(user-error "With-Editor mode cannot be turned off"))
;; Protect the user from enabling or disabling the mode interactively.
;; Manually enabling the mode is dangerous because canceling the buffer
;; deletes the visited file. The mode must not be disabled manually,
;; either `with-editor-finish' or `with-editor-cancel' must be used.
:interactive nil ; >= 28.1
(when (called-interactively-p 'any) ; < 28.1
(setq with-editor-mode (not with-editor-mode))
(user-error "With-Editor mode is not intended for interactive use"))
;; The buffer must also not be killed using regular kill commands.
(add-hook 'kill-buffer-query-functions
#'with-editor-kill-buffer-noop nil t)
;; `server-execute' displays a message which is not
@@ -486,7 +493,7 @@ Modify the `process-environment' for processes started in BODY,
instructing them to use the Emacsclient as editor. ENVVAR is the
environment variable that is exported to do so, it is evaluated
at run-time.
\n(fn [ENVVAR] BODY...)"
\n(fn ENVVAR BODY...)"
(declare (indent defun) (debug (sexp body)))
`(let ((with-editor--envvar ,envvar)
(process-environment process-environment))
@@ -542,8 +549,9 @@ at run-time.
with-editor-server-window-alist)))
server-window))
(defun server-switch-buffer--with-editor-server-window-alist
(fn &optional next-buffer &rest args)
(define-advice server-switch-buffer
(:around (fn &optional next-buffer &rest args)
with-editor-server-window-alist)
"Honor `with-editor-server-window-alist' (which see)."
(let ((server-window (with-current-buffer
(or next-buffer (current-buffer))
@@ -553,11 +561,9 @@ at run-time.
(with-editor-server-window))))
(apply fn next-buffer args)))
(advice-add 'server-switch-buffer :around
#'server-switch-buffer--with-editor-server-window-alist)
(defun start-file-process--with-editor-process-filter
(fn name buffer program &rest program-args)
(define-advice start-file-process
(:around (fn name buffer program &rest program-args)
with-editor-process-filter)
"When called inside a `with-editor' form and the Emacsclient
cannot be used, then give the process the filter function
`with-editor-process-filter'. To avoid overriding the filter
@@ -580,10 +586,9 @@ the appropriate editor environment variable."
(process-put process 'default-dir default-directory)
process)))
(advice-add 'start-file-process :around
#'start-file-process--with-editor-process-filter)
(cl-defun make-process--with-editor-process-filter
(advice-add #'make-process :around
#'make-process@with-editor-process-filter)
(cl-defun make-process@with-editor-process-filter
(fn &rest keys &key name buffer command coding noquery stop
connection-type filter sentinel stderr file-handler
&allow-other-keys)
@@ -623,8 +628,6 @@ to set the appropriate editor environment variable."
(process-put process 'default-dir default-directory)
process)))
(advice-add #'make-process :around #'make-process--with-editor-process-filter)
(defun with-editor-set-process-filter (process filter)
"Like `set-process-filter' but keep `with-editor-process-filter'.
Give PROCESS the new FILTER but keep `with-editor-process-filter'
@@ -716,16 +719,18 @@ OPEN \\([^]+?\\)\
(unless no-default-filter
(internal-default-process-filter process string)))
(advice-add 'server-visit-files :after
#'server-visit-files--with-editor-file-name-history-exclude)
(defun server-visit-files--with-editor-file-name-history-exclude
(files _proc &optional _nowait)
(define-advice server-visit-files
(:after (files _proc &optional _nowait)
with-editor-file-name-history-exclude)
"Prevent certain files from being added to `file-name-history'.
Files matching a regexp in `with-editor-file-name-history-exclude'
are prevented from being added to that list."
(pcase-dolist (`(,file . ,_) files)
(when (cl-find-if (lambda (regexp)
(string-match-p regexp file))
with-editor-file-name-history-exclude)
(setq file-name-history (delete file file-name-history)))))
(setq file-name-history
(delete (abbreviate-file-name file) file-name-history)))))
;;; Augmentations
@@ -747,7 +752,7 @@ This works in `shell-mode', `term-mode', `eshell-mode' and
(process-send-string
process (format " export %s=%s\n" envvar
(shell-quote-argument with-editor-sleeping-editor)))
(while (accept-process-output process 0.1))
(while (accept-process-output process 1 nil t))
(if (derived-mode-p 'term-mode)
(with-editor-set-process-filter process #'with-editor-emulate-terminal)
(add-hook 'comint-output-filter-functions #'with-editor-output-filter
@@ -756,12 +761,14 @@ This works in `shell-mode', `term-mode', `eshell-mode' and
(add-to-list 'eshell-preoutput-filter-functions
#'with-editor-output-filter)
(setenv envvar with-editor-sleeping-editor))
((derived-mode-p 'vterm-mode)
((and (derived-mode-p 'vterm-mode)
(fboundp 'vterm-send-return)
(fboundp 'vterm-send-string))
(if with-editor-emacsclient-executable
(let ((with-editor--envvar envvar)
(process-environment process-environment))
(with-editor--setup)
(while (accept-process-output vterm--process 0.1))
(while (accept-process-output vterm--process 1 nil t))
(when-let ((v (getenv envvar)))
(vterm-send-string (format " export %s=%S" envvar v))
(vterm-send-return))
@@ -877,8 +884,11 @@ else like the former."
shell-command-default-error-buffer
(and async current-prefix-arg (with-editor-read-envvar)))))
(defun shell-command--shell-command-with-editor-mode
(fn command &optional output-buffer error-buffer)
(define-advice shell-command
(:around (fn command &optional output-buffer error-buffer)
shell-command-with-editor-mode)
"Set editor envvar, if `shell-command-with-editor-mode' is enabled.
Also take care of that for `with-editor-[async-]shell-command'."
;; `shell-mode' and its hook are intended for buffers in which an
;; interactive shell is running, but `shell-command' also turns on
;; that mode, even though it only runs the shell to run a single
@@ -886,31 +896,28 @@ else like the former."
;; intended to be used in buffers in which an interactive shell is
;; running, so it has to be removed here.
(let ((shell-mode-hook (remove 'with-editor-export-editor shell-mode-hook)))
(cond ((or (not (or with-editor--envvar shell-command-with-editor-mode))
(not (string-suffix-p "&" command)))
(funcall fn command output-buffer error-buffer))
((and with-editor-shell-command-use-emacsclient
with-editor-emacsclient-executable
(not (file-remote-p default-directory)))
(with-editor (funcall fn command output-buffer error-buffer)))
(t
(funcall fn (format "%s=%s %s"
(or with-editor--envvar "EDITOR")
(shell-quote-argument with-editor-sleeping-editor)
command)
output-buffer error-buffer)
(ignore-errors
(let ((process (get-buffer-process
(or output-buffer
(get-buffer "*Async Shell Command*")))))
(set-process-filter
process (lambda (proc str)
(comint-output-filter proc str)
(with-editor-process-filter proc str t)))
process))))))
(advice-add 'shell-command :around
#'shell-command--shell-command-with-editor-mode)
(cond
;; If `with-editor-async-shell-command' was used, then `with-editor'
;; was used, and `with-editor--envvar'. `with-editor-shell-command'
;; only goes down that path if the command ends with "&". We might
;; still have to use `with-editor' here, for `async-shell-command'
;; or `shell-command', if the mode is enabled.
((and (string-suffix-p "&" command)
(or with-editor--envvar
shell-command-with-editor-mode))
(if with-editor--envvar
(funcall fn command output-buffer error-buffer)
(with-editor (funcall fn command output-buffer error-buffer)))
;; The comint filter was overridden with our filter. Use both.
(and-let* ((process (get-buffer-process
(or output-buffer
(get-buffer "*Async Shell Command*")))))
(prog1 process
(set-process-filter process
(lambda (proc str)
(comint-output-filter proc str)
(with-editor-process-filter proc str t))))))
((funcall fn command output-buffer error-buffer)))))
;;; _
@@ -980,5 +987,6 @@ See info node `(with-editor)Debugging' for instructions."
(provide 'with-editor)
;; Local Variables:
;; indent-tabs-mode: nil
;; byte-compile-warnings: (not docstrings-control-chars)
;; End:
;;; with-editor.el ends here

View File

@@ -1,7 +1,8 @@
This is with-editor.info, produced by makeinfo version 6.8 from
This is with-editor.info, produced by makeinfo version 7.1.1 from
with-editor.texi.
Copyright (C) 2015-2023 Jonas Bernoulli <jonas@bernoul.li>
Copyright (C) 2015-2024 Jonas Bernoulli
<emacs.with-editor@jonas.bernoulli.dev>
You can redistribute this document and/or modify it under the terms
of the GNU General Public License as published by the Free Software
@@ -32,16 +33,17 @@ does.
This library was written because Magit has to be able to do the above
to allow the user to edit commit messages gracefully and to edit rebase
sequences, which wouldnt be possible at all otherwise.
sequences, which wouldn't be possible at all otherwise.
Because other packages can benefit from such functionality, this
library is made available as a separate package. It also defines some
additional functionality which makes it useful even for end-users, who
dont use Magit or another package which uses it internally.
don't use Magit or another package which uses it internally.
This manual is for With-Editor version 3.3.2.
This manual is for With-Editor version 3.4.3.
Copyright (C) 2015-2023 Jonas Bernoulli <jonas@bernoul.li>
Copyright (C) 2015-2024 Jonas Bernoulli
<emacs.with-editor@jonas.bernoulli.dev>
You can redistribute this document and/or modify it under the terms
of the GNU General Public License as published by the Free Software
@@ -61,7 +63,7 @@ This manual is for With-Editor version 3.3.2.
* Function and Command Index::
* Variable Index::
The Detailed Node Listing
-- The Detailed Node Listing --
Using the With-Editor package
@@ -77,10 +79,10 @@ File: with-editor.info, Node: Using the With-Editor package, Next: Using With-
The With-Editor package is used internally by Magit when editing
commit messages and rebase sequences. It also provides some commands
and features which are useful by themselves, even if you dont use
and features which are useful by themselves, even if you don't use
Magit.
For information about using this library in you own package, see
For information about using this library in your own package, see
*note Using With-Editor as a library::.
* Menu:
@@ -102,9 +104,9 @@ Emacs (most likely on macOS) without putting the executable on $PATH,
and we have to add another kludge to find it anyway.
-- User Option: with-editor-emacsclient-executable
The emacsclient executable used as the editor by child process of
this Emacs instance. By using this executable, child processes can
call home to their parent process.
The emacsclient executable used as the editor by child processes
of this Emacs instance. By using this executable, child processes
can call home to their parent process.
This option is automatically set at startup by looking in
exec-path, and other places where the executable could be
@@ -113,25 +115,25 @@ and we have to add another kludge to find it anyway.
You should *not* customize this option permanently. If you have to
do it, then you should consider that a temporary kludge and inform
the Magit maintainer as described in *note Debugging::.
the Magit maintainer as described in *note Debugging: Debugging.
If With-Editor fails to find a suitable emacsclient on you
If With-Editor fails to find a suitable emacsclient on your
system, then this should be fixed for all users at once, by
teaching with-editor-locate-emacsclient how to do so on your
system and system like yours. Doing it this way has the advantage,
that you wont have do it again every time you update Emacs, and
that other users who have installed Emacs the same way as you have,
wont have to go through the same trouble.
system and systems like yours. Doing it this way has the
advantage, that you won't have do it again every time you update
Emacs, and that other users who have installed Emacs the same way
as you have, won't have to go through the same trouble.
Note that there also is a nuclear option; setting this variable to
nil causes the "sleeping editor" described below to be used even
for local child processes. Obviously we dont recommend that you
for local child processes. Obviously we don't recommend that you
use this except in "emergencies", i.e., before we had a change to
add a kludge appropriate for you setup.
add a kludge appropriate for your setup.
-- Function: with-editor-locate-emacsclient
The function used to set the initial value of the option
with-editor-emacsclient-executable. Theres a lot of voodoo
with-editor-emacsclient-executable. There's a lot of voodoo
here.
The emacsclient cannot be used when using Tramp to run a process on
@@ -148,12 +150,12 @@ it receives a signal.
The sleeping editor is a shell script used as the editor of child
processes when the emacsclient executable cannot be used.
This fallback is used for asynchronous process started inside the
This fallback is used for asynchronous processes started inside the
macro with-editor, when the process runs on a remote machine or
for local processes when with-editor-emacsclient-executable is
nil.
Where the latter uses a socket to communicate with Emacs server,
Where the latter uses a socket to communicate with Emacs' server,
this substitute prints edit requests to its standard output on
which a process filter listens for such requests. As such it is
not a complete substitute for a proper emacsclient, it can only
@@ -190,7 +192,7 @@ File: with-editor.info, Node: Using With-Editor commands, Prev: Configuring Wi
==============================
This section describes how to use the with-editor library _outside_ of
Magit. You dont need to know any of this just to create commits using
Magit. You don't need to know any of this just to create commits using
Magit.
The commands with-editor-async-shell-command and
@@ -209,7 +211,7 @@ for an alternative environment variable such as $GIT_EDITOR.
with & and is therefore run asynchronously, then the current
Emacs instance is exported as $EDITOR.
To always use these variants add this to you init file:
To always use these variants add this to your init file:
(keymap-global-set "<remap> <async-shell-command>"
#'with-editor-async-shell-command)
@@ -263,7 +265,7 @@ File: with-editor.info, Node: Using With-Editor as a library, Next: Debugging,
This section describes how to use the with-editor library _outside_ of
Magit to teach another package how to have its child processes call
home, just like Magit does. You dont need to know any of this just to
home, just like Magit does. You don't need to know any of this just to
create commits using Magit. You can also ignore this if you use
with-editor outside of Magit, but only as an end-user.
@@ -286,8 +288,8 @@ package::.
If BODY begins with a literal string, then that variable is set
instead of EDITOR.
-- Macro: with-editor envvar &rest body
This macro is like with-editor instead that the ENVVAR argument
-- Macro: with-editor* envvar &rest body
This macro is like with-editor, except that the ENVVAR argument
is required and that it is evaluated at run-time.
-- Function: with-editor-set-process-filter process filter
@@ -295,8 +297,8 @@ package::.
the new FILTER does not remove the with-editor-process-filter.
This is done by wrapping the two filter functions using a lambda,
which becomes the actual filter. It calls FILTER first, which may
or may not insert the text into the PROCESSs buffer. Then it
calls with-editor-process-filter, passing t as
or may not insert the text into the PROCESS's buffer. Then it
calls with-editor-process-filter, passing t as
NO-STANDARD-FILTER.

@@ -329,8 +331,6 @@ Appendix A Function and Command Index
* with-editor: Using With-Editor as a library.
(line 16)
* with-editor <1>: Using With-Editor as a library.
(line 31)
* with-editor-async-shell-command: Using With-Editor commands.
(line 17)
* with-editor-export-editor: Using With-Editor commands.
@@ -345,6 +345,8 @@ Appendix A Function and Command Index
(line 35)
* with-editor-shell-command: Using With-Editor commands.
(line 21)
* with-editor*: Using With-Editor as a library.
(line 31)

File: with-editor.info, Node: Variable Index, Prev: Function and Command Index, Up: Top
@@ -365,14 +367,14 @@ Appendix B Variable Index

Tag Table:
Node: Top773
Node: Using the With-Editor package2563
Node: Configuring With-Editor3149
Node: Using With-Editor commands7698
Node: Using With-Editor as a library10999
Node: Debugging13024
Node: Function and Command Index13916
Node: Variable Index15414
Node: Top801
Node: Using the With-Editor package2611
Node: Configuring With-Editor3196
Node: Using With-Editor commands7751
Node: Using With-Editor as a library11051
Node: Debugging13079
Node: Function and Command Index13971
Node: Variable Index15469

End Tag Table