Subject: Re: bug#59388: Open emacsclient file at last line

From: Eli Zaretskii <[email-masked]>
Date: Sun, 20 Nov 2022 21:00:20 +0200

> Date: Sun, 20 Nov 2022 10:49:10 -0800
> Cc: [email-masked], [email-masked], [email-masked]
> From: Jim Porter <[email-masked]>
> 
> > Then I think I'm okay with adding --funcall to emacsclient, as a solution
> > for this feature request.  With the proviso that the named function will be
> > called _after_ visiting the named FILE, right?
> 
> Assuming it's possible, I think the most flexible, obvious, and 
> consistent[1] way for it to work would be to obey the order of the 
> arguments. So "emacsclient --funcall func file.txt" calls func and then 
> visits file.txt, whereas "emacsclient file.txt --funcall func" visits 
> file.txt and then calls func.

This won't work, because emacsclient thinks everything after the first FILE
cannot be an option.  Which is why +LINE:COLUMN FILE works, although LINE
and COLUMN refer to FILE that comes after it.

We can invoke functions in the order of --funcall's, but they should run
after visiting the file.  Nothing else makes sense, and was never possible
with emacsclient anyway.

So I stand by what I wrote: --funcall'ed functions should run after
visiting FILE.  It's not a problem, as you can see from the implementation
of -position in the protocol.