unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#646: No arguments
@ 2008-08-04 10:10 J. Pablo Fernández 
  2008-08-04 14:27 ` Lennart Borgman (gmail)
  2021-08-27  3:31 ` bug#646: emacsclient with no args to behave like -a Lars Ingebrigtsen
  0 siblings, 2 replies; 11+ messages in thread
From: J. Pablo Fernández  @ 2008-08-04 10:10 UTC (permalink / raw)
  To: bug-gnu-emacs

Hello,

It would be nice if emacsclient, when called with no arguments, would
just run the alternate editor. I've configured emacs as my alternate
editor so emacsclient for me is basically a "open this in an existing
emacs or run one otherwise", the only problem for that to work
completely is having it working with no arguments.

Thanks.
-- 
J. Pablo Fernández <pupeno@pupeno.com> (http://pupeno.com)
 Temporarily using pupeno@gmail.com.

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

* bug#646: No arguments
  2008-08-04 10:10 bug#646: No arguments J. Pablo Fernández 
@ 2008-08-04 14:27 ` Lennart Borgman (gmail)
  2008-08-05  5:31   ` J. Pablo" Fernández 
  2021-08-27  3:31 ` bug#646: emacsclient with no args to behave like -a Lars Ingebrigtsen
  1 sibling, 1 reply; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-08-04 14:27 UTC (permalink / raw)
  To: J. Pablo Fernández , 646; +Cc: bug-gnu-emacs

J. Pablo Fernández wrote:
> Hello,
> 
> It would be nice if emacsclient, when called with no arguments, would
> just run the alternate editor. I've configured emacs as my alternate
> editor so emacsclient for me is basically a "open this in an existing
> emacs or run one otherwise", the only problem for that to work
> completely is having it working with no arguments.

The patched version of emacsclient that I distribute with Emacs+EmacsW32 
does that. If you are on another platform it would be nice if you tested 
that code there.






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

* bug#646: No arguments
  2008-08-04 14:27 ` Lennart Borgman (gmail)
@ 2008-08-05  5:31   ` J. Pablo" Fernández 
  2008-08-05  9:33     ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 11+ messages in thread
From: J. Pablo" Fernández  @ 2008-08-05  5:31 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: bug-gnu-emacs, 646

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

On Mon, 2008-08-04 at 16:27 +0200, Lennart Borgman (gmail) wrote:
> J. Pablo Fernández wrote:
> > Hello,
> > 
> > It would be nice if emacsclient, when called with no arguments, would
> > just run the alternate editor. I've configured emacs as my alternate
> > editor so emacsclient for me is basically a "open this in an existing
> > emacs or run one otherwise", the only problem for that to work
> > completely is having it working with no arguments.
> 
> The patched version of emacsclient that I distribute with Emacs+EmacsW32 
> does that. If you are on another platform it would be nice if you tested 
> that code there.

I use a pre-packaged Emacs, but I can try to give it a chance, where can
I get the patch?

Thanks.
-- 
J. Pablo Fernández <pupeno@pupeno.com> http://pupeno.com

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* bug#646: No arguments
  2008-08-05  5:31   ` J. Pablo" Fernández 
@ 2008-08-05  9:33     ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-08-05  9:33 UTC (permalink / raw)
  To: pupeno; +Cc: bug-gnu-emacs, 646

J. Pablo" Fernández wrote:
> On Mon, 2008-08-04 at 16:27 +0200, Lennart Borgman (gmail) wrote:
>> J. Pablo Fernández wrote:
>>> Hello,
>>>
>>> It would be nice if emacsclient, when called with no arguments, would
>>> just run the alternate editor. I've configured emacs as my alternate
>>> editor so emacsclient for me is basically a "open this in an existing
>>> emacs or run one otherwise", the only problem for that to work
>>> completely is having it working with no arguments.
>> The patched version of emacsclient that I distribute with Emacs+EmacsW32 
>> does that. If you are on another platform it would be nice if you tested 
>> that code there.
> 
> I use a pre-packaged Emacs, but I can try to give it a chance, where can
> I get the patch?

I will send them to you privately.







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

* bug#646: emacsclient with no args to behave like -a
  2008-08-04 10:10 bug#646: No arguments J. Pablo Fernández 
  2008-08-04 14:27 ` Lennart Borgman (gmail)
@ 2021-08-27  3:31 ` Lars Ingebrigtsen
  2021-08-27  4:00   ` Jim Porter
  1 sibling, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-27  3:31 UTC (permalink / raw)
  Cc: 646

"J. Pablo "Fernández\"" <pupeno@pupeno.com> writes:

> It would be nice if emacsclient, when called with no arguments, would
> just run the alternate editor. I've configured emacs as my alternate
> editor so emacsclient for me is basically a "open this in an existing
> emacs or run one otherwise", the only problem for that to work
> completely is having it working with no arguments.

(I'm going through old bug reports that unfortunately weren't
resolved at the time.)

It seems like this has been fixed in the 13 years since it was reported.

I did:

larsi@elva:~/src/emacs/trunk$ export ALTERNATE_EDITOR=nano
larsi@elva:~/src/emacs/trunk$ ./lib-src/emacsclient /tmp/foo

and that opened nano.

So I'm closing this bug report.  If there's more to be done here, please
respond to the debbugs address and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#646: emacsclient with no args to behave like -a
  2021-08-27  3:31 ` bug#646: emacsclient with no args to behave like -a Lars Ingebrigtsen
@ 2021-08-27  4:00   ` Jim Porter
  2021-08-27  4:14     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Jim Porter @ 2021-08-27  4:00 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 646

On 8/26/2021 8:31 PM, Lars Ingebrigtsen wrote:
> "J. Pablo "Fernández\"" <pupeno@pupeno.com> writes:
> 
>> It would be nice if emacsclient, when called with no arguments, would
>> just run the alternate editor. I've configured emacs as my alternate
>> editor so emacsclient for me is basically a "open this in an existing
>> emacs or run one otherwise", the only problem for that to work
>> completely is having it working with no arguments.
> 
> (I'm going through old bug reports that unfortunately weren't
> resolved at the time.)
> 
> It seems like this has been fixed in the 13 years since it was reported.
> 
> I did:
> 
> larsi@elva:~/src/emacs/trunk$ export ALTERNATE_EDITOR=nano
> larsi@elva:~/src/emacs/trunk$ ./lib-src/emacsclient /tmp/foo
> 
> and that opened nano.

It sounds to me like the "args" in question would be "/tmp/foo" in this 
case. On Emacs 27.2 and 28.0.50, I see:

   $ export ALTERNATE_EDITOR=nano
   $ lib-src/emacsclient
   lib-src/emacsclient: file name or argument required
   Try 'lib-src/emacsclient --help' for more information

 From my reading, this is the original reporter's preferred behavior:

   1) If Emacs is not currently running
      a) `emacsclient file.txt' starts Emacs and opens file.txt
      b) `emacsclient' starts Emacs (as though running `emacs')
   2) If Emacs is currently running
      a) `emacsclient file.txt' opens file.txt in the existing Emacs session
      b) `emacsclient' brings some frame in the existing Emacs session 
