unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How to get "emacsclient --eval x" to DWIM when Emacs is not started
@ 2008-03-30 20:09 Mathias Dahl
  2008-03-30 20:21 ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 11+ messages in thread
From: Mathias Dahl @ 2008-03-30 20:09 UTC (permalink / raw)
  To: emacs-devel

How can I get "emacsclient --eval x" to DWIM when Emacs is not
started? I have tried the following:

emacsclient -e '(message "Hello!")' -a emacs

But that does not work. What happens is that Emacs, when started as
the alternate editor, tries to open a file with the name ''(message
"Hello!").

For normal operation, i.e. not using --eval but just for opening a
file, -a emacs works well and does what I expect. Why does not --eval
do the same? I have, of course, (server-start) in my .emacs file.

As far as I can see, the manual does not mention this case.




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 20:09 How to get "emacsclient --eval x" to DWIM when Emacs is not started Mathias Dahl
@ 2008-03-30 20:21 ` Lennart Borgman (gmail)
  2008-03-30 21:45   ` Mathias Dahl
  2008-03-30 22:49   ` Stefan Monnier
  0 siblings, 2 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-30 20:21 UTC (permalink / raw)
  To: Mathias Dahl; +Cc: emacs-devel

Mathias Dahl wrote:
> How can I get "emacsclient --eval x" to DWIM when Emacs is not
> started? I have tried the following:
> 
> emacsclient -e '(message "Hello!")' -a emacs
> 
> But that does not work. What happens is that Emacs, when started as
> the alternate editor, tries to open a file with the name ''(message
> "Hello!").
> 
> For normal operation, i.e. not using --eval but just for opening a
> file, -a emacs works well and does what I expect. Why does not --eval
> do the same? I have, of course, (server-start) in my .emacs file.
> 
> As far as I can see, the manual does not mention this case.

You can always try the patches I use for w32. It works fine for cases 
like the above though you just write something like

   emacsclient -e "(message \"hello\")"




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 20:21 ` Lennart Borgman (gmail)
@ 2008-03-30 21:45   ` Mathias Dahl
  2008-03-30 21:52     ` Lennart Borgman (gmail)
  2008-03-30 22:49   ` Stefan Monnier
  1 sibling, 1 reply; 11+ messages in thread
From: Mathias Dahl @ 2008-03-30 21:45 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

>  You can always try the patches I use for w32. It works fine for cases
>  like the above though you just write something like
>
>    emacsclient -e "(message \"hello\")"

This is for GNU/Linux, will your patch work here too?




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 21:45   ` Mathias Dahl
@ 2008-03-30 21:52     ` Lennart Borgman (gmail)
  2008-03-30 22:06       ` Mathias Dahl
  0 siblings, 1 reply; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-30 21:52 UTC (permalink / raw)
  To: Mathias Dahl; +Cc: emacs-devel

Mathias Dahl wrote:
>>  You can always try the patches I use for w32. It works fine for cases
>>  like the above though you just write something like
>>
>>    emacsclient -e "(message \"hello\")"
> 
> This is for GNU/Linux, will your patch work here too?

 From the beginning I think it did, but maybe I have not ifdef:ed the 
GUI part yet, I am not sure.

The current state of the patch is not the best, but it works. I have 
problem keeping it in sync with CVS and have "unstructured" it to do 
that. I am still waiting for some decision to take it into the CVS ...




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 21:52     ` Lennart Borgman (gmail)
@ 2008-03-30 22:06       ` Mathias Dahl
  2008-03-30 22:33         ` Lennart Borgman (gmail)
  0 siblings, 1 reply; 11+ messages in thread
From: Mathias Dahl @ 2008-03-30 22:06 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel

>  The current state of the patch is not the best, but it works. I have
>  problem keeping it in sync with CVS and have "unstructured" it to do
>  that. I am still waiting for some decision to take it into the CVS ...

I know there was a lot of discussion about emacsclient some time back
and I did not follow it very closely (it was too much), was this ever
discussed and is there any good reason for this not working as I think
most would expect?




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 22:06       ` Mathias Dahl
@ 2008-03-30 22:33         ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-30 22:33 UTC (permalink / raw)
  To: Mathias Dahl; +Cc: emacs-devel

Mathias Dahl wrote:
>>  The current state of the patch is not the best, but it works. I have
>>  problem keeping it in sync with CVS and have "unstructured" it to do
>>  that. I am still waiting for some decision to take it into the CVS ...
> 
> I know there was a lot of discussion about emacsclient some time back
> and I did not follow it very closely (it was too much), was this ever
> discussed and is there any good reason for this not working as I think
> most would expect?

There was a lot of ideas, but the only implementation I know of is the 
one above. When it was discussed it was not a good time to install 
something like this however. As it is right now I think it can be 
installed - with some careful changes not to break things and keep the 
changes traceable.




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 20:21 ` Lennart Borgman (gmail)
  2008-03-30 21:45   ` Mathias Dahl
@ 2008-03-30 22:49   ` Stefan Monnier
  2008-03-30 22:55     ` Lennart Borgman (gmail)
  2008-03-31  7:44     ` Mathias Dahl
  1 sibling, 2 replies; 11+ messages in thread
From: Stefan Monnier @ 2008-03-30 22:49 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel, Mathias Dahl

>> How can I get "emacsclient --eval x" to DWIM when Emacs is not
>> started? I have tried the following:
>> 
>> emacsclient -e '(message "Hello!")' -a emacs
>> 
>> But that does not work. What happens is that Emacs, when started as
>> the alternate editor, tries to open a file with the name ''(message
>> "Hello!").
>> 
>> For normal operation, i.e. not using --eval but just for opening a
>> file, -a emacs works well and does what I expect. Why does not --eval
>> do the same? I have, of course, (server-start) in my .emacs file.
>> 
>> As far as I can see, the manual does not mention this case.

> You can always try the patches I use for w32. It works fine for cases like
> the above though you just write something like

>   emacsclient -e "(message \"hello\")"

I think it would be a good change for emacsclient to auto-start an Emacs
server if the server is not running yet.

I have not followed closely your work on this (other than knowing it
exists), so maybe if you can take your current code, bring it down to
the simplest/cleanest patch (ignore everything that can be added
later), we can start discussing it (in a new thread).


        Stefan




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 22:49   ` Stefan Monnier
@ 2008-03-30 22:55     ` Lennart Borgman (gmail)
  2008-03-30 23:24       ` Juanma Barranquero
  2008-03-31  7:44     ` Mathias Dahl
  1 sibling, 1 reply; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-30 22:55 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Juanma Barranquero, emacs-devel, Mathias Dahl

Stefan Monnier wrote:
>>> How can I get "emacsclient --eval x" to DWIM when Emacs is not
>>> started? I have tried the following:
>>>
>>> emacsclient -e '(message "Hello!")' -a emacs
>>>
>>> But that does not work. What happens is that Emacs, when started as
>>> the alternate editor, tries to open a file with the name ''(message
>>> "Hello!").
>>>
>>> For normal operation, i.e. not using --eval but just for opening a
>>> file, -a emacs works well and does what I expect. Why does not --eval
>>> do the same? I have, of course, (server-start) in my .emacs file.
>>>
>>> As far as I can see, the manual does not mention this case.
> 
>> You can always try the patches I use for w32. It works fine for cases like
>> the above though you just write something like
> 
>>   emacsclient -e "(message \"hello\")"
> 
> I think it would be a good change for emacsclient to auto-start an Emacs
> server if the server is not running yet.
> 
> I have not followed closely your work on this (other than knowing it
> exists), so maybe if you can take your current code, bring it down to
> the simplest/cleanest patch (ignore everything that can be added
> later), we can start discussing it (in a new thread).


I hoped that Juanma should find some time to cooperate on this. I have 
restructured the code, it is not the best one can find, but the 
restructuring should help to understand what news it brings (I have 
moved the GUI part to separate files and only have some "hooks" to it in 
emacsclient.c).

Juanma, I think that it would be best to do some more restructuring off 
the list just to avoid unnecessary noise. What do you think?

Anyone else interested in taking part please mail me.




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 22:55     ` Lennart Borgman (gmail)
@ 2008-03-30 23:24       ` Juanma Barranquero
  0 siblings, 0 replies; 11+ messages in thread
From: Juanma Barranquero @ 2008-03-30 23:24 UTC (permalink / raw)
  To: Lennart Borgman (gmail); +Cc: emacs-devel, Stefan Monnier, Mathias Dahl

On Mon, Mar 31, 2008 at 12:55 AM, Lennart Borgman (gmail)
<lennart.borgman@gmail.com> wrote:

>  Juanma, I think that it would be best to do some more restructuring off
>  the list just to avoid unnecessary noise. What do you think?

After you sent me your code there were some changes to emacsclient.
Try to make as clean a version of your changes as you can (I mean, as
similar to what is in the CVS as possible) and I'll make time to look
at it this week.

     Juanma




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-30 22:49   ` Stefan Monnier
  2008-03-30 22:55     ` Lennart Borgman (gmail)
@ 2008-03-31  7:44     ` Mathias Dahl
  2008-03-31  7:49       ` Lennart Borgman (gmail)
  1 sibling, 1 reply; 11+ messages in thread
From: Mathias Dahl @ 2008-03-31  7:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Lennart Borgman (gmail), emacs-devel

>  I think it would be a good change for emacsclient to auto-start an Emacs
>  server if the server is not running yet.

When Emacs is used as alternate editor, why can't emacsclient simply
wait until it is started and then try doing the eval the user
requested with --eval? I already have (server-start) in my .emacs so
there is no need for emacsclient to start it.




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

* Re: How to get "emacsclient --eval x" to DWIM when Emacs is not started
  2008-03-31  7:44     ` Mathias Dahl
@ 2008-03-31  7:49       ` Lennart Borgman (gmail)
  0 siblings, 0 replies; 11+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-31  7:49 UTC (permalink / raw)
  To: Mathias Dahl; +Cc: Stefan Monnier, emacs-devel

Mathias Dahl wrote:
>>  I think it would be a good change for emacsclient to auto-start an Emacs
>>  server if the server is not running yet.
> 
> When Emacs is used as alternate editor, why can't emacsclient simply
> wait until it is started and then try doing the eval the user
> requested with --eval? I already have (server-start) in my .emacs so
> there is no need for emacsclient to start it.

That is part of the patch I have.




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

end of thread, other threads:[~2008-03-31  7:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-30 20:09 How to get "emacsclient --eval x" to DWIM when Emacs is not started Mathias Dahl
2008-03-30 20:21 ` Lennart Borgman (gmail)
2008-03-30 21:45   ` Mathias Dahl
2008-03-30 21:52     ` Lennart Borgman (gmail)
2008-03-30 22:06       ` Mathias Dahl
2008-03-30 22:33         ` Lennart Borgman (gmail)
2008-03-30 22:49   ` Stefan Monnier
2008-03-30 22:55     ` Lennart Borgman (gmail)
2008-03-30 23:24       ` Juanma Barranquero
2008-03-31  7:44     ` Mathias Dahl
2008-03-31  7:49       ` Lennart Borgman (gmail)

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