EDITOR: subsidiary program 'emacs -nw' not found [duplicate]
up vote
0
down vote
favorite
This question already has an answer here:
 Export EDITOR with a flag
 
 1 answer
 
 
I have set up
$ echo $EDITOR
emacs -nw
I was wondering why it is not found here, and how I can solve the problem? Thanks.
$ sdiff -o sdiff.out f1 f2
1 2 3                                 | 2 3 4
%e1
sdiff: subsidiary program 'emacs -nw' not found
I don't know why an option in $EDITOR is a problem, and where it is required in sdiff source code? I guess it is here http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n459
prog = getenv ("EDITOR");
if (prog)
  editor_program = prog;
and here http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1035
execvp (editor_program, (char **) argv);
or http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1018 and http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1024. I am not sure what the program is doing.
For comparison, the following works perfectly fine:
$ eval "$EDITOR"
emacs editors diffutils sdiff
                    marked as duplicate by Jeff Schaller, Thomas, Stephen Kitt, G-Man, Isaac yesterday
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
This question already has an answer here:
 Export EDITOR with a flag
 
 1 answer
 
 
I have set up
$ echo $EDITOR
emacs -nw
I was wondering why it is not found here, and how I can solve the problem? Thanks.
$ sdiff -o sdiff.out f1 f2
1 2 3                                 | 2 3 4
%e1
sdiff: subsidiary program 'emacs -nw' not found
I don't know why an option in $EDITOR is a problem, and where it is required in sdiff source code? I guess it is here http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n459
prog = getenv ("EDITOR");
if (prog)
  editor_program = prog;
and here http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1035
execvp (editor_program, (char **) argv);
or http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1018 and http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1024. I am not sure what the program is doing.
For comparison, the following works perfectly fine:
$ eval "$EDITOR"
emacs editors diffutils sdiff
                    marked as duplicate by Jeff Schaller, Thomas, Stephen Kitt, G-Man, Isaac yesterday
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
 Export EDITOR with a flag
 
 1 answer
 
 
I have set up
$ echo $EDITOR
emacs -nw
I was wondering why it is not found here, and how I can solve the problem? Thanks.
$ sdiff -o sdiff.out f1 f2
1 2 3                                 | 2 3 4
%e1
sdiff: subsidiary program 'emacs -nw' not found
I don't know why an option in $EDITOR is a problem, and where it is required in sdiff source code? I guess it is here http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n459
prog = getenv ("EDITOR");
if (prog)
  editor_program = prog;
and here http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1035
execvp (editor_program, (char **) argv);
or http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1018 and http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1024. I am not sure what the program is doing.
For comparison, the following works perfectly fine:
$ eval "$EDITOR"
emacs editors diffutils sdiff
This question already has an answer here:
 Export EDITOR with a flag
 
 1 answer
 
 
I have set up
$ echo $EDITOR
emacs -nw
I was wondering why it is not found here, and how I can solve the problem? Thanks.
$ sdiff -o sdiff.out f1 f2
1 2 3                                 | 2 3 4
%e1
sdiff: subsidiary program 'emacs -nw' not found
I don't know why an option in $EDITOR is a problem, and where it is required in sdiff source code? I guess it is here http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n459
prog = getenv ("EDITOR");
if (prog)
  editor_program = prog;
and here http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1035
execvp (editor_program, (char **) argv);
or http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1018 and http://git.savannah.gnu.org/cgit/diffutils.git/tree/src/sdiff.c#n1024. I am not sure what the program is doing.
For comparison, the following works perfectly fine:
$ eval "$EDITOR"
This question already has an answer here:
 Export EDITOR with a flag
 
 1 answer
 
 
emacs editors diffutils sdiff
emacs editors diffutils sdiff
edited yesterday
asked yesterday


Tim
1
1
                    marked as duplicate by Jeff Schaller, Thomas, Stephen Kitt, G-Man, Isaac yesterday
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
                    marked as duplicate by Jeff Schaller, Thomas, Stephen Kitt, G-Man, Isaac yesterday
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
                                1 Answer
                                1
                        
active
oldest
votes
up vote
3
down vote
It's apparent that sdiff attempted to execute a program named exactly emacs -nw, which didn't exist. Your intention was for sdiff to call emacs with an option -nw followed by the file(s).
The behavior is confirmed by looking at the sdiff source code, where sdiff populates the preferred editor --directly-- into argv[0], which puts the <space><dash>nw together with the emacs.  You could also confirm that sdiff is generally working correctly by setting EDITOR=emacs and observing that it opens emacs.
If you need the option when opening emacs, then my suggestion would be to create a wrapper script:
$ cat emacs.sh
#!/bin/sh
vi "$@"
Just kidding, of course. You'd use:
$ cat emacs.sh
#!/bin/sh
emacs -nw "$@"
... and then set EDITOR=/path/to/that/emacs.sh
 
 
 1
 
 
 
 
 Did you hack my machine??? The former is exactly what emacs.sh has on it!!! 😂😂😂
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 
 
 
 
 Small suggestion to use- execwhen invoking emacs from the script.
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 1
 
 
 
 
 Indeed, using exec would be a microscopic improvement; one that I noticed only after finding the proposed duplicate. Thanks for the edit!
 – Jeff Schaller
 yesterday
 
 
 
add a comment |
                                1 Answer
                                1
                        
