update of packages
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
(define-package "with-editor" "20221127.2243" "Use the Emacsclient as $EDITOR"
|
||||
(define-package "with-editor" "20230917.958" "Use the Emacsclient as $EDITOR"
|
||||
'((emacs "25.1")
|
||||
(compat "28.1.1.0"))
|
||||
:commit "4da109748da0828b79198701eb641d5b724153ce" :authors
|
||||
(compat "29.1.4.1"))
|
||||
:commit "fcd186d1e684c2dca6497c89af77b27b2b036c11" :authors
|
||||
'(("Jonas Bernoulli" . "jonas@bernoul.li"))
|
||||
:maintainers
|
||||
'(("Jonas Bernoulli" . "jonas@bernoul.li"))
|
||||
:maintainer
|
||||
'("Jonas Bernoulli" . "jonas@bernoul.li")
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
;;; with-editor.el --- Use the Emacsclient as $EDITOR -*- lexical-binding:t -*-
|
||||
|
||||
;; Copyright (C) 2014-2022 The Magit Project Contributors
|
||||
;; Copyright (C) 2014-2023 The Magit Project Contributors
|
||||
|
||||
;; Author: Jonas Bernoulli <jonas@bernoul.li>
|
||||
;; Homepage: https://github.com/magit/with-editor
|
||||
;; Keywords: processes terminals
|
||||
|
||||
;; Package-Version: 3.2.0.50-git
|
||||
;; Package-Requires: ((emacs "25.1") (compat "28.1.1.0"))
|
||||
;; Package-Version: 3.3.2
|
||||
;; Package-Requires: ((emacs "25.1") (compat "29.1.4.1"))
|
||||
|
||||
;; SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
@@ -41,10 +41,10 @@
|
||||
;; `$GIT_EDITOR'. To always use these variants add this to your init
|
||||
;; file:
|
||||
;;
|
||||
;; (define-key (current-global-map)
|
||||
;; [remap async-shell-command] #'with-editor-async-shell-command)
|
||||
;; (define-key (current-global-map)
|
||||
;; [remap shell-command] #'with-editor-shell-command)
|
||||
;; (keymap-global-set "<remap> <async-shell-command>"
|
||||
;; #'with-editor-async-shell-command)
|
||||
;; (keymap-global-set "<remap> <shell-command>"
|
||||
;; #'with-editor-shell-command)
|
||||
|
||||
;; Alternatively use the global `shell-command-with-editor-mode',
|
||||
;; which always sets `$EDITOR' for all Emacs commands which ultimately
|
||||
@@ -117,9 +117,10 @@ please see https://github.com/magit/magit/wiki/Emacsclient."))))
|
||||
(let* ((version-lst (cl-subseq (split-string emacs-version "\\.") 0 depth))
|
||||
(version-reg (concat "^" (mapconcat #'identity version-lst "\\."))))
|
||||
(or (locate-file
|
||||
(if (equal (downcase invocation-name) "remacs")
|
||||
"remacsclient"
|
||||
"emacsclient")
|
||||
(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))
|
||||
@@ -168,7 +169,7 @@ please see https://github.com/magit/magit/wiki/Emacsclient."))))
|
||||
|
||||
(defcustom with-editor-sleeping-editor "\
|
||||
sh -c '\
|
||||
printf \"\\nWITH-EDITOR: $$ OPEN $0\\037 IN $(pwd)\\n\"; \
|
||||
printf \"\\nWITH-EDITOR: $$ OPEN $0\\037$1\\037 IN $(pwd)\\n\"; \
|
||||
sleep 604800 & sleep=$!; \
|
||||
trap \"kill $sleep; exit 0\" USR1; \
|
||||
trap \"kill $sleep; exit 1\" USR2; \
|
||||
@@ -178,7 +179,7 @@ wait $sleep'"
|
||||
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 (i.e. when no suitable Emacsclient was found, or the user
|
||||
is nil (i.e., when no suitable Emacsclient was found, or the user
|
||||
decided not to use it).
|
||||
|
||||
Where the latter uses a socket to communicate with Emacs' server,
|
||||
@@ -191,19 +192,22 @@ Some shells do not execute traps immediately when waiting for a
|
||||
child process, but by default we do use such a blocking child
|
||||
process.
|
||||
|
||||
If you use such a shell (e.g. `csh' on FreeBSD, but not Debian),
|
||||
If you use such a shell (e.g., `csh' on FreeBSD, but not Debian),
|
||||
then you have to edit this option. You can either replace \"sh\"
|
||||
with \"bash\" (and install that), or you can use the older, less
|
||||
performant implementation:
|
||||
|
||||
\"sh -c '\\
|
||||
echo -e \\\"\\nWITH-EDITOR: $$ OPEN $0 IN $(pwd)\\n\\\"; \\
|
||||
echo -e \\\"\\nWITH-EDITOR: $$ OPEN $0$1 IN $(pwd)\\n\\\"; \\
|
||||
trap \\\"exit 0\\\" USR1; \\
|
||||
trap \\\"exit 1\" USR2; \\
|
||||
while true; do sleep 1; done'\"
|
||||
|
||||
Note that the unit separator character () right after the file
|
||||
name ($0) is required.
|
||||
Note that the two unit separator characters () right after $0
|
||||
and $1 are required. Normally $0 is the file name and $1 is
|
||||
missing or else gets ignored. But if $0 has the form \"+N[:N]\",
|
||||
then it is treated as a position in the file and $1 is expected
|
||||
to be the file.
|
||||
|
||||
Also note that using this alternative implementation leads to a
|
||||
delay of up to a second. The delay can be shortened by replacing
|
||||
@@ -266,7 +270,7 @@ used when reading a filename in the minibuffer.")
|
||||
(defcustom with-editor-shell-command-use-emacsclient t
|
||||
"Whether to use the emacsclient when running shell commands.
|
||||
|
||||
This affects `with-editor-shell-command-async' and, if the input
|
||||
This affects `with-editor-async-shell-command' and, if the input
|
||||
ends with \"&\" `with-editor-shell-command' .
|
||||
|
||||
If `shell-command-with-editor-mode' is enabled, then it also
|
||||
@@ -397,18 +401,16 @@ And some tools that do not handle $EDITOR properly also break."
|
||||
|
||||
;;; Mode
|
||||
|
||||
(defvar with-editor-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map "\C-c\C-c" #'with-editor-finish)
|
||||
(define-key map [remap server-edit] #'with-editor-finish)
|
||||
(define-key map [remap evil-save-and-close] #'with-editor-finish)
|
||||
(define-key map [remap evil-save-modified-and-close] #'with-editor-finish)
|
||||
(define-key map "\C-c\C-k" #'with-editor-cancel)
|
||||
(define-key map [remap kill-buffer] #'with-editor-cancel)
|
||||
(define-key map [remap ido-kill-buffer] #'with-editor-cancel)
|
||||
(define-key map [remap iswitchb-kill-buffer] #'with-editor-cancel)
|
||||
(define-key map [remap evil-quit] #'with-editor-cancel)
|
||||
map))
|
||||
(defvar-keymap with-editor-mode-map
|
||||
"C-c C-c" #'with-editor-finish
|
||||
"<remap> <server-edit>" #'with-editor-finish
|
||||
"<remap> <evil-save-and-close>" #'with-editor-finish
|
||||
"<remap> <evil-save-modified-and-close>" #'with-editor-finish
|
||||
"C-c C-k" #'with-editor-cancel
|
||||
"<remap> <kill-buffer>" #'with-editor-cancel
|
||||
"<remap> <ido-kill-buffer>" #'with-editor-cancel
|
||||
"<remap> <iswitchb-kill-buffer>" #'with-editor-cancel
|
||||
"<remap> <evil-quit>" #'with-editor-cancel)
|
||||
|
||||
(define-minor-mode with-editor-mode
|
||||
"Edit a file as the $EDITOR of an external process."
|
||||
@@ -508,7 +510,16 @@ at run-time.
|
||||
(server-start))
|
||||
;; Tell $EDITOR to use the Emacsclient.
|
||||
(push (concat with-editor--envvar "="
|
||||
(shell-quote-argument with-editor-emacsclient-executable)
|
||||
;; Quoting is the right thing to do. Applications that
|
||||
;; fail because of that, are the ones that need fixing,
|
||||
;; e.g., by using 'eval "$EDITOR" file'. See #121.
|
||||
(shell-quote-argument
|
||||
;; If users set the executable manually, they might
|
||||
;; begin the path with "~", which would get quoted.
|
||||
(if (string-prefix-p "~" with-editor-emacsclient-executable)
|
||||
(concat (expand-file-name "~")
|
||||
(substring with-editor-emacsclient-executable 1))
|
||||
with-editor-emacsclient-executable))
|
||||
;; Tell the process where the server file is.
|
||||
(and (not server-use-tcp)
|
||||
(concat " --socket-name="
|
||||
@@ -633,8 +644,11 @@ may not insert the text into the PROCESS's buffer. Then it calls
|
||||
|
||||
(defvar with-editor-filter-visit-hook nil)
|
||||
|
||||
(defconst with-editor-sleeping-editor-regexp
|
||||
"^WITH-EDITOR: \\([0-9]+\\) OPEN \\([^]+?\\)\\(?: IN \\([^\r]+?\\)\\)?\r?$")
|
||||
(defconst with-editor-sleeping-editor-regexp "^\
|
||||
WITH-EDITOR: \\([0-9]+\\) \
|
||||
OPEN \\([^]+?\\)\
|
||||
\\(?:\\([^]*\\)\\)?\
|
||||
\\(?: IN \\([^\r]+?\\)\\)?\r?$")
|
||||
|
||||
(defvar with-editor--max-incomplete-length 1000)
|
||||
|
||||
@@ -655,8 +669,16 @@ may not insert the text into the PROCESS's buffer. Then it calls
|
||||
(when process
|
||||
(process-put process 'incomplete nil))
|
||||
(let ((pid (match-string 1 string))
|
||||
(file (match-string 2 string))
|
||||
(dir (match-string 3 string)))
|
||||
(arg0 (match-string 2 string))
|
||||
(arg1 (match-string 3 string))
|
||||
(dir (match-string 4 string))
|
||||
file line column)
|
||||
(cond ((string-match "\\`\\+\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?\\'" arg0)
|
||||
(setq file arg1)
|
||||
(setq line (string-to-number (match-string 1 arg0)))
|
||||
(setq column (match-string 2 arg0))
|
||||
(setq column (and column (string-to-number column))))
|
||||
((setq file arg0)))
|
||||
(unless (file-name-absolute-p file)
|
||||
(setq file (expand-file-name file dir)))
|
||||
(when default-directory
|
||||
@@ -666,6 +688,19 @@ may not insert the text into the PROCESS's buffer. Then it calls
|
||||
(setq with-editor--pid pid)
|
||||
(setq with-editor-previous-winconf
|
||||
(current-window-configuration))
|
||||
(when line
|
||||
(let ((pos (save-excursion
|
||||
(save-restriction
|
||||
(goto-char (point-min))
|
||||
(forward-line (1- line))
|
||||
(when column
|
||||
(move-to-column column))
|
||||
(point)))))
|
||||
(when (and (buffer-narrowed-p)
|
||||
widen-automatically
|
||||
(not (<= (point-min) pos (point-max))))
|
||||
(widen))
|
||||
(goto-char pos)))
|
||||
(run-hooks 'with-editor-filter-visit-hook)
|
||||
(funcall (or (with-editor-server-window) #'switch-to-buffer)
|
||||
(current-buffer))
|
||||
@@ -927,7 +962,7 @@ See info node `(with-editor)Debugging' for instructions."
|
||||
(format " funcall: %s (%s)\n" fun
|
||||
(and fun (with-editor-emacsclient-version fun)))))
|
||||
(insert "path:\n"
|
||||
(format " $PATH: %S\n" (getenv "PATH"))
|
||||
(format " $PATH: %s\n" (split-string (getenv "PATH") ":"))
|
||||
(format " exec-path: %s\n" exec-path))
|
||||
(insert (format " with-editor-emacsclient-path:\n"))
|
||||
(dolist (dir (with-editor-emacsclient-path))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
This is with-editor.info, produced by makeinfo version 7.0.1 from
|
||||
This is with-editor.info, produced by makeinfo version 6.8 from
|
||||
with-editor.texi.
|
||||
|
||||
Copyright (C) 2015-2022 Jonas Bernoulli <jonas@bernoul.li>
|
||||
Copyright (C) 2015-2023 Jonas Bernoulli <jonas@bernoul.li>
|
||||
|
||||
You can redistribute this document and/or modify it under the terms
|
||||
of the GNU General Public License as published by the Free Software
|
||||
@@ -39,9 +39,9 @@ library is made available as a separate package. It also defines some
|
||||
additional functionality which makes it useful even for end-users, who
|
||||
don’t use Magit or another package which uses it internally.
|
||||
|
||||
This manual is for With-Editor version 3.2.0.50-git.
|
||||
This manual is for With-Editor version 3.3.2.
|
||||
|
||||
Copyright (C) 2015-2022 Jonas Bernoulli <jonas@bernoul.li>
|
||||
Copyright (C) 2015-2023 Jonas Bernoulli <jonas@bernoul.li>
|
||||
|
||||
You can redistribute this document and/or modify it under the terms
|
||||
of the GNU General Public License as published by the Free Software
|
||||
@@ -126,7 +126,7 @@ and we have to add another kludge to find it anyway.
|
||||
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 don’t recommend that you
|
||||
use this except in "emergencies", i.e. before we had a change to
|
||||
use this except in "emergencies", i.e., before we had a change to
|
||||
add a kludge appropriate for you setup.
|
||||
|
||||
-- Function: with-editor-locate-emacsclient
|
||||
@@ -164,13 +164,13 @@ it receives a signal.
|
||||
child process, but by default we do use such a blocking child
|
||||
process.
|
||||
|
||||
If you use such a shell (e.g. ‘csh’ on FreeBSD, but not Debian),
|
||||
If you use such a shell (e.g., ‘csh’ on FreeBSD, but not Debian),
|
||||
then you have to edit this option. You can either replace ‘sh’
|
||||
with ‘bash’ (and install that), or you can use the older, less
|
||||
performant implementation:
|
||||
|
||||
"sh -c '\
|
||||
echo \"WITH-EDITOR: $$ OPEN $0 IN $(pwd)\"; \
|
||||
echo \"WITH-EDITOR: $$ OPEN $0$1 IN $(pwd)\"; \
|
||||
trap \"exit 0\" USR1; \
|
||||
trap \"exit 1\" USR2; \
|
||||
while true; do sleep 1; done'"
|
||||
@@ -211,10 +211,10 @@ for an alternative environment variable such as ‘$GIT_EDITOR’.
|
||||
|
||||
To always use these variants add this to you init file:
|
||||
|
||||
(define-key (current-global-map)
|
||||
[remap async-shell-command] 'with-editor-async-shell-command)
|
||||
(define-key (current-global-map)
|
||||
[remap shell-command] 'with-editor-shell-command)
|
||||
(keymap-global-set "<remap> <async-shell-command>"
|
||||
#'with-editor-async-shell-command)
|
||||
(keymap-global-set "<remap> <shell-command>"
|
||||
#'with-editor-shell-command)
|
||||
|
||||
Alternatively use the global ‘shell-command-with-editor-mode’.
|
||||
|
||||
@@ -234,7 +234,7 @@ appropriate mode hooks:
|
||||
(add-hook 'shell-mode-hook 'with-editor-export-editor)
|
||||
(add-hook 'eshell-mode-hook 'with-editor-export-editor)
|
||||
(add-hook 'term-exec-hook 'with-editor-export-editor)
|
||||
(add-hook 'vterm-exec-hook 'with-editor-export-editor)
|
||||
(add-hook 'vterm-mode-hook 'with-editor-export-editor)
|
||||
|
||||
Some variants of this function exist; these two forms are equivalent:
|
||||
|
||||
@@ -312,7 +312,7 @@ the most likely reason is that someone found yet another way to package
|
||||
Emacs (most likely on macOS) without putting the executable on ‘$PATH’,
|
||||
and we have to add another kludge to find it anyway.
|
||||
|
||||
If you are having problems using ‘with-editor’, e.g. you cannot
|
||||
If you are having problems using ‘with-editor’, e.g., you cannot
|
||||
commit in Magit, then please open a new issue at
|
||||
<https://github.com/magit/with-editor/issues> and provide information
|
||||
about your Emacs installation. Most importantly how did you install
|
||||
@@ -365,14 +365,14 @@ Appendix B Variable Index
|
||||
|
||||
|
||||
Tag Table:
|
||||
Node: Top775
|
||||
Node: Using the With-Editor package2572
|
||||
Node: Configuring With-Editor3158
|
||||
Node: Using With-Editor commands7704
|
||||
Node: Using With-Editor as a library10989
|
||||
Node: Debugging13014
|
||||
Node: Function and Command Index13906
|
||||
Node: Variable Index15404
|
||||
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
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
Reference in New Issue
Block a user