GNU bug report logs - #59388
Open emacsclient file at last line

Previous Next

Package: emacs;

Reported by: Janek F <xerusx <at> pm.me>

Date: Sat, 19 Nov 2022 15:45:02 UTC

Severity: wishlist

To reply to this bug, email your comments to 59388 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 15:45:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Janek F <xerusx <at> pm.me>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 19 Nov 2022 15:45:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Janek F <xerusx <at> pm.me>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 11:57:25 +0000
Hello,

I don't think there is any option right now to start emacsclient on the last line of the file, barring adding lots of 9's.

For nvim and vi, one can simply omit the line number after the plus,
I think this would also be a sensible choice for emacsclient:

  ❯ emacsclient vlcrc +
  Waiting for Emacs...
  *ERROR*: Invalid -position command in client args
  ❯ nvim vlcrc +
  ❯ vi vlcrc +

Best,
Janek




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 15:49:02 GMT) Full text and rfc822 format available.

Message #8 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Janek F <xerusx <at> pm.me>
Cc: 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 17:48:25 +0200
> Date: Sat, 19 Nov 2022 11:57:25 +0000
> From:  Janek F via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Hello,
> 
> I don't think there is any option right now to start emacsclient on the last line of the file, barring adding lots of 9's.

What about the --eval command-line option of emacsclient?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 17:11:02 GMT) Full text and rfc822 format available.

Message #11 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Janek F <xerusx <at> pm.me>, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 17:10:02 +0000
[Message part 1 (text/plain, inline)]
>> I don't think there is any option right now to start emacsclient on the 
>> last line of the file, barring adding lots of 9's.
>
> What about the --eval command-line option of emacsclient?
>

It's not very convenient, you'd have to put the filename inside the 
expression.  What do you think of the attached patch?
[Add-option-to-visit-the-end-of-a-file.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 18:04:01 GMT) Full text and rfc822 format available.

Message #14 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 20:03:15 +0200
> Date: Sat, 19 Nov 2022 17:10:02 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: Janek F <xerusx <at> pm.me>, 59388 <at> debbugs.gnu.org
> 
> >> I don't think there is any option right now to start emacsclient on the 
> >> last line of the file, barring adding lots of 9's.
> >
> > What about the --eval command-line option of emacsclient?
> >
> 
> It's not very convenient, you'd have to put the filename inside the 
> expression.

You are probably assuming something very specific about the expression
after --eval.

> What do you think of the attached patch?

I see no important use cases for this generalization.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 18:08:02 GMT) Full text and rfc822 format available.

Message #17 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 18:07:15 +0000
>> It's not very convenient, you'd have to put the filename inside the 
>> expression.
>
> You are probably assuming something very specific about the expression 
> after --eval.
>

Hmmm...  I must be missing something.  What do you mean?  emacsclient 
--eval means "do not visit files but instead evaluate the arguments as 
Emacs Lisp expressions".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 18:18:02 GMT) Full text and rfc822 format available.

Message #20 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 20:17:39 +0200
> Date: Sat, 19 Nov 2022 18:07:15 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
> 
> 
> >> It's not very convenient, you'd have to put the filename inside the 
> >> expression.
> >
> > You are probably assuming something very specific about the expression 
> > after --eval.
> >
> 
> Hmmm...  I must be missing something.  What do you mean?  emacsclient 
> --eval means "do not visit files but instead evaluate the arguments as 
> Emacs Lisp expressions".

Maybe I didn't understand what you mean by "put the filename inside the
expression".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 18:22:02 GMT) Full text and rfc822 format available.

Message #23 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 18:21:26 +0000
>> Hmmm...  I must be missing something.  What do you mean?  emacsclient 
>> --eval means "do not visit files but instead evaluate the arguments as 
>> Emacs Lisp expressions".
>
> Maybe I didn't understand what you mean by "put the filename inside the 
> expression".
>

Well, to achieve what he wants Janek would have to do something like

emacsclient --eval '(progn (find-file "FILE") (goto-char (point-max)))'

And that also means that the default (waiting) mode of emacsclient is not 
available.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 18:33:01 GMT) Full text and rfc822 format available.

Message #26 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 20:32:14 +0200
> Date: Sat, 19 Nov 2022 18:21:26 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
> 
> Well, to achieve what he wants Janek would have to do something like
> 
> emacsclient --eval '(progn (find-file "FILE") (goto-char (point-max)))'
> 
> And that also means that the default (waiting) mode of emacsclient is not 
> available.

And that is a problem?  This use case is explicitly for human use (in contrast
to the +LINE:COLUMN FILE case which is for programs that call $EDITOR).  And it
is a rare use case on top of that.  So why typing a few words is a problem, and
why does it justify yet another tweak of the UI?

