On 2 December 2016 at 10:20, Eli Zaretskii <eliz@gnu.org> wrote:
Does this work if -batch is added to the switches?

​It depends what you mean by "work". Since, according to the original implementation, only non-option are passed to the ALTERNATE_EDITOR, ​nothing useful happens (that I can see), because Emacs is run as

emacs --batch file1 file2 # etc.

and so it starts up and immediately shuts down. If, for example you try to run

export ALTERNATE_EDITOR="emacs --batch"
emacsclient --eval "(print t)"

then the actual process run is:

emacs --batch "(print t)"

which again does nothing useful. But maybe that's OK, because I am guessing you ask this because:

If so, can you add
​ ​
a test for this capability?

​There seems to be nothing much to check, other than that it returns 0, but that is already sufficient, since with the current implementation,

export ALTERNATE_EDITOR="emacs --batch"
emacsclient foo

Gives the error:

emacsclient: error executing alternate editor "emacs --batch".

​So, I tried to write a test. It works fine except that it doesn't run the right emacsclient binary (instead, it runs the one on my PATH).

Since I can't see any other tests that run built executables from the source tree, I'm not sure how I should go about this (modify PATH? Explicitly patch in srcdir somehow?). Hints appreciated.

I attach an updated patch with the test so far.

--