active
oldest
votes
                                1 Answer
                                1
                        
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
It's apparent that sdiff attempted to execute a program named exactly emacs -nw, which didn't exist. Your intention was for sdiff to call emacs with an option -nw followed by the file(s).
The behavior is confirmed by looking at the sdiff source code, where sdiff populates the preferred editor --directly-- into argv[0], which puts the <space><dash>nw together with the emacs.  You could also confirm that sdiff is generally working correctly by setting EDITOR=emacs and observing that it opens emacs.
If you need the option when opening emacs, then my suggestion would be to create a wrapper script:
$ cat emacs.sh
#!/bin/sh
vi "$@"
Just kidding, of course. You'd use:
$ cat emacs.sh
#!/bin/sh
emacs -nw "$@"
... and then set EDITOR=/path/to/that/emacs.sh
 
 
 1
 
 
 
 
 Did you hack my machine??? The former is exactly what emacs.sh has on it!!! 😂😂😂
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 
 
 
 
 Small suggestion to use- execwhen invoking emacs from the script.
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 1
 
 
 
 
 Indeed, using exec would be a microscopic improvement; one that I noticed only after finding the proposed duplicate. Thanks for the edit!
 – Jeff Schaller
 yesterday
 
 
 
add a comment |
up vote
3
down vote
It's apparent that sdiff attempted to execute a program named exactly emacs -nw, which didn't exist. Your intention was for sdiff to call emacs with an option -nw followed by the file(s).
The behavior is confirmed by looking at the sdiff source code, where sdiff populates the preferred editor --directly-- into argv[0], which puts the <space><dash>nw together with the emacs.  You could also confirm that sdiff is generally working correctly by setting EDITOR=emacs and observing that it opens emacs.
If you need the option when opening emacs, then my suggestion would be to create a wrapper script:
$ cat emacs.sh
#!/bin/sh
vi "$@"
Just kidding, of course. You'd use:
$ cat emacs.sh
#!/bin/sh
emacs -nw "$@"
... and then set EDITOR=/path/to/that/emacs.sh
 
 
 1
 
 
 
 
 Did you hack my machine??? The former is exactly what emacs.sh has on it!!! 😂😂😂
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 
 
 
 
 Small suggestion to use- execwhen invoking emacs from the script.
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 1
 
 
 
 
 Indeed, using exec would be a microscopic improvement; one that I noticed only after finding the proposed duplicate. Thanks for the edit!
 – Jeff Schaller
 yesterday
 
 
 
add a comment |
up vote
3
down vote
up vote
3
down vote
It's apparent that sdiff attempted to execute a program named exactly emacs -nw, which didn't exist. Your intention was for sdiff to call emacs with an option -nw followed by the file(s).
The behavior is confirmed by looking at the sdiff source code, where sdiff populates the preferred editor --directly-- into argv[0], which puts the <space><dash>nw together with the emacs.  You could also confirm that sdiff is generally working correctly by setting EDITOR=emacs and observing that it opens emacs.
If you need the option when opening emacs, then my suggestion would be to create a wrapper script:
$ cat emacs.sh
#!/bin/sh
vi "$@"
Just kidding, of course. You'd use:
$ cat emacs.sh
#!/bin/sh
emacs -nw "$@"
... and then set EDITOR=/path/to/that/emacs.sh
It's apparent that sdiff attempted to execute a program named exactly emacs -nw, which didn't exist. Your intention was for sdiff to call emacs with an option -nw followed by the file(s).
The behavior is confirmed by looking at the sdiff source code, where sdiff populates the preferred editor --directly-- into argv[0], which puts the <space><dash>nw together with the emacs.  You could also confirm that sdiff is generally working correctly by setting EDITOR=emacs and observing that it opens emacs.
If you need the option when opening emacs, then my suggestion would be to create a wrapper script:
$ cat emacs.sh
#!/bin/sh
vi "$@"
Just kidding, of course. You'd use:
$ cat emacs.sh
#!/bin/sh
emacs -nw "$@"
... and then set EDITOR=/path/to/that/emacs.sh
edited yesterday


Filipe Brandenburger
6,1041625
6,1041625
answered yesterday


Jeff Schaller
36.1k952119
36.1k952119
 
 
 1
 
 
 
 
 Did you hack my machine??? The former is exactly what emacs.sh has on it!!! 😂😂😂
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 
 
 
 
 Small suggestion to use- execwhen invoking emacs from the script.
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 1
 
 
 
 
 Indeed, using exec would be a microscopic improvement; one that I noticed only after finding the proposed duplicate. Thanks for the edit!
 – Jeff Schaller
 yesterday
 
 
 
add a comment |
 
 
 1
 
 
 
 
 Did you hack my machine??? The former is exactly what emacs.sh has on it!!! 😂😂😂
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 
 
 
 
 Small suggestion to use- execwhen invoking emacs from the script.
 – Filipe Brandenburger
 yesterday
 
 
 
 
 
 1
 
 
 
 
 Indeed, using exec would be a microscopic improvement; one that I noticed only after finding the proposed duplicate. Thanks for the edit!
 – Jeff Schaller
 yesterday
 
 
 
1
1
Did you hack my machine??? The former is exactly what emacs.sh has on it!!! 😂😂😂
– Filipe Brandenburger
yesterday
Did you hack my machine??? The former is exactly what emacs.sh has on it!!! 😂😂😂
– Filipe Brandenburger
yesterday
Small suggestion to use
exec when invoking emacs from the script.– Filipe Brandenburger
yesterday
Small suggestion to use
exec when invoking emacs from the script.– Filipe Brandenburger
yesterday
1
1
Indeed, using exec would be a microscopic improvement; one that I noticed only after finding the proposed duplicate. Thanks for the edit!
– Jeff Schaller
yesterday
Indeed, using exec would be a microscopic improvement; one that I noticed only after finding the proposed duplicate. Thanks for the edit!
– Jeff Schaller
yesterday
add a comment |