But if we do want to make this easier, I'd go with a new command-line switch,
say, "--eob".  The Vim way is cryptic and error-prone, so I don't think we
should do the same.  And I don't see at all why would someone needs to say "N
lines from EOF".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 19:07:02 GMT) Full text and rfc822 format available.

Message #29 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 19:05:57 +0000
>> And that also means that the default (waiting) mode of emacsclient is 
>> not available.
>
> And that is a problem?  This use case is explicitly for human use (in 
> contrast to the +LINE:COLUMN FILE case which is for programs that call 
> $EDITOR).  And it is a rare use case on top of that.  So why typing a 
> few words is a problem, and why does it justify yet another tweak of the 
> UI?
>

I don't know, but I'd say that the added complexity is minimal for 
something that looks like a legitimate use case.

>
> But if we do want to make this easier, I'd go with a new command-line 
> switch, say, "--eob".  The Vim way is cryptic and error-prone, so I 
> don't think we should do the same.  And I don't see at all why would 
> someone needs to say "N lines from EOF".
>

One possible use case is "open a log file to look at the last N entries".




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 19:38:01 GMT) Full text and rfc822 format available.

Message #32 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 21:37:56 +0200
> Date: Sat, 19 Nov 2022 19:05:57 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
> 
> > But if we do want to make this easier, I'd go with a new command-line 
> > switch, say, "--eob".  The Vim way is cryptic and error-prone, so I 
> > don't think we should do the same.  And I don't see at all why would 
> > someone needs to say "N lines from EOF".
> 
> One possible use case is "open a log file to look at the last N entries".

Going to EOB displays more than just the last line.

And the request was only to be able to go to EOB.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 20:09:02 GMT) Full text and rfc822 format available.

Message #35 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Gregory Heytings <gregory <at> heytings.org>, Eli Zaretskii <eliz <at> gnu.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 12:08:06 -0800
On 11/19/2022 10:07 AM, Gregory Heytings wrote:
> Hmmm...  I must be missing something.  What do you mean?  emacsclient 
> --eval means "do not visit files but instead evaluate the arguments as 
> Emacs Lisp expressions".

I have two thoughts about this:

1. Why does --eval do that? You can mix filenames and --eval with the
   regular emacs program:

     emacs -Q foo.txt --eval '(message "hi")'

   Why doesn't emacsclient work similarly? (On the other hand, changing
   this might break compatibility, so we should be careful here.)

2. Assuming we don't change --eval as above, maybe the proposed --apply
   option discussed in bug#57752 could work:

     emacsclient --apply end-of-buffer -- foo.c

   I believe this would even work if you defined a shell alias like so:

     alias edit=end="emacsclient --apply end-of-buffer --"
     edit-end foo.txt

   That said, adding --apply to emacsclient (and emacs, too!) seemed
   like a fair bit of work when I looked at it...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 20:21:01 GMT) Full text and rfc822 format available.

Message #38 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 20:20:46 +0000
[Message part 1 (text/plain, inline)]
>>> But if we do want to make this easier, I'd go with a new command-line 
>>> switch, say, "--eob".  The Vim way is cryptic and error-prone, so I 
>>> don't think we should do the same.  And I don't see at all why would 
>>> someone needs to say "N lines from EOF".
>>
>> One possible use case is "open a log file to look at the last N 
>> entries".
>
> Going to EOB displays more than just the last line.
>

Yes, but point is not on the Nth line counting from EOF.

>
> And the request was only to be able to go to EOB.
>

Indeed.  Like you I didn't like the Vim way, so I tried to imagine 
something better.  But I don't think TRT here is to add yet another 
command line switch, when an already existing one can be extended 
naturally to do the same thing.

Anyway, that was just a proposal, somehow I feel you don't like it, so I 
don't think it's useful to continue arguing.  I attach it again (I forgot 
a modification to the Emacs manpage in the previous one) just in case.
[Add-option-to-visit-the-end-of-a-file.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 20:34:02 GMT) Full text and rfc822 format available.

Message #41 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 22:33:16 +0200
> Date: Sat, 19 Nov 2022 12:08:06 -0800
> Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
> 
> 1. Why does --eval do that? You can mix filenames and --eval with the
>     regular emacs program:
> 
>       emacs -Q foo.txt --eval '(message "hi")'
> 
>     Why doesn't emacsclient work similarly? (On the other hand, changing
>     this might break compatibility, so we should be careful here.)

I don't think we can change the semantics of --eval.

> 2. Assuming we don't change --eval as above, maybe the proposed --apply
>     option discussed in bug#57752 could work:
> 
>       emacsclient --apply end-of-buffer -- foo.c
> 
>     I believe this would even work if you defined a shell alias like so:
> 
>       alias edit=end="emacsclient --apply end-of-buffer --"
>       edit-end foo.txt
> 
>     That said, adding --apply to emacsclient (and emacs, too!) seemed
>     like a fair bit of work when I looked at it...

