update packages
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
(define-package "with-editor" "20200617.1234" "Use the Emacsclient as $EDITOR"
|
||||
(define-package "with-editor" "20201030.1232" "Use the Emacsclient as $EDITOR"
|
||||
'((emacs "24.4")
|
||||
(async "1.9"))
|
||||
:commit "7c512887c6d69864fb600d32fb92857c51babcff" :keywords
|
||||
'("tools")
|
||||
:authors
|
||||
:commit "6735180e73e787b79535c245b162249b70dbf841" :authors
|
||||
'(("Jonas Bernoulli" . "jonas@bernoul.li"))
|
||||
:maintainer
|
||||
'("Jonas Bernoulli" . "jonas@bernoul.li")
|
||||
:keywords
|
||||
'("tools")
|
||||
:url "https://github.com/magit/with-editor")
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
|
||||
@@ -54,15 +54,16 @@
|
||||
;; use `shell-command' to asynchronously run some shell command.
|
||||
|
||||
;; The command `with-editor-export-editor' exports `$EDITOR' or
|
||||
;; another such environment variable in `shell-mode', `term-mode' and
|
||||
;; `eshell-mode' buffers. Use this Emacs command before executing a
|
||||
;; shell command which needs the editor set, or always arrange for the
|
||||
;; current Emacs instance to be used as editor by adding it to the
|
||||
;; appropriate mode hooks:
|
||||
;; another such environment variable in `shell-mode', `eshell-mode',
|
||||
;; `term-mode' and `vterm-mode' buffers. Use this Emacs command
|
||||
;; before executing a shell command which needs the editor set, or
|
||||
;; always arrange for the current Emacs instance to be used as editor
|
||||
;; by adding it to the appropriate mode hooks:
|
||||
;;
|
||||
;; (add-hook 'shell-mode-hook 'with-editor-export-editor)
|
||||
;; (add-hook 'term-exec-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-mode-hook 'with-editor-export-editor)
|
||||
|
||||
;; Some variants of this function exist, these two forms are
|
||||
;; equivalent:
|
||||
@@ -80,8 +81,9 @@
|
||||
;;; Code:
|
||||
|
||||
(require 'cl-lib)
|
||||
;; `pcase-dolist' is not autoloaded on Emacs 24.
|
||||
(eval-when-compile (require 'pcase))
|
||||
(eval-when-compile
|
||||
(require 'pcase) ; `pcase-dolist' is not autoloaded on Emacs 24.
|
||||
(require 'subr-x))
|
||||
(require 'server)
|
||||
(require 'shell)
|
||||
|
||||
@@ -97,11 +99,18 @@
|
||||
(progn (require 'dired nil t)
|
||||
(require 'eshell nil t)
|
||||
(require 'term nil t)
|
||||
(condition-case err
|
||||
(require 'vterm nil t)
|
||||
(error (message "Error: %S" err)))
|
||||
(require 'vterm nil t)
|
||||
(require 'warnings nil t)))
|
||||
(declare-function dired-get-filename 'dired)
|
||||
(declare-function term-emulate-terminal 'term)
|
||||
(declare-function vterm-send-return 'vterm)
|
||||
(declare-function vterm-send-string 'vterm)
|
||||
(defvar eshell-preoutput-filter-functions)
|
||||
(defvar git-commit-post-finish-hook)
|
||||
(defvar vterm--process)
|
||||
|
||||
;;; Options
|
||||
|
||||
@@ -540,7 +549,7 @@ at run-time.
|
||||
server-window))
|
||||
|
||||
(defun server-switch-buffer--with-editor-server-window-alist
|
||||
(fn &optional next-buffer killed-one filepos)
|
||||
(fn &optional next-buffer &rest args)
|
||||
"Honor `with-editor-server-window-alist' (which see)."
|
||||
(let ((server-window (with-current-buffer
|
||||
(or next-buffer (current-buffer))
|
||||
@@ -548,7 +557,7 @@ at run-time.
|
||||
(setq with-editor-previous-winconf
|
||||
(current-window-configuration)))
|
||||
(with-editor-server-window))))
|
||||
(funcall fn next-buffer killed-one filepos)))
|
||||
(apply fn next-buffer args)))
|
||||
|
||||
(advice-add 'server-switch-buffer :around
|
||||
'server-switch-buffer--with-editor-server-window-alist)
|
||||
@@ -692,7 +701,8 @@ Set and export the environment variable ENVVAR, by default
|
||||
\"EDITOR\". The value is automatically generated to teach
|
||||
commands to use the current Emacs instance as \"the editor\".
|
||||
|
||||
This works in `shell-mode', `term-mode' and `eshell-mode'."
|
||||
This works in `shell-mode', `term-mode', `eshell-mode' and
|
||||
`vterm'."
|
||||
(interactive (list (with-editor-read-envvar)))
|
||||
(cond
|
||||
((derived-mode-p 'comint-mode 'term-mode)
|
||||
@@ -710,6 +720,19 @@ This works in `shell-mode', `term-mode' and `eshell-mode'."
|
||||
(add-to-list 'eshell-preoutput-filter-functions
|
||||
'with-editor-output-filter)
|
||||
(setenv envvar with-editor-sleeping-editor))
|
||||
((derived-mode-p 'vterm-mode)
|
||||
(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))
|
||||
(when-let ((v (getenv envvar)))
|
||||
(vterm-send-string (format "export %s=%S" envvar v))
|
||||
(vterm-send-return))
|
||||
(when-let ((v (getenv "EMACS_SERVER_FILE")))
|
||||
(vterm-send-string (format "export EMACS_SERVER_FILE=%S" v))
|
||||
(vterm-send-return)))
|
||||
(error "Cannot use sleeping editor in this buffer")))
|
||||
(t
|
||||
(error "Cannot export environment variables in this buffer")))
|
||||
(message "Successfully exported %s" envvar))
|
||||
|
||||
@@ -39,7 +39,7 @@ 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 2.9.3 (v2.9.3-1-gc5e2141+1).
|
||||
This manual is for With-Editor version 2.9.4 (v2.9.4-2-gc4768f5+1).
|
||||
|
||||
Copyright (C) 2015-2020 Jonas Bernoulli <jonas@bernoul.li>
|
||||
|
||||
@@ -232,14 +232,16 @@ for an alternative environment variable such as ‘$GIT_EDITOR’.
|
||||
they are defined in Emacs or in some third-party package.
|
||||
|
||||
The command ‘with-editor-export-editor’ exports ‘$EDITOR’ or another
|
||||
such environment variable in ‘shell-mode’, ‘term-mode’ and ‘eshell-mode’
|
||||
buffers. Use this Emacs command before executing a shell command which
|
||||
needs the editor set, or always arrange for the current Emacs instance
|
||||
to be used as editor by adding it to the appropriate mode hooks:
|
||||
such environment variable in ‘shell-mode’, ‘eshell-mode’, ‘term-mode’
|
||||
and ‘vterm-mode’ buffers. Use this Emacs command before executing a
|
||||
shell command which needs the editor set, or always arrange for the
|
||||
current Emacs instance to be used as editor by adding it to the
|
||||
appropriate mode hooks:
|
||||
|
||||
(add-hook 'shell-mode-hook 'with-editor-export-editor)
|
||||
(add-hook 'term-exec-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)
|
||||
|
||||
Some variants of this function exist; these two forms are equivalent:
|
||||
|
||||
@@ -249,9 +251,9 @@ to be used as editor by adding it to the appropriate mode hooks:
|
||||
|
||||
-- Command: with-editor-export-editor
|
||||
|
||||
When invoked in a ‘shell-mode’, ‘term-mode’, or ‘eshell-mode’
|
||||
buffer, this command teaches shell commands to use the current
|
||||
Emacs instance as the editor, by exporting ‘$EDITOR’.
|
||||
When invoked in a ‘shell-mode’, ‘eshell-mode’, ‘term-mode’ or
|
||||
‘vterm-mode’ buffer, this command teaches shell commands to use the
|
||||
current Emacs instance as the editor, by exporting ‘$EDITOR’.
|
||||
|
||||
-- Command: with-editor-export-git-editor
|
||||
|
||||
@@ -340,11 +342,11 @@ Appendix A Command Index
|
||||
* with-editor-async-shell-command: Using With-Editor commands.
|
||||
(line 17)
|
||||
* with-editor-export-editor: Using With-Editor commands.
|
||||
(line 60)
|
||||
(line 62)
|
||||
* with-editor-export-git-editor: Using With-Editor commands.
|
||||
(line 66)
|
||||
(line 68)
|
||||
* with-editor-export-hg-editor: Using With-Editor commands.
|
||||
(line 71)
|
||||
(line 73)
|
||||
* with-editor-shell-command: Using With-Editor commands.
|
||||
(line 22)
|
||||
|
||||
@@ -364,11 +366,11 @@ Appendix B Function Index
|
||||
* with-editor-async-shell-command: Using With-Editor commands.
|
||||
(line 17)
|
||||
* with-editor-export-editor: Using With-Editor commands.
|
||||
(line 60)
|
||||
(line 62)
|
||||
* with-editor-export-git-editor: Using With-Editor commands.
|
||||
(line 66)
|
||||
(line 68)
|
||||
* with-editor-export-hg-editor: Using With-Editor commands.
|
||||
(line 71)
|
||||
(line 73)
|
||||
* with-editor-locate-emacsclient: Configuring With-Editor.
|
||||
(line 42)
|
||||
* with-editor-set-process-filter: Using With-Editor as a library.
|
||||
@@ -399,11 +401,11 @@ Node: Top773
|
||||
Node: Using the With-Editor package2591
|
||||
Node: Configuring With-Editor3177
|
||||
Node: Using With-Editor commands7726
|
||||
Node: Using With-Editor as a library10921
|
||||
Node: Debugging12884
|
||||
Node: Command Index13763
|
||||
Node: Function Index14645
|
||||
Node: Variable Index16111
|
||||
Node: Using With-Editor as a library11017
|
||||
Node: Debugging12980
|
||||
Node: Command Index13859
|
||||
Node: Function Index14741
|
||||
Node: Variable Index16207
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
||||
Reference in New Issue
Block a user