to the foreground





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

* bug#646: emacsclient with no args to behave like -a
  2021-08-27  4:00   ` Jim Porter
@ 2021-08-27  4:14     ` Lars Ingebrigtsen
  2021-08-27  5:06       ` Jim Porter
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-27  4:14 UTC (permalink / raw)
  To: Jim Porter; +Cc: J. Pablo Fernández, 646

Jim Porter <jporterbugs@gmail.com> writes:

> From my reading, this is the original reporter's preferred behavior:
>
>   1) If Emacs is not currently running
>      a) `emacsclient file.txt' starts Emacs and opens file.txt
>      b) `emacsclient' starts Emacs (as though running `emacs')
>   2) If Emacs is currently running
>      a) `emacsclient file.txt' opens file.txt in the existing Emacs session
>      b) `emacsclient' brings some frame in the existing Emacs session
>      to the foreground

That's not my reading.  The bug reporter said "It would be nice if
emacsclient, when called with no arguments, would just run the alternate
editor."  I.e., emulate the "-a" parameter when called with no
parameters.

(He's also using Emacs as the alternate, but that's just a detail.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#646: emacsclient with no args to behave like -a
  2021-08-27  4:14     ` Lars Ingebrigtsen
@ 2021-08-27  5:06       ` Jim Porter
  2021-08-27 14:50         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Jim Porter @ 2021-08-27  5:06 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: J. Pablo Fernández, 646

On 8/26/2021 9:14 PM, Lars Ingebrigtsen wrote:
> Jim Porter <jporterbugs@gmail.com> writes:
> 
>>  From my reading, this is the original reporter's preferred behavior:
>>
>>    1) If Emacs is not currently running
>>       a) `emacsclient file.txt' starts Emacs and opens file.txt
>>       b) `emacsclient' starts Emacs (as though running `emacs')
>>    2) If Emacs is currently running
>>       a) `emacsclient file.txt' opens file.txt in the existing Emacs session
>>       b) `emacsclient' brings some frame in the existing Emacs session
>>       to the foreground
> 
> That's not my reading.  The bug reporter said "It would be nice if
> emacsclient, when called with no arguments, would just run the alternate
> editor."  I.e., emulate the "-a" parameter when called with no
> parameters.
> 
> (He's also using Emacs as the alternate, but that's just a detail.)

Indeed, it's not 100% clear, especially since this is from so long ago 
that I can't quite remember how emacsclient worked back then. However, I 
did a bit of archaeology and found the following passage in a blog post 
from around the same time:

