unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#59388: Open emacsclient file at last line
@ 2022-11-19 11:57 Janek F via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2022-11-19 15:48 ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Janek F via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-11-19 11:57 UTC (permalink / raw)
  To: 59388

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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 11:57 bug#59388: Open emacsclient file at last line Janek F via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-11-19 15:48 ` Eli Zaretskii
  2022-11-19 17:10   ` Gregory Heytings
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-19 15:48 UTC (permalink / raw)
  To: Janek F; +Cc: 59388

> 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@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?





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 15:48 ` Eli Zaretskii
@ 2022-11-19 17:10   ` Gregory Heytings
  2022-11-19 18:03     ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Gregory Heytings @ 2022-11-19 17:10 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Janek F, 59388

[-- Attachment #1: Type: text/plain, Size: 318 bytes --]


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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Add-option-to-visit-the-end-of-a-file.patch --]
[-- Type: text/x-diff; name=Add-option-to-visit-the-end-of-a-file.patch, Size: 8761 bytes --]

From c2992ed2da5b0225bec25be82ef868ae835cac89 Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Sat, 19 Nov 2022 17:08:10 +0000
Subject: [PATCH] Add option to visit the end of a file.

* lisp/startup.el (command-line-1): Count from the end of the file
when the line number is negative.

* lisp/server.el (server-process-filter): Allow negative line numbers.
(server-goto-line-column): Count from the end of the file when the
line number is negative.

* src/emacs.c (usage_message): Mention the optional '-'.

* lib-src/emacsclient.c (main): Allow negative line numbers.
(print_help_and_exit): Mention the optional '-'.

* doc/emacs/cmdargs.texi (Action Arguments):
* doc/emacs/misc.texi (emacsclient Options):
* doc/man/emacs.1.in:
* doc/man/emacsclient.1:
Document negative line numbers.
---
 doc/emacs/cmdargs.texi |  9 +++++++++
 doc/emacs/misc.texi    |  8 +++++---
 doc/man/emacs.1.in     |  4 +++-
 doc/man/emacsclient.1  |  7 ++++---
 lib-src/emacsclient.c  |  3 ++-
 lisp/server.el         | 11 ++++++++---
 lisp/startup.el        | 15 ++++++++++-----
 src/emacs.c            |  4 ++--
 8 files changed, 43 insertions(+), 18 deletions(-)

diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 0f7acd8797..4a7484860a 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -119,6 +119,15 @@ Action Arguments
 Visit the specified @var{file}, then go to line number @var{linenum}
 and put point at column number @var{columnnum}.
 
+@item +-@var{linenum} @var{file}
+Visit the specified @var{file}, then go to line number @var{linenum}
+in it, counting from the end of the file.
+
+@item +-@var{linenum}:@var{columnnum} @var{file}
+Visit the specified @var{file}, then go to line number @var{linenum},
+counting from the end of the file, and put point at column number
+@var{columnnum}.
+
 @item -l @var{file}
 @opindex -l
 @itemx --load=@var{file}
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 29c0bed19c..240d408a10 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2011,10 +2011,12 @@ emacsclient Options
 @end example
 
 @noindent
-The @samp{+@var{line}} or @samp{+@var{line}:@var{column}} arguments
+The @samp{+@var{line}}, @samp{+@var{line}:@var{column}},
+@samp{+-@var{line}} or @samp{+-@var{line}:@var{column}} arguments
 specify line numbers, or line and column numbers, for the next file
-argument.  These behave like the command line arguments for Emacs
-itself.  @xref{Action Arguments}.
+argument.  With a negative line number, the actual line is counted
+from the end of the file.  These behave like the command line
+arguments for Emacs itself.  @xref{Action Arguments}.
 
   The other optional arguments recognized by @command{emacsclient} are
 listed below:
diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in
index 7b2b553979..3856c3b1c5 100644
--- a/doc/man/emacs.1.in
+++ b/doc/man/emacs.1.in
@@ -66,11 +66,13 @@ The same as specifying
 .I file
 directly as an argument.
 .TP
-.BI + number
+.BI + \fR[-]\fPnumber
 Go to the line specified by
 .I number
 (do not insert a space between the "+" sign and
 the number).
+With a negative line number, the actual line is counted
+from the end of the file.
 This applies only to the next file specified.
 .TP
 .BI + line:column
diff --git a/doc/man/emacsclient.1 b/doc/man/emacsclient.1
index 83c8a366f8..53af0dad43 100644
--- a/doc/man/emacsclient.1
+++ b/doc/man/emacsclient.1
@@ -50,15 +50,16 @@ If you set the variable "server-window" to a window or a frame, "C-x
 Most options follow the usual GNU command line syntax, with long
 options starting with two dashes ("\-").
 .TP
-.BI + line\fR[\fP\fB:\fPcolumn\fR]\fP
+.BI + \fR[-]\fPline\fR[\fP\fB:\fPcolumn\fR]\fP
 Go to the specified
 .I line
 and
 .IR column .
 A missing
 .I column
-is treated as column 1.
-This option applies only to the next file specified.
+is treated as column 1.  With a negative line number, the actual line
+is counted from the end of the file.  This option applies only to the
+next file specified.
 .TP
 .B \-a, \-\-alternate-editor=COMMAND
 If the Emacs server is not running, run the specified shell command instead.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 425db8cfac..948c1a8f0f 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -674,7 +674,7 @@ print_help_and_exit (void)
   message (false,
 	   "Usage: %s [OPTIONS] FILE...\n%s%s%s", progname, "\
 Tell the Emacs server to visit the specified files.\n\
-Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\
+Every FILE can be either just a FILENAME or [+[-]LINE[:COLUMN]] FILENAME.\n\
 \n\
 The following OPTIONS are accepted:\n\
 -V, --version		Just print version info and return\n\
@@ -2083,6 +2083,7 @@ main (int argc, char **argv)
 	  if (*p == '+')
             {
 	      unsigned char c;
+	      if (*(p + 1) == '-') p++;
 	      do
 		c = *++p;
 	      while (isdigit (c) || c == ':');
diff --git a/lisp/server.el b/lisp/server.el
index 553890ce29..37ccf7b9f4 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1237,7 +1237,7 @@ server-process-filter
                 ;; -position +LINE[:COLUMN]:  Set point to the given
                 ;;  position in the next file.
                 ("-position"
-                 (if (not (string-match "\\+\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?"
+                 (if (not (string-match "\\+\\(-?[0-9]+\\)\\(?::\\([0-9]+\\)\\)?"
                                         (car args-left)))
                      (error "Invalid -position command in client args"))
                  (let ((arg (pop args-left)))
@@ -1437,8 +1437,13 @@ server-goto-line-column
   "Move point to the position indicated in LINE-COL.
 LINE-COL should be a pair (LINE . COL)."
   (when line-col
-    (goto-char (point-min))
-    (forward-line (1- (car line-col)))
+    (if (>= (car line-col) 0)
+        (progn
+          (goto-char (point-min))
+          (forward-line (1- (car line-col))))
+      (progn
+        (goto-char (point-max))
+        (forward-line (car line-col))))
     (let ((column-number (cdr line-col)))
       (when (> column-number 0)
         (move-to-column (1- column-number))))))
diff --git a/lisp/startup.el b/lisp/startup.el
index 5e0a47d3f8..7cbd7687ad 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2570,8 +2570,13 @@ command-line-1
                       ;; Put the point at `line':`column' in the file
                       ;; buffer, and reset `line' and `column' to 0.
                       (unless (zerop line)
-                        (goto-char (point-min))
-                        (forward-line (1- line)))
+                        (if (>= line 0)
+                            (progn
+                              (goto-char (point-min))
+                              (forward-line (1- line)))
+                          (progn
+                            (goto-char (point-max))
+                            (forward-line line))))
                       (setq line 0)
                       (unless (< column 1)
                         (move-to-column (1- column)))