Maybe we don't need to go as far as that discussion led us?  Just adding a
switch --funcall, to mimic what Emacs has, could be enough?  Then we'd be
able to say

  emacsclient -f eob FILE

(assuming we also add a function 'eob' to Emacs).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sat, 19 Nov 2022 23:07:01 GMT) Full text and rfc822 format available.

Message #44 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sat, 19 Nov 2022 15:06:14 -0800
On 11/19/2022 12:33 PM, Eli Zaretskii wrote:
>> Date: Sat, 19 Nov 2022 12:08:06 -0800
>> Cc: xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>> 1. Why does --eval do that? You can mix filenames and --eval with the
>>      regular emacs program:
>>
>>        emacs -Q foo.txt --eval '(message "hi")'
>>
>>      Why doesn't emacsclient work similarly? (On the other hand, changing
>>      this might break compatibility, so we should be careful here.)
> 
> I don't think we can change the semantics of --eval.

Yeah, probably not. I'm not sure how important fixing this inconsistency 
is, but if we *were* to fix it, I think the least-disruptive would be to 
add a new option like "emacsclient --eval-one" that behaves like "emacs 
--eval" and add an obsoletion warning to "emacsclient --eval". Then, 
after a few versions, make "emacsclient --eval" work like "emacsclient 
--eval-one".

This might be more effort than it's worth though...

> Maybe we don't need to go as far as that discussion led us?  Just adding a
> switch --funcall, to mimic what Emacs has, could be enough?  Then we'd be
> able to say
> 
>    emacsclient -f eob FILE
> 
> (assuming we also add a function 'eob' to Emacs).

With the caveat that -f is already used for --server-file, I think this 
would be fine. --funcall is a lot simpler to implement than --apply, at 
least from emacsclient.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sun, 20 Nov 2022 07:23:01 GMT) Full text and rfc822 format available.

Message #47 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sun, 20 Nov 2022 09:22:27 +0200
> Date: Sat, 19 Nov 2022 15:06:14 -0800
> Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
> 
> On 11/19/2022 12:33 PM, Eli Zaretskii wrote:
> > Maybe we don't need to go as far as that discussion led us?  Just adding a
> > switch --funcall, to mimic what Emacs has, could be enough?  Then we'd be
> > able to say
> > 
> >    emacsclient -f eob FILE
> > 
> > (assuming we also add a function 'eob' to Emacs).
> 
> With the caveat that -f is already used for --server-file, I think this 
> would be fine. --funcall is a lot simpler to implement than --apply, at 
> least from emacsclient.

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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sun, 20 Nov 2022 18:50:01 GMT) Full text and rfc822 format available.

Message #50 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sun, 20 Nov 2022 10:49:10 -0800
On 11/19/2022 11:22 PM, Eli Zaretskii wrote:
>> Date: Sat, 19 Nov 2022 15:06:14 -0800
>> Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>> On 11/19/2022 12:33 PM, Eli Zaretskii wrote:
>>> Maybe we don't need to go as far as that discussion led us?  Just adding a
>>> switch --funcall, to mimic what Emacs has, could be enough?  Then we'd be
>>> able to say
>>>
>>>     emacsclient -f eob FILE
>>>
>>> (assuming we also add a function 'eob' to Emacs).
>>
>> With the caveat that -f is already used for --server-file, I think this
>> would be fine. --funcall is a lot simpler to implement than --apply, at
>> least from emacsclient.
> 
> 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.

The downside of this is that it's a little bit trickier to write an 
alias for the case in this bug. 'alias edit-end="emacsclient --funcall 
end-of-buffer"' wouldn't do the right thing.

I don't think that's a problem though, since the original proposal had 
the same limitation: the "+" comes after the file, as in "emacsclient 
file.txt +". So my suggestion above would work just like the original 
proposal except that "+" is spelled differently.

[1] This is how --funcall works with the regular emacs executable, as 
far as I can tell.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sun, 20 Nov 2022 19:01:02 GMT) Full text and rfc822 format available.

Message #53 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sun, 20 Nov 2022 21:00:20 +0200
> Date: Sun, 20 Nov 2022 10:49:10 -0800
> Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
> 
> > 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Sun, 20 Nov 2022 19:39:02 GMT) Full text and rfc822 format available.

Message #56 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Sun, 20 Nov 2022 11:37:51 -0800
On 11/20/2022 11:00 AM, Eli Zaretskii wrote:
>> Date: Sun, 20 Nov 2022 10:49:10 -0800
>> Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>>> 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.

Ok, then I think your proposal is fine.

(Though these surprising differences between how "emacs" and 
"emacsclient" handle arguments are making me wonder about reimplementing 
the client, perhaps as "emacs-client" with a hyphen. Maybe it's worth an 
experiment at least. That obviously doesn't have to happen as part of 
this bug though.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Mon, 21 Nov 2022 08:57:02 GMT) Full text and rfc822 format available.

