Comments (4)
The problem seems to be with systemctl
:
$ systemctl --force --user edit foobar
"WITH-EDITOR:: 1: "WITH-EDITOR:: Syntax error: Unterminated quoted string
editor failed with error code 2.
Editing "/home/jonas/.config/systemd/user/foobar.service" canceled: temporary file is empty.
$ git commit --allow-empty
WITH-EDITOR: 13488 OPEN /home/jonas/.git/modules/emacs.d/modules/with-editor/COMMIT_EDITMSG
[gelpa 2d6f50c] test
$
Could you please try to find some documentation about what assumptions it makes about the value of $EDITOR
? It looks like it some how chops of part of it. The value set by with-editor
looks like sh -c '...'
.
from with-editor.
In man systemctl
, it just says:
ENVIRONMENT
$SYSTEMD_EDITOR
Editor to use when editing units; overrides $EDITOR and $VISUAL. If neither $SYSTEMD_EDITOR nor $EDITOR nor $VISUAL are present or if it is set
to an empty string or if their execution failed, systemctl will try to execute well known editors in this order: editor(1), nano(1), vim(1),
vi(1).
from with-editor.
Similar problem in Emacs Bug#9051/25082:
The documentation in environ(7) just says:
EDITOR/VISUAL The user's preferred utility to edit text files.
However, I can't find a program that interprets it as a literal filename.
For example, Debian's sensible-editor editor-wrapper script does exactly
what I just did. If I setexport EDITOR='"spacey editor"'
it complains it can't find a program called: "spacey
If I do
export EDITOR="emacsclient -c"
it works nicely. So it doesn't parse quotes specially. However, that's not
cross-platform.
from with-editor.
Similar problem in Emacs
But that is the only relation to the issue at hand. The problem in this case isn't that Emacs doesn't attempt to handle ALTERNATE_EDITOR
as one would expect but that systemd
, while trying to do so, actually fails to handle EDITOR
/SYSTEMD_EDITOR
as one would expect.
systemd
can handle something like EDITOR="emacsclient -c"
. However if the value contains a quote or double quote, then it fails:
% SYSTEMD_EDITOR="sh -c \"echo huhu\"" systemctl --force --user edit foobar
huhu": 1: huhu": Syntax error: Unterminated quoted string
editor failed with error code 2.
Editing "/home/jonas/.config/systemd/user/foobar.service" canceled: temporary file is empty.
% SYSTEMD_EDITOR="sh -c 'echo huhu'" systemctl --force --user edit foobar
huhu': 1: huhu': Syntax error: Unterminated quoted string
editor failed with error code 2.
Editing "/home/jonas/.config/systemd/user/foobar.service" canceled: temporary file is empty.
There is nothing we can do here to work around this issue, so I am closing this.
from with-editor.
Related Issues (20)
- `export` output on new terminal buffers HOT 2
- No output in eshell on with-editor export HOT 2
- with-editor fails in term-mode. HOT 10
- `git` not found, despite `magit-git-executable` being set. HOT 15
- sleeping editor does not set `with-editor-previous-winconf` HOT 4
- Cannot commit from Magit on Windows 11
- magit-commit editor breakage after updating emacs master HOT 12
- unexpected EOF while looking for matching `'' trying to edit agenix secret with `agenix -e` HOT 1
- Cannot determine a suitable Emacsclient HOT 2
- shell-commands not seeing $EDITOR override HOT 5
- EDITOR setting in vterm breaks remote programs calling EDITOR HOT 2
- When cancelling an edit, why do we send USR2 instead of USR1? HOT 4
- homebrew emacs-plus breaks with-editor--setup HOT 10
- Can't call emacsclient.exe on Windows HOT 7
- [BUG] make-process--with-editor-process-filter: Creating pipe: Too many open files HOT 6
- Emacs Snap installation - unable to commit via magit HOT 3
- Failure after update of Emacs from 28.2 to 29.1 HOT 1
- shell-command-with-editor-mode: path is treated as local for remote files HOT 2
- Can we make this delay configurable? HOT 7
- Activating and leaving with-editor-mode deletes files without warning HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from with-editor.