@@ -2718,10 +2723,10 @@ command-line-1
                     ((equal argi "-no-desktop")
                      (message "\"--no-desktop\" ignored because the Desktop package is not loaded"))
 
-                    ((string-match "^\\+[0-9]+\\'" argi)
-                     (setq line (string-to-number argi)))
+                    ((string-match "^\\+\\(-?[0-9]+\\)\\'" argi)
+                     (setq line (string-to-number (match-string 1 argi))))
 
-                    ((string-match "^\\+\\([0-9]+\\):\\([0-9]+\\)\\'" argi)
+                    ((string-match "^\\+\\(-?[0-9]+\\):\\([0-9]+\\)\\'" argi)
                      (setq line (string-to-number (match-string 1 argi))
                            column (string-to-number (match-string 2 argi))))
 
diff --git a/src/emacs.c b/src/emacs.c
index 85102acd28..86264df7a9 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -308,8 +308,8 @@ #define MAIN_PROGRAM
 Action options:\n\
 \n\
 FILE                    visit FILE\n\
-+LINE                   go to line LINE in next FILE\n\
-+LINE:COLUMN            go to line LINE, column COLUMN, in next FILE\n\
++[-]LINE                go to line LINE in next FILE\n\
++[-]LINE:COLUMN         go to line LINE, column COLUMN, in next FILE\n\
 --directory, -L DIR     prepend DIR to load-path (with :DIR, append DIR)\n\
 --eval EXPR             evaluate Emacs Lisp expression EXPR\n\
 --execute EXPR          evaluate Emacs Lisp expression EXPR\n\
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 17:10   ` Gregory Heytings
@ 2022-11-19 18:03     ` Eli Zaretskii
  2022-11-19 18:07       ` Gregory Heytings
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-19 18:03 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: xerusx, 59388

> Date: Sat, 19 Nov 2022 17:10:02 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: Janek F <xerusx@pm.me>, 59388@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 18:03     ` Eli Zaretskii
@ 2022-11-19 18:07       ` Gregory Heytings
  2022-11-19 18:17         ` Eli Zaretskii
  2022-11-19 20:08         ` Jim Porter
  0 siblings, 2 replies; 23+ messages in thread
From: Gregory Heytings @ 2022-11-19 18:07 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: xerusx, 59388


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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 18:07       ` Gregory Heytings
@ 2022-11-19 18:17         ` Eli Zaretskii
  2022-11-19 18:21           ` Gregory Heytings
  2022-11-19 20:08         ` Jim Porter
  1 sibling, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-19 18:17 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: xerusx, 59388

> Date: Sat, 19 Nov 2022 18:07:15 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: xerusx@pm.me, 59388@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".





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 18:17         ` Eli Zaretskii
@ 2022-11-19 18:21           ` Gregory Heytings
  2022-11-19 18:32             ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Gregory Heytings @ 2022-11-19 18:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: xerusx, 59388


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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 18:21           ` Gregory Heytings
@ 2022-11-19 18:32             ` Eli Zaretskii
  2022-11-19 19:05               ` Gregory Heytings
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-19 18:32 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: xerusx, 59388

> Date: Sat, 19 Nov 2022 18:21:26 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: xerusx@pm.me, 59388@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".





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 18:32             ` Eli Zaretskii
@ 2022-11-19 19:05               ` Gregory Heytings
  2022-11-19 19:37                 ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Gregory Heytings @ 2022-11-19 19:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: xerusx, 59388


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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 19:05               ` Gregory Heytings
@ 2022-11-19 19:37                 ` Eli Zaretskii
  2022-11-19 20:20                   ` Gregory Heytings
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-19 19:37 UTC (permalink / raw)
  To: Gregory Heytings; +Cc: xerusx, 59388

> Date: Sat, 19 Nov 2022 19:05:57 +0000
> From: Gregory Heytings <gregory@heytings.org>
> cc: xerusx@pm.me, 59388@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 18:07       ` Gregory Heytings
  2022-11-19 18:17         ` Eli Zaretskii
@ 2022-11-19 20:08         ` Jim Porter
  2022-11-19 20:33           ` Eli Zaretskii
  1 sibling, 1 reply; 23+ messages in thread
From: Jim Porter @ 2022-11-19 20:08 UTC (permalink / raw)
  To: Gregory Heytings, Eli Zaretskii; +Cc: xerusx, 59388

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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 19:37                 ` Eli Zaretskii
@ 2022-11-19 20:20                   ` Gregory Heytings
  0 siblings, 0 replies; 23+ messages in thread
From: Gregory Heytings @ 2022-11-19 20:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: xerusx, 59388

[-- Attachment #1: Type: text/plain, Size: 982 bytes --]


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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Add-option-to-visit-the-end-of-a-file.patch --]
[-- Type: text/x-diff; name=Add-option-to-visit-the-end-of-a-file.patch, Size: 8980 bytes --]

From fff94a36a5b83e5b07a170bd7ac8f17406cfb8fb Mon Sep 17 00:00:00 2001
From: Gregory Heytings <gregory@heytings.org>
Date: Sat, 19 Nov 2022 17:50:34 +0000
Subject: [PATCH] Add option to visit the end of a file.

* lisp/startup.el (command-line-1): Count from the end of the file
when the line number is negative.

* lisp/server.el (server-process-filter): Allow negative line numbers.
(server-goto-line-column): Count from the end of the file when the
line number is negative.

* src/emacs.c (usage_message): Mention the optional '-'.

* lib-src/emacsclient.c (main): Allow negative line numbers.
(print_help_and_exit): Mention the optional '-'.

* doc/emacs/cmdargs.texi (Action Arguments):
* doc/emacs/misc.texi (emacsclient Options):
* doc/man/emacs.1.in:
* doc/man/emacsclient.1:
Document negative line numbers.
---
 doc/emacs/cmdargs.texi |  9 +++++++++
 doc/emacs/misc.texi    |  8 +++++---
 doc/man/emacs.1.in     |  8 ++++++--
 doc/man/emacsclient.1  |  7 ++++---
 lib-src/emacsclient.c  |  3 ++-
 lisp/server.el         | 11 ++++++++---
 lisp/startup.el        | 15 ++++++++++-----
 src/emacs.c            |  4 ++--
 8 files changed, 46 insertions(+), 19 deletions(-)

diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 0f7acd8797..4a7484860a 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -119,6 +119,15 @@ Action Arguments
 Visit the specified @var{file}, then go to line number @var{linenum}
 and put point at column number @var{columnnum}.
 
+@item +-@var{linenum} @var{file}
+Visit the specified @var{file}, then go to line number @var{linenum}
+in it, counting from the end of the file.
+
+@item +-@var{linenum}:@var{columnnum} @var{file}
+Visit the specified @var{file}, then go to line number @var{linenum},
+counting from the end of the file, and put point at column number
+@var{columnnum}.
+
 @item -l @var{file}
 @opindex -l
 @itemx --load=@var{file}
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 29c0bed19c..240d408a10 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2011,10 +2011,12 @@ emacsclient Options
 @end example
 
 @noindent
-The @samp{+@var{line}} or @samp{+@var{line}:@var{column}} arguments
+The @samp{+@var{line}}, @samp{+@var{line}:@var{column}},
+@samp{+-@var{line}} or @samp{+-@var{line}:@var{column}} arguments
 specify line numbers, or line and column numbers, for the next file
-argument.  These behave like the command line arguments for Emacs
-itself.  @xref{Action Arguments}.
+argument.  With a negative line number, the actual line is counted
+from the end of the file.  These behave like the command line
+arguments for Emacs itself.  @xref{Action Arguments}.
 
   The other optional arguments recognized by @command{emacsclient} are
 listed below:
diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in
index 7b2b553979..90025a93af 100644
--- a/doc/man/emacs.1.in
+++ b/doc/man/emacs.1.in
@@ -66,18 +66,22 @@ The same as specifying
 .I file
 directly as an argument.
 .TP
-.BI + number
+.BI + \fR[-]\fPnumber
 Go to the line specified by
 .I number
 (do not insert a space between the "+" sign and
 the number).
+With a negative line number, the actual line is counted
+from the end of the file.
 This applies only to the next file specified.
 .TP
-.BI + line:column
+.BI + \fR[-]\fPline:column
 Go to the specified
 .I line
 and
 .IR column .
+With a negative line number, the actual line is counted
+from the end of the file.
 .TP
 .BI \-\-chdir= "directory"
 Change to
diff --git a/doc/man/emacsclient.1 b/doc/man/emacsclient.1
index 83c8a366f8..53af0dad43 100644
--- a/doc/man/emacsclient.1
+++ b/doc/man/emacsclient.1
@@ -50,15 +50,16 @@ If you set the variable "server-window" to a window or a frame, "C-x
 Most options follow the usual GNU command line syntax, with long
 options starting with two dashes ("\-").
 .TP
-.BI + line\fR[\fP\fB:\fPcolumn\fR]\fP
+.BI + \fR[-]\fPline\fR[\fP\fB:\fPcolumn\fR]\fP
 Go to the specified
 .I line
 and
 .IR column .
 A missing
 .I column
-is treated as column 1.
-This option applies only to the next file specified.
+is treated as column 1.  With a negative line number, the actual line
+is counted from the end of the file.  This option applies only to the
+next file specified.
 .TP
 .B \-a, \-\-alternate-editor=COMMAND
 If the Emacs server is not running, run the specified shell command instead.
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 425db8cfac..948c1a8f0f 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -674,7 +674,7 @@ print_help_and_exit (void)
   message (false,
 	   "Usage: %s [OPTIONS] FILE...\n%s%s%s", progname, "\
 Tell the Emacs server to visit the specified files.\n\
-Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\
+Every FILE can be either just a FILENAME or [+[-]LINE[:COLUMN]] FILENAME.\n\
 \n\
 The following OPTIONS are accepted:\n\
 -V, --version		Just print version info and return\n\
@@ -2083,6 +2083,7 @@ main (int argc, char **argv)
 	  if (*p == '+')
             {
 	      unsigned char c;
+	      if (*(p + 1) == '-') p++;
 	      do
 		c = *++p;
 	      while (isdigit (c) || c == ':');
diff --git a/lisp/server.el b/lisp/server.el
index 553890ce29..37ccf7b9f4 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1237,7 +1237,7 @@ server-process-filter
                 ;; -position +LINE[:COLUMN]:  Set point to the given
                 ;;  position in the next file.
                 ("-position"
-                 (if (not (string-match "\\+\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)?"
+                 (if (not (string-match "\\+\\(-?[0-9]+\\)\\(?::\\([0-9]+\\)\\)?"
                                         (car args-left)))
                      (error "Invalid -position command in client args"))
                  (let ((arg (pop args-left)))
@@ -1437,8 +1437,13 @@ server-goto-line-column
   "Move point to the position indicated in LINE-COL.
 LINE-COL should be a pair (LINE . COL)."
   (when line-col
-    (goto-char (point-min))
-    (forward-line (1- (car line-col)))
+    (if (>= (car line-col) 0)
+        (progn
+          (goto-char (point-min))
+          (forward-line (1- (car line-col))))
+      (progn
+        (goto-char (point-max))
+        (forward-line (car line-col))))
     (let ((column-number (cdr line-col)))
       (when (> column-number 0)
         (move-to-column (1- column-number))))))
diff --git a/lisp/startup.el b/lisp/startup.el
index 5e0a47d3f8..7cbd7687ad 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -2570,8 +2570,13 @@ command-line-1
                       ;; Put the point at `line':`column' in the file
                       ;; buffer, and reset `line' and `column' to 0.
                       (unless (zerop line)
-                        (goto-char (point-min))
-                        (forward-line (1- line)))
+                        (if (>= line 0)
+                            (progn
+                              (goto-char (point-min))
+                              (forward-line (1- line)))
+                          (progn
+                            (goto-char (point-max))
+                            (forward-line line))))
                       (setq line 0)
                       (unless (< column 1)
                         (move-to-column (1- column)))