Message #59 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, xerusx <at> pm.me, gregory <at> heytings.org,
 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Mon, 21 Nov 2022 11:52:48 +0300
* Jim Porter <jporterbugs <at> gmail.com> [2022-11-20 21:51]:
> 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.

I am sure that `-e' can be used to do that all.

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Mon, 21 Nov 2022 08:57:02 GMT) Full text and rfc822 format available.

Message #62 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Jean Louis <bugs <at> gnu.support>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Jim Porter <jporterbugs <at> gmail.com>, gregory <at> heytings.org, xerusx <at> pm.me,
 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Mon, 21 Nov 2022 11:55:34 +0300
* Eli Zaretskii <eliz <at> gnu.org> [2022-11-20 22:01]:
> 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.

I use `-e' to open new frame seeking for specific buffer, or invoking
specific functions.

> 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.

--funcall is similar as `-e' only limited to single function. So I
  suggest that when you implement that, that --funcall may be used
  also without any file, such as emacsclient -c --funcall my-function
  as that way I can invoke necessary programs.

Though it is not logical to tie a "funcall" to file, file may not be
there, or it could be new file, or new frame created, or --funcall can
do useful things in the existing server.

--
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Mon, 21 Nov 2022 13:36:02 GMT) Full text and rfc822 format available.

Message #65 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: jporterbugs <at> gmail.com, gregory <at> heytings.org, xerusx <at> pm.me,
 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Mon, 21 Nov 2022 15:35:04 +0200
> Date: Mon, 21 Nov 2022 11:52:48 +0300
> From: Jean Louis <bugs <at> gnu.support>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, gregory <at> heytings.org, xerusx <at> pm.me,
>   59388 <at> debbugs.gnu.org
> 
> * Jim Porter <jporterbugs <at> gmail.com> [2022-11-20 21:51]:
> > 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.
> 
> I am sure that `-e' can be used to do that all.

I guess you haven't read the discussion, because this was mentioned
up-thread, and we still arrived at the above after talking about it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Mon, 21 Nov 2022 13:37:02 GMT) Full text and rfc822 format available.

Message #68 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jean Louis <bugs <at> gnu.support>
Cc: jporterbugs <at> gmail.com, gregory <at> heytings.org, xerusx <at> pm.me,
 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Mon, 21 Nov 2022 15:36:35 +0200
> Date: Mon, 21 Nov 2022 11:55:34 +0300
> From: Jean Louis <bugs <at> gnu.support>
> Cc: Jim Porter <jporterbugs <at> gmail.com>, gregory <at> heytings.org,
>   xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
> 
> * Eli Zaretskii <eliz <at> gnu.org> [2022-11-20 22:01]:
> > 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.
> 
> I use `-e' to open new frame seeking for specific buffer, or invoking
> specific functions.

Again, please read the discussion before chiming in.  This is, of course,
possible, but people provided convincing reasons why it can be sometimes not
very convenient.

> > 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.
> 
> --funcall is similar as `-e' only limited to single function. So I
>   suggest that when you implement that, that --funcall may be used
>   also without any file, such as emacsclient -c --funcall my-function
>   as that way I can invoke necessary programs.

This is redundant, since -e already allows that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#59388; Package emacs. (Mon, 21 Nov 2022 17:52:01 GMT) Full text and rfc822 format available.

Message #71 received at 59388 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>, Jean Louis <bugs <at> gnu.support>
Cc: gregory <at> heytings.org, xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
Subject: Re: bug#59388: Open emacsclient file at last line
Date: Mon, 21 Nov 2022 09:50:49 -0800
On 11/21/2022 5:36 AM, Eli Zaretskii wrote:
>> Date: Mon, 21 Nov 2022 11:55:34 +0300
>> From: Jean Louis <bugs <at> gnu.support>
>> Cc: Jim Porter <jporterbugs <at> gmail.com>, gregory <at> heytings.org,
>>    xerusx <at> pm.me, 59388 <at> debbugs.gnu.org
>>
>> --funcall is similar as `-e' only limited to single function. So I
>>    suggest that when you implement that, that --funcall may be used
>>    also without any file, such as emacsclient -c --funcall my-function
>>    as that way I can invoke necessary programs.
> 
> This is redundant, since -e already allows that.

I don't think there'd be a *problem* if --funcall without a file was 
allowed. As you say, it's not necessary, since you can already do this 
with -e, but --funcall with no files has precedent with the regular 
emacs executable, so I think it'd be reasonable for emacsclient to do it 
too. It's probably not a big deal either way though, given that emacs 
and emacsclient already treat options quite differently.




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 24 Nov 2022 18:27:01 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 203 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.