"First, I recommend using the W32 package. W32 has hacked the 
emacsclient in several useful ways. It will start Emacs if it isn't 
already running, it will call "raise-frame" on the Emacs window when 
started, and it permits starting emacsclient without a filename. "[1]

The last bit confirms that Lennart's patched emacsclient *could* work as 
in (2b) above.[2] Whether that's what the original reporter wanted is 
another story (though it's how I interpret it)...

[1] http://emacs-fu.blogspot.com/2009/03/windows-and-daemons.html
[2] Unfortunately, I couldn't find the sources for Emacs+EmacsW32 to 
confirm this.





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

* bug#646: emacsclient with no args to behave like -a
  2021-08-27  5:06       ` Jim Porter
@ 2021-08-27 14:50         ` Lars Ingebrigtsen
  2021-08-27 17:18           ` Jim Porter
  0 siblings, 1 reply; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-27 14:50 UTC (permalink / raw)
  To: Jim Porter; +Cc: J. Pablo Fernández, 646

Jim Porter <jporterbugs@gmail.com> writes:

> "First, I recommend using the W32 package. W32 has hacked the
> emacsclient in several useful ways. It will start Emacs if it isn't
> already running, it will call "raise-frame" on the Emacs window when
> started, and it permits starting emacsclient without a filename. "[1]

I think that's how emacsclient works these days -- if you set
ALTERNATE_EDITOR to the empty string.  (It starts a new daemon Emacs and
then connects to it.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#646: emacsclient with no args to behave like -a
  2021-08-27 14:50         ` Lars Ingebrigtsen
@ 2021-08-27 17:18           ` Jim Porter
  2021-08-28 15:02             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 11+ messages in thread
From: Jim Porter @ 2021-08-27 17:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: J. Pablo Fernández, 646

On 8/27/2021 7:50 AM, Lars Ingebrigtsen wrote:
> Jim Porter <jporterbugs@gmail.com> writes:
> 
>> "First, I recommend using the W32 package. W32 has hacked the
>> emacsclient in several useful ways. It will start Emacs if it isn't
>> already running, it will call "raise-frame" on the Emacs window when
>> started, and it permits starting emacsclient without a filename. "[1]
> 
> I think that's how emacsclient works these days -- if you set
> ALTERNATE_EDITOR to the empty string.  (It starts a new daemon Emacs and
> then connects to it.)

I tested this on Emacs 28.0.50, and a filename is still required. 
Otherwise emacsclient errors out as before.

[As an aside: the main difference that I see is that with 
ALTERNATE_EDITOR=emacs, `emacsclient file.txt' opens emacs directly (so 
there's no emacsclient process hanging around, only emacs). With 
ALTERNATE_EDITOR as the empty string, `emacsclient file.txt' starts a 
daemon Emacs (so there are emacsclient and `emacs --daemon' processes 
running).]

That said, you can call `emacsclient -c' to create a new Emacs frame. 
That works if you wanted to make a desktop shortcut to do something 
similar to the Emacs+EmacsW32 patched version of emacsclient, but that 
means it'll always open a new frame, even if you pass it some files. 
That's not necessarily the behavior people want.

No-args support in emacsclient could be nice for scripting or for things 
like the etc/emacsclient.desktop shortcut. Currently that uses a 
conditional to decide what to call based on whether it was passed any 
files (reformatted here for clarity):

   if [ -n "$*" ]; then
     exec emacsclient --alternate-editor= --display="$DISPLAY" "$@";
   else
     exec emacsclient --alternate-editor= --create-frame;
   fi

Fixing this issue could simplify that to something like: `emacsclient 
--alternate-editor= %F'. However, since emacsclient.desktop handles this 
already (albeit with a somewhat complex incantation), maybe that's enough.





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

* bug#646: emacsclient with no args to behave like -a
  2021-08-27 17:18           ` Jim Porter
@ 2021-08-28 15:02             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-28 15:02 UTC (permalink / raw)
  To: Jim Porter; +Cc: J. Pablo Fernández, 646

Jim Porter <jporterbugs@gmail.com> writes:

> I tested this on Emacs 28.0.50, and a filename is still
> required. Otherwise emacsclient errors out as before.

Oh, I interpreted "no args" as "no -a arg".  :-)  A filename is
required; yes.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-08-28 15:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-04 10:10 bug#646: No arguments J. Pablo Fernández 
2008-08-04 14:27 ` Lennart Borgman (gmail)
2008-08-05  5:31   ` J. Pablo" Fernández 
2008-08-05  9:33     ` Lennart Borgman (gmail)
2021-08-27  3:31 ` bug#646: emacsclient with no args to behave like -a Lars Ingebrigtsen
2021-08-27  4:00   ` Jim Porter
2021-08-27  4:14     ` Lars Ingebrigtsen
2021-08-27  5:06       ` Jim Porter
2021-08-27 14:50         ` Lars Ingebrigtsen
2021-08-27 17:18           ` Jim Porter
2021-08-28 15:02             ` Lars Ingebrigtsen

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