[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/with-editor 73d3d1a 066/140: Use the emacsclient again whe
From: |
Jonas Bernoulli |
Subject: |
[nongnu] elpa/with-editor 73d3d1a 066/140: Use the emacsclient again when running shell commands |
Date: |
Fri, 6 Aug 2021 12:51:21 -0400 (EDT) |
branch: elpa/with-editor
commit 73d3d1ac1470001e184a5ead88f770eeb71a5461
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
Use the emacsclient again when running shell commands
This fixes the issues described in #40 and reintroduces the issue
described in #23. Users who do not care about #40 but don't like #23
can set the new option `with-editor-shell-command-use-emacsclient' to
nil.
---
with-editor.el | 38 ++++++++++++++++++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
diff --git a/with-editor.el b/with-editor.el
index 43a6a7a..45cb724 100644
--- a/with-editor.el
+++ b/with-editor.el
@@ -262,6 +262,38 @@ When a filename matches any of the regexps, then
`server-visit'
does not add it to the variable `file-name-history', which is
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
+ends with \"&\" `with-editor-shell-command' .
+
+If `shell-command-with-editor-mode' is enabled, then it also
+affects `shell-command-async' and, if the input ends with \"&\"
+`shell-command'.
+
+This is a temporary kludge that lets you choose between two
+possible defects, the ones described in the issues #23 and #40.
+
+When t, then use the emacsclient. This has the disadvantage that
+`with-editor-mode' won't be enabled because we don't know whether
+this package was involved at all in the call to the emacsclient,
+and when it is not, then we really should. The problem is that
+the emacsclient doesn't pass a long any environment variables to
+the server. This will hopefully be fixed in Emacs eventually.
+
+When nil, then use the sleeping editor. Because in this case we
+know that this package is involved, we can enable the mode. But
+this makes it necessary that you invoke $EDITOR in shell scripts
+like so:
+
+ eval \"$EDITOR\" file
+
+And some tools that do not handle $EDITOR properly also break."
+ :package-version '(with-editor . "2.8.0")
+ :group 'with-editor
+ :type 'boolean)
+
;;; Mode Commands
(defvar with-editor-pre-finish-hook nil)
@@ -688,8 +720,10 @@ else like the former."
(cond ((or (not (or with-editor--envvar shell-command-with-editor-mode))
(not (string-match-p "&\\'" command)))
(funcall fn command output-buffer error-buffer))
- ;; Do not use the `emacsclient', because it currently is not
- ;; possible to know whether `with-editor' was involved. #23
+ ((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
(apply fn (format "%s=%s %s"
(or with-editor--envvar "EDITOR")
- [nongnu] elpa/with-editor b8641ac 054/140: with-editor-output-filter: don't assume default-directory is valid, (continued)
- [nongnu] elpa/with-editor b8641ac 054/140: with-editor-output-filter: don't assume default-directory is valid, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor b0ff338 060/140: manual: put local-variables into an ignored section, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 6147262 064/140: make: remove clean-texi and clean-all targets, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor f733034 067/140: Ignore additional generated files, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 93876b6 068/140: manual: use @noindent before version sentence, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor f401e12 071/140: Add some autoload, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor fcbccec 072/140: Use process-live-p to check whether process is alive, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 3e64247 080/140: Release version 2.7.4, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor cacb41d 062/140: make: use same export settings as for manual Org exports, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor ee39f23 065/140: make: generate CDN invalidation after upload, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 73d3d1a 066/140: Use the emacsclient again when running shell commands,
Jonas Bernoulli <=
- [nongnu] elpa/with-editor ff3e969 077/140: make: Refactor manual publishing, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 3ad940c 086/140: Update documentation, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor db11c10 089/140: Release version 2.8.0, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 46a7b51 090/140: with-editor-{finish, cancel}-hook: No longer ignore global value, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 66bec91 098/140: Release version 2.8.3, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor bc184cf 075/140: Changing heading of library footer section, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 22a581d 076/140: make: Remove deleted pages when publishing manual, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 71e61b9 081/140: with-editor-sleeping-editor: Also print the working directory, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor d3b0bc7 083/140: Update documentation, Jonas Bernoulli, 2021/08/06
- [nongnu] elpa/with-editor 87c96b3 091/140: with-editor-finish: Preserve local git-commit-post-finish-hook, Jonas Bernoulli, 2021/08/06