@@ -2718,10 +2723,10 @@ command-line-1
                     ((equal argi "-no-desktop")
                      (message "\"--no-desktop\" ignored because the Desktop package is not loaded"))
 
-                    ((string-match "^\\+[0-9]+\\'" argi)
-                     (setq line (string-to-number argi)))
+                    ((string-match "^\\+\\(-?[0-9]+\\)\\'" argi)
+                     (setq line (string-to-number (match-string 1 argi))))
 
-                    ((string-match "^\\+\\([0-9]+\\):\\([0-9]+\\)\\'" argi)
+                    ((string-match "^\\+\\(-?[0-9]+\\):\\([0-9]+\\)\\'" argi)
                      (setq line (string-to-number (match-string 1 argi))
                            column (string-to-number (match-string 2 argi))))
 
diff --git a/src/emacs.c b/src/emacs.c
index 85102acd28..86264df7a9 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -308,8 +308,8 @@ #define MAIN_PROGRAM
 Action options:\n\
 \n\
 FILE                    visit FILE\n\
-+LINE                   go to line LINE in next FILE\n\
-+LINE:COLUMN            go to line LINE, column COLUMN, in next FILE\n\
++[-]LINE                go to line LINE in next FILE\n\
++[-]LINE:COLUMN         go to line LINE, column COLUMN, in next FILE\n\
 --directory, -L DIR     prepend DIR to load-path (with :DIR, append DIR)\n\
 --eval EXPR             evaluate Emacs Lisp expression EXPR\n\
 --execute EXPR          evaluate Emacs Lisp expression EXPR\n\
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 20:08         ` Jim Porter
@ 2022-11-19 20:33           ` Eli Zaretskii
  2022-11-19 23:06             ` Jim Porter
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-19 20:33 UTC (permalink / raw)
  To: Jim Porter; +Cc: gregory, xerusx, 59388

> Date: Sat, 19 Nov 2022 12:08:06 -0800
> Cc: xerusx@pm.me, 59388@debbugs.gnu.org
> From: Jim Porter <jporterbugs@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).





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 20:33           ` Eli Zaretskii
@ 2022-11-19 23:06             ` Jim Porter
  2022-11-20  7:22               ` Eli Zaretskii
  0 siblings, 1 reply; 23+ messages in thread
From: Jim Porter @ 2022-11-19 23:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gregory, xerusx, 59388

On 11/19/2022 12:33 PM, Eli Zaretskii wrote:
>> Date: Sat, 19 Nov 2022 12:08:06 -0800
>> Cc: xerusx@pm.me, 59388@debbugs.gnu.org
>> From: Jim Porter <jporterbugs@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-19 23:06             ` Jim Porter
@ 2022-11-20  7:22               ` Eli Zaretskii
  2022-11-20 18:49                 ` Jim Porter
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-20  7:22 UTC (permalink / raw)
  To: Jim Porter; +Cc: gregory, xerusx, 59388

> Date: Sat, 19 Nov 2022 15:06:14 -0800
> Cc: gregory@heytings.org, xerusx@pm.me, 59388@debbugs.gnu.org
> From: Jim Porter <jporterbugs@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?





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-20  7:22               ` Eli Zaretskii
@ 2022-11-20 18:49                 ` Jim Porter
  2022-11-20 19:00                   ` Eli Zaretskii
  2022-11-21  8:52                   ` Jean Louis
  0 siblings, 2 replies; 23+ messages in thread
From: Jim Porter @ 2022-11-20 18:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gregory, xerusx, 59388

On 11/19/2022 11:22 PM, Eli Zaretskii wrote:
>> Date: Sat, 19 Nov 2022 15:06:14 -0800
>> Cc: gregory@heytings.org, xerusx@pm.me, 59388@debbugs.gnu.org
>> From: Jim Porter <jporterbugs@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-20 18:49                 ` Jim Porter
@ 2022-11-20 19:00                   ` Eli Zaretskii
  2022-11-20 19:37                     ` Jim Porter
  2022-11-21  8:55                     ` Jean Louis
  2022-11-21  8:52                   ` Jean Louis
  1 sibling, 2 replies; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-20 19:00 UTC (permalink / raw)
  To: Jim Porter; +Cc: gregory, xerusx, 59388

> Date: Sun, 20 Nov 2022 10:49:10 -0800
> Cc: gregory@heytings.org, xerusx@pm.me, 59388@debbugs.gnu.org
> From: Jim Porter <jporterbugs@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-20 19:00                   ` Eli Zaretskii
@ 2022-11-20 19:37                     ` Jim Porter
  2022-11-21  8:55                     ` Jean Louis
  1 sibling, 0 replies; 23+ messages in thread
From: Jim Porter @ 2022-11-20 19:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gregory, xerusx, 59388

On 11/20/2022 11:00 AM, Eli Zaretskii wrote:
>> Date: Sun, 20 Nov 2022 10:49:10 -0800
>> Cc: gregory@heytings.org, xerusx@pm.me, 59388@debbugs.gnu.org
>> From: Jim Porter <jporterbugs@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.)





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-20 18:49                 ` Jim Porter
  2022-11-20 19:00                   ` Eli Zaretskii
@ 2022-11-21  8:52                   ` Jean Louis
  2022-11-21 13:35                     ` Eli Zaretskii
  1 sibling, 1 reply; 23+ messages in thread
From: Jean Louis @ 2022-11-21  8:52 UTC (permalink / raw)
  To: Jim Porter; +Cc: Eli Zaretskii, xerusx, gregory, 59388

* Jim Porter <jporterbugs@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/





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-20 19:00                   ` Eli Zaretskii
  2022-11-20 19:37                     ` Jim Porter
@ 2022-11-21  8:55                     ` Jean Louis
  2022-11-21 13:36                       ` Eli Zaretskii
  1 sibling, 1 reply; 23+ messages in thread
From: Jean Louis @ 2022-11-21  8:55 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Jim Porter, gregory, xerusx, 59388

* Eli Zaretskii <eliz@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/







^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-21  8:52                   ` Jean Louis
@ 2022-11-21 13:35                     ` Eli Zaretskii
  0 siblings, 0 replies; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-21 13:35 UTC (permalink / raw)
  To: Jean Louis; +Cc: jporterbugs, gregory, xerusx, 59388

> Date: Mon, 21 Nov 2022 11:52:48 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: Eli Zaretskii <eliz@gnu.org>, gregory@heytings.org, xerusx@pm.me,
>   59388@debbugs.gnu.org
> 
> * Jim Porter <jporterbugs@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-21  8:55                     ` Jean Louis
@ 2022-11-21 13:36                       ` Eli Zaretskii
  2022-11-21 17:50                         ` Jim Porter
  0 siblings, 1 reply; 23+ messages in thread
From: Eli Zaretskii @ 2022-11-21 13:36 UTC (permalink / raw)
  To: Jean Louis; +Cc: jporterbugs, gregory, xerusx, 59388

> Date: Mon, 21 Nov 2022 11:55:34 +0300
> From: Jean Louis <bugs@gnu.support>
> Cc: Jim Porter <jporterbugs@gmail.com>, gregory@heytings.org,
>   xerusx@pm.me, 59388@debbugs.gnu.org
> 
> * Eli Zaretskii <eliz@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#59388: Open emacsclient file at last line
  2022-11-21 13:36                       ` Eli Zaretskii
@ 2022-11-21 17:50                         ` Jim Porter
  0 siblings, 0 replies; 23+ messages in thread
From: Jim Porter @ 2022-11-21 17:50 UTC (permalink / raw)
  To: Eli Zaretskii, Jean Louis; +Cc: gregory, xerusx, 59388

On 11/21/2022 5:36 AM, Eli Zaretskii wrote:
>> Date: Mon, 21 Nov 2022 11:55:34 +0300
>> From: Jean Louis <bugs@gnu.support>
>> Cc: Jim Porter <jporterbugs@gmail.com>, gregory@heytings.org,
>>    xerusx@pm.me, 59388@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2022-11-21 17:50 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-19 11:57 bug#59388: Open emacsclient file at last line Janek F via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-19 15:48 ` Eli Zaretskii
2022-11-19 17:10   ` Gregory Heytings
2022-11-19 18:03     ` Eli Zaretskii
2022-11-19 18:07       ` Gregory Heytings
2022-11-19 18:17         ` Eli Zaretskii
2022-11-19 18:21           ` Gregory Heytings
2022-11-19 18:32             ` Eli Zaretskii
2022-11-19 19:05               ` Gregory Heytings
2022-11-19 19:37                 ` Eli Zaretskii
2022-11-19 20:20                   ` Gregory Heytings
2022-11-19 20:08         ` Jim Porter
2022-11-19 20:33           ` Eli Zaretskii
2022-11-19 23:06             ` Jim Porter
2022-11-20  7:22               ` Eli Zaretskii
2022-11-20 18:49                 ` Jim Porter
2022-11-20 19:00                   ` Eli Zaretskii
2022-11-20 19:37                     ` Jim Porter
2022-11-21  8:55                     ` Jean Louis
2022-11-21 13:36                       ` Eli Zaretskii
2022-11-21 17:50                         ` Jim Porter
2022-11-21  8:52                   ` Jean Louis
2022-11-21 13:35                     ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).