unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* emacsclient command line use existing client
@ 2014-09-11 12:58 Tory S. Anderson
  2014-09-12  2:42 ` Michael Heerdegen
  0 siblings, 1 reply; 20+ messages in thread
From: Tory S. Anderson @ 2014-09-11 12:58 UTC (permalink / raw)
  To: emacs list

The following are part of a .so file I use to let browser mailto: links open a message in Gnus. 

elisp_expr="(mailto-compose-mail \"$mailto\")"

emacsclient -a "" -c -n --eval "$elisp_expr" \
	'(set-window-dedicated-p (selected-window) t)'

But somehow when I run this it starts a new emacsclient rather than using the one I have running. If I remove the `-a ""` then nothing happens at all. Why won't it connect to my existing emacsclient?  



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

* Re: emacsclient command line use existing client
  2014-09-11 12:58 emacsclient command line use existing client Tory S. Anderson
@ 2014-09-12  2:42 ` Michael Heerdegen
  2014-09-12  7:43   ` Thorsten Jolitz
  2014-09-12 12:16   ` Tory S. Anderson
  0 siblings, 2 replies; 20+ messages in thread
From: Michael Heerdegen @ 2014-09-12  2:42 UTC (permalink / raw)
  To: help-gnu-emacs

torys.anderson@gmail.com (Tory S. Anderson) writes:

> elisp_expr="(mailto-compose-mail \"$mailto\")"
>
> emacsclient -a "" -c -n --eval "$elisp_expr" \
> 	'(set-window-dedicated-p (selected-window) t)'
>
> But somehow when I run this it starts a new emacsclient rather than
> using the one I have running. If I remove the `-a ""` then nothing
> happens at all. Why won't it connect to my existing emacsclient?

What exactly do you mean with "existing emacsclient"?  You must have a
running server.  A running Emacs is not enough.

Michael.




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

* Re: emacsclient command line use existing client
  2014-09-12  2:42 ` Michael Heerdegen
@ 2014-09-12  7:43   ` Thorsten Jolitz
  2014-09-12 12:16   ` Tory S. Anderson
  1 sibling, 0 replies; 20+ messages in thread
From: Thorsten Jolitz @ 2014-09-12  7:43 UTC (permalink / raw)
  To: help-gnu-emacs

Michael Heerdegen <michael_heerdegen@web.de> writes:

> torys.anderson@gmail.com (Tory S. Anderson) writes:
>
>> elisp_expr="(mailto-compose-mail \"$mailto\")"
>>
>> emacsclient -a "" -c -n --eval "$elisp_expr" \
>> 	'(set-window-dedicated-p (selected-window) t)'
>>
>> But somehow when I run this it starts a new emacsclient rather than
>> using the one I have running. If I remove the `-a ""` then nothing
>> happens at all. Why won't it connect to my existing emacsclient?
>
> What exactly do you mean with "existing emacsclient"?  You must have a
> running server.  A running Emacs is not enough.

Not sure what OP means, but I would like something similar too:

Having one emacs server running with possibly many emacsclients
connected, address one specific emacsclient from a program. 

Say I have a tmux window with 3 tiles, one of them the PicoLisp REPL,
another an emacsclient window showing an emacs-w3m buffer. Now I want a
PicoLisp command that calls emacs to show symbol documentation in
emacs-w3m (instead of standalone w3m, which is easy to achieve). 

But there are several tmux windows opwn, and more emacsclients
connected. How do I tell the emacs-server on the command-line to reuse
that one specific emacsclient instance side-by-side with the PicoLisp
REPL?

-- 
cheers,
Thorsten




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

* Re: emacsclient command line use existing client
  2014-09-12  2:42 ` Michael Heerdegen
  2014-09-12  7:43   ` Thorsten Jolitz
@ 2014-09-12 12:16   ` Tory S. Anderson
  2014-09-12 13:42     ` Oliver Kappel
                       ` (2 more replies)
  1 sibling, 3 replies; 20+ messages in thread
From: Tory S. Anderson @ 2014-09-12 12:16 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: help-gnu-emacs

Thanks for prompting me to be more precise. When my OS starts I launch a server with the autostart `emacs-client` command, and have the line in my .emacs to ensure the server is started. As it should, opening any number of new frames (or launching emacs-client again) will share the same buffer list, etc. However, this shell script for launching an email (apparently) starts a new server; it isn't sharing anything with the other frames, and if I don't `kill-emacs` I end up with two servers running. Clearly, not acceptable. 

Michael Heerdegen <michael_heerdegen@web.de> writes:

> torys.anderson@gmail.com (Tory S. Anderson) writes:
>
>> elisp_expr="(mailto-compose-mail \"$mailto\")"
>>
>> emacsclient -a "" -c -n --eval "$elisp_expr" \
>> 	'(set-window-dedicated-p (selected-window) t)'
>>
>> But somehow when I run this it starts a new emacsclient rather than
>> using the one I have running. If I remove the `-a ""` then nothing
>> happens at all. Why won't it connect to my existing emacsclient?
>
> What exactly do you mean with "existing emacsclient"?  You must have a
> running server.  A running Emacs is not enough.
>
> Michael.



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

* Re: emacsclient command line use existing client
  2014-09-12 12:16   ` Tory S. Anderson
@ 2014-09-12 13:42     ` Oliver Kappel
  2014-09-15 11:22       ` Tory S. Anderson
  2014-09-12 16:28     ` Subhan Michael Tindall
  2014-09-13 17:29     ` Harry Putnam
  2 siblings, 1 reply; 20+ messages in thread
From: Oliver Kappel @ 2014-09-12 13:42 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

my guess: emacsclient inside your script runs another installed
instance of emacs as you started emacs server with. With option -a ""
this instance will start another emacs in deamon mode. Probably the
$PATH while runing the mailto-script is different.

Check your OS "autostart `emacs-client` command" - as you mentioned -
and make sure your script uses the emacsclient from the same ./bin
directory. 

  Greetings, Oliver

12.09.2014 at 14:16 Tory S. Anderson wrote:

> Thanks for prompting me to be more precise. When my OS starts I launch
> a server with the autostart `emacs-client` command, and have the line
> in my .emacs to ensure the server is started. As it should, opening
> any number of new frames (or launching emacs-client again) will share
> the same buffer list, etc. However, this shell script for launching an
> email (apparently) starts a new server; it isn't sharing anything with
> the other frames, and if I don't `kill-emacs` I end up with two
> servers running. Clearly, not acceptable.
>
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
>> torys.anderson@gmail.com (Tory S. Anderson) writes:
>>
>>> elisp_expr="(mailto-compose-mail \"$mailto\")"
>>>
>>> emacsclient -a "" -c -n --eval "$elisp_expr" \
>>> 	'(set-window-dedicated-p (selected-window) t)'
>>>
>>> But somehow when I run this it starts a new emacsclient rather than
>>> using the one I have running. If I remove the `-a ""` then nothing
>>> happens at all. Why won't it connect to my existing emacsclient?
>>
>> What exactly do you mean with "existing emacsclient"?  You must have a
>> running server.  A running Emacs is not enough.
>>
>> Michael.




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

* RE: emacsclient command line use existing client
  2014-09-12 12:16   ` Tory S. Anderson
  2014-09-12 13:42     ` Oliver Kappel
@ 2014-09-12 16:28     ` Subhan Michael Tindall
  2014-09-13 17:29     ` Harry Putnam
  2 siblings, 0 replies; 20+ messages in thread
From: Subhan Michael Tindall @ 2014-09-12 16:28 UTC (permalink / raw)
  To: 'Tory S. Anderson', Michael Heerdegen; +Cc: help-gnu-emacs@gnu.org

Are you setting the name of the server in your startup script? Maybe this option will help:

'-s server-name'
'--socket-name=server-name'
Connect to the Emacs server named server-name. The server name is given by the variable server-name on the Emacs server. If this option is omitted, emacsclient connects to the first server it finds. (This option is not supported on MS-Windows.)



> -----Original Message-----
> From: help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org
> [mailto:help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org] On
> Behalf Of Tory S. Anderson
> Sent: Friday, September 12, 2014 5:17 AM
> To: Michael Heerdegen
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: emacsclient command line use existing client
> 
> Thanks for prompting me to be more precise. When my OS starts I launch a
> server with the autostart `emacs-client` command, and have the line in my
> .emacs to ensure the server is started. As it should, opening any number of
> new frames (or launching emacs-client again) will share the same buffer list,
> etc. However, this shell script for launching an email (apparently) starts a new
> server; it isn't sharing anything with the other frames, and if I don't `kill-
> emacs` I end up with two servers running. Clearly, not acceptable.
> 
> Michael Heerdegen <michael_heerdegen@web.de> writes:
> 
> > torys.anderson@gmail.com (Tory S. Anderson) writes:
> >
> >> elisp_expr="(mailto-compose-mail \"$mailto\")"
> >>
> >> emacsclient -a "" -c -n --eval "$elisp_expr" \
> >> 	'(set-window-dedicated-p (selected-window) t)'
> >>
> >> But somehow when I run this it starts a new emacsclient rather than
> >> using the one I have running. If I remove the `-a ""` then nothing
> >> happens at all. Why won't it connect to my existing emacsclient?
> >
> > What exactly do you mean with "existing emacsclient"?  You must have a
> > running server.  A running Emacs is not enough.
> >
> > Michael.


This message is intended for the sole use of the individual and entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message.  Thank you.




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

* Re: emacsclient command line use existing client
  2014-09-12 12:16   ` Tory S. Anderson
  2014-09-12 13:42     ` Oliver Kappel
  2014-09-12 16:28     ` Subhan Michael Tindall
@ 2014-09-13 17:29     ` Harry Putnam
  2 siblings, 0 replies; 20+ messages in thread
From: Harry Putnam @ 2014-09-13 17:29 UTC (permalink / raw)
  To: help-gnu-emacs

torys.anderson@gmail.com (Tory S. Anderson) writes:

> Thanks for prompting me to be more precise. When my OS starts I launch
> a server with the autostart `emacs-client` command, and have the line
> in my .emacs to ensure the server is started. As it should, opening

That sounds like you might be starting 2 servers.

Not sure what you mean there.  What line in .emacs? Does it start a
second server in addition to the one started when OS starts?

> any number of new frames (or launching emacs-client again) will share
> the same buffer list, etc. However, this shell script for launching an
> email (apparently) starts a new server; it isn't sharing anything with
> the other frames, and if I don't `kill-emacs` I end up with two
> servers running. Clearly, not acceptable.

In your script you need to say which emacsclient server to attache to.

something like `emacsclient -s SERVERNAME -c' (or what ever other flags
you use)

Will only attache to SERVERNAME




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

* Re: emacsclient command line use existing client
  2014-09-12 13:42     ` Oliver Kappel
@ 2014-09-15 11:22       ` Tory S. Anderson
  2014-09-15 12:04         ` Michael Heerdegen
  2014-09-15 12:28         ` Oliver Kappel
  0 siblings, 2 replies; 20+ messages in thread
From: Tory S. Anderson @ 2014-09-15 11:22 UTC (permalink / raw)
  To: Oliver Kappel; +Cc: help-gnu-emacs

Yeah, the problem is starting a new server every time. But all these commands just run `emacs-client`. I've even ditched the auto-start one and just execute a later emacs-client. I've added server names and specifications to each command. I now have: 

in .emacs:
----------
(require 'server)
(setq server-name "my-emacs-server")
(unless (server-running-p)
    (server-start))


in email.so:
----------
mailto=$1
mailto="mailto:${mailto#mailto:}"
mailto=$(printf '%s\n' "$mailto" | sed -e 's/[\"]/\\&/g')
emacs_server="my-emacs-server"
elisp_expr="(mailto-compose-mail \"$mailto\")"
emacsclient -a "" -c -n -s "$emacs_server" --eval "$elisp_expr" \
	'(set-window-dedicated-p (selected-window) t)'


my shortcut for opening emacs (which DOES open under the proper server)
---------
emacsclient -c -s "my-emacs-server"


And still clicking a @mailto: link (running email.so) starts a new, unattached server. 



Oliver Kappel <ngreply@gmx.net> writes:

> Hello,
>
> my guess: emacsclient inside your script runs another installed
> instance of emacs as you started emacs server with. With option -a ""
> this instance will start another emacs in deamon mode. Probably the
> $PATH while runing the mailto-script is different.
>
> Check your OS "autostart `emacs-client` command" - as you mentioned -
> and make sure your script uses the emacsclient from the same ./bin
> directory. 
>
>   Greetings, Oliver
>
> 12.09.2014 at 14:16 Tory S. Anderson wrote:
>
>> Thanks for prompting me to be more precise. When my OS starts I launch
>> a server with the autostart `emacs-client` command, and have the line
>> in my .emacs to ensure the server is started. As it should, opening
>> any number of new frames (or launching emacs-client again) will share
>> the same buffer list, etc. However, this shell script for launching an
>> email (apparently) starts a new server; it isn't sharing anything with
>> the other frames, and if I don't `kill-emacs` I end up with two
>> servers running. Clearly, not acceptable.
>>
>> Michael Heerdegen <michael_heerdegen@web.de> writes:
>>
>>> torys.anderson@gmail.com (Tory S. Anderson) writes:
>>>
>>>> elisp_expr="(mailto-compose-mail \"$mailto\")"
>>>>
>>>> emacsclient -a "" -c -n --eval "$elisp_expr" \
>>>> 	'(set-window-dedicated-p (selected-window) t)'
>>>>
>>>> But somehow when I run this it starts a new emacsclient rather than
>>>> using the one I have running. If I remove the `-a ""` then nothing
>>>> happens at all. Why won't it connect to my existing emacsclient?
>>>
>>> What exactly do you mean with "existing emacsclient"?  You must have a
>>> running server.  A running Emacs is not enough.
>>>
>>> Michael.



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

* Re: emacsclient command line use existing client
  2014-09-15 11:22       ` Tory S. Anderson
@ 2014-09-15 12:04         ` Michael Heerdegen
  2014-09-15 12:28         ` Oliver Kappel
  1 sibling, 0 replies; 20+ messages in thread
From: Michael Heerdegen @ 2014-09-15 12:04 UTC (permalink / raw)
  To: help-gnu-emacs

torys.anderson@gmail.com (Tory S. Anderson) writes:

> (setq server-name "my-emacs-server")

That this doesn't work could be due to bug#13319, "emacsclient doesn't
find server with nonstandard name".

Michael.




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

* Re: emacsclient command line use existing client
  2014-09-15 11:22       ` Tory S. Anderson
  2014-09-15 12:04         ` Michael Heerdegen
@ 2014-09-15 12:28         ` Oliver Kappel
  2014-09-19 17:12           ` Tory S. Anderson
  1 sibling, 1 reply; 20+ messages in thread
From: Oliver Kappel @ 2014-09-15 12:28 UTC (permalink / raw)
  To: help-gnu-emacs

In email.so try to set the absolute path for emacsclient.

/usr/local/bin/emacsclient  or whatever fits your environment. We
don't even know on what OS you are. `emacs-client` is unknown to me
and script extension .so is uncommon too.

I'm still not convinced your script is starting the right emacsclient,
as your shell/shortcut does.

Tory S. Anderson wrote:

> Yeah, the problem is starting a new server every time. But all these
> commands just run `emacs-client`. I've even ditched the auto-start
> one and just execute a later emacs-client. I've added server names
> and specifications to each command. I now have:  
>
> in .emacs:
> ----------
> (require 'server)
> (setq server-name "my-emacs-server")
> (unless (server-running-p)
>     (server-start))
>
>
> in email.so:
> ----------
> mailto=$1
> mailto="mailto:${mailto#mailto:}"
> mailto=$(printf '%s\n' "$mailto" | sed -e 's/[\"]/\\&/g')
> emacs_server="my-emacs-server"
> elisp_expr="(mailto-compose-mail \"$mailto\")"
> emacsclient -a "" -c -n -s "$emacs_server" --eval "$elisp_expr" \
> 	'(set-window-dedicated-p (selected-window) t)'
>
>
> my shortcut for opening emacs (which DOES open under the proper server)
> ---------
> emacsclient -c -s "my-emacs-server"
>
>
> And still clicking a @mailto: link (running email.so) starts a new, unattached server. 
>
>
>
> Oliver Kappel <ngreply@gmx.net> writes:
>
>> Hello,
>>
>> my guess: emacsclient inside your script runs another installed
>> instance of emacs as you started emacs server with. With option -a ""
>> this instance will start another emacs in deamon mode. Probably the
>> $PATH while runing the mailto-script is different.
>>
>> Check your OS "autostart `emacs-client` command" - as you mentioned -
>> and make sure your script uses the emacsclient from the same ./bin
>> directory. 
>>
>>   Greetings, Oliver
>>
>> 12.09.2014 at 14:16 Tory S. Anderson wrote:
>>
>>> Thanks for prompting me to be more precise. When my OS starts I launch
>>> a server with the autostart `emacs-client` command, and have the line
>>> in my .emacs to ensure the server is started. As it should, opening
>>> any number of new frames (or launching emacs-client again) will share
>>> the same buffer list, etc. However, this shell script for launching an
>>> email (apparently) starts a new server; it isn't sharing anything with
>>> the other frames, and if I don't `kill-emacs` I end up with two
>>> servers running. Clearly, not acceptable.
>>>
>>> Michael Heerdegen <michael_heerdegen@web.de> writes:
>>>
>>>> torys.anderson@gmail.com (Tory S. Anderson) writes:
>>>>
>>>>> elisp_expr="(mailto-compose-mail \"$mailto\")"
>>>>>
>>>>> emacsclient -a "" -c -n --eval "$elisp_expr" \
>>>>> 	'(set-window-dedicated-p (selected-window) t)'
>>>>>
>>>>> But somehow when I run this it starts a new emacsclient rather than
>>>>> using the one I have running. If I remove the `-a ""` then nothing
>>>>> happens at all. Why won't it connect to my existing emacsclient?
>>>>
>>>> What exactly do you mean with "existing emacsclient"?  You must have a
>>>> running server.  A running Emacs is not enough.
>>>>
>>>> Michael.




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

* Re: emacsclient command line use existing client
  2014-09-15 12:28         ` Oliver Kappel
@ 2014-09-19 17:12           ` Tory S. Anderson
  2014-09-19 17:38             ` Subhan Michael Tindall
  2014-09-20  2:14             ` Charles Philip Chan
  0 siblings, 2 replies; 20+ messages in thread
From: Tory S. Anderson @ 2014-09-19 17:12 UTC (permalink / raw)
  To: Oliver Kappel; +Cc: help-gnu-emacs

*sigh* still no go. I've put the full path in the calls everywhere, and I've named the server "server" instead of "emacs-client" (you were right; that was one problem). When I use a shortcut that calls just the "emacs-client -c" it opens, attached to "server" (with all the same buffers still available). When I go to the start menu and find "emacs client", it is also working appropriately. However, when I hit ~/email.so from my Firefox, it launches a new server. Adding the fully qualified path, and/or "-s server" doesn't change this. 

$ whereis emacsclient
emacsclient: /usr/bin/emacsclient /usr/share/man/man1/emacsclient.1.gz

I have only one location. Is there some reason that .so script (I could just as well rename it to .sh) is opening it as a new server? 

Running: 
GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.10.9) of 2014-08-18 on buildvm-21.phx2.fedoraproject.org
Fedora 20 x64 in KDE

<< full contents of email.so >>
-------------------------------
#!/bin/sh
# emacs-mailto-handler

mailto=$1
mailto="mailto:${mailto#mailto:}"
mailto=$(printf '%s\n' "$mailto" | sed -e 's/[\"]/\\&/g')
emacs_server="server"
elisp_expr="(mailto-compose-mail \"$mailto\")"

/usr/bin/emacsclient -a "" -c -n -s "$emacs_server" --eval "$elisp_expr" \
	'(set-window-dedicated-p (selected-window) t)'



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

* RE: emacsclient command line use existing client
  2014-09-19 17:12           ` Tory S. Anderson
@ 2014-09-19 17:38             ` Subhan Michael Tindall
  2014-09-19 17:44               ` Tory S. Anderson
  2014-09-20  2:14             ` Charles Philip Chan
  1 sibling, 1 reply; 20+ messages in thread
From: Subhan Michael Tindall @ 2014-09-19 17:38 UTC (permalink / raw)
  To: 'Tory S. Anderson', Oliver Kappel; +Cc: help-gnu-emacs@gnu.org



> -----Original Message-----
> From: help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org
> [mailto:help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org] On
> Behalf Of Tory S. Anderson
> Sent: Friday, September 19, 2014 10:12 AM
> To: Oliver Kappel
> Cc: help-gnu-emacs@gnu.org
> Subject: Re: emacsclient command line use existing client
> 
> *sigh* still no go. I've put the full path in the calls everywhere, and I've
> named the server "server" instead of "emacs-client" (you were right; that
> was one problem). When I use a shortcut that calls just the "emacs-client -c"
> it opens, attached to "server" (with all the same buffers still available). When
> I go to the start menu and find "emacs client", it is also working appropriately.
> However, when I hit ~/email.so from my Firefox, it launches a new server.
> Adding the fully qualified path, and/or "-s server" doesn't change this.
> 
> $ whereis emacsclient
> emacsclient: /usr/bin/emacsclient /usr/share/man/man1/emacsclient.1.gz
> 
> I have only one location. Is there some reason that .so script (I could just as
> well rename it to .sh) is opening it as a new server?
> 
> Running:
> GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.10.9) of 2014-
> 08-18 on buildvm-21.phx2.fedoraproject.org Fedora 20 x64 in KDE
> 
> << full contents of email.so >>
> -------------------------------
> #!/bin/sh
> # emacs-mailto-handler
> 
> mailto=$1
> mailto="mailto:${mailto#mailto:}"
> mailto=$(printf '%s\n' "$mailto" | sed -e 's/[\"]/\\&/g')
> emacs_server="server"
> elisp_expr="(mailto-compose-mail \"$mailto\")"
> 
> /usr/bin/emacsclient -a "" -c -n -s "$emacs_server" --eval "$elisp_expr" \
> 	'(set-window-dedicated-p (selected-window) t)'
^^^^^^
This line is your most obvious potential point of failure.  Have you checked your running script to make sure that your variable expansion is proper?
IE Is -s "$emacs_server" actually expanding to "server" and not say ""server"" or something obnoxious like that? 
Try hard-coding the call line to -s "server" and see what happens.



This message is intended for the sole use of the individual and entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message.  Thank you.




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

* Re: emacsclient command line use existing client
  2014-09-19 17:38             ` Subhan Michael Tindall
@ 2014-09-19 17:44               ` Tory S. Anderson
  0 siblings, 0 replies; 20+ messages in thread
From: Tory S. Anderson @ 2014-09-19 17:44 UTC (permalink / raw)
  To: Subhan Michael Tindall; +Cc: help-gnu-emacs@gnu.org

Just tried the hard-coding; no change in behavior. 

Subhan Michael Tindall <SubhanT@familycareinc.org> writes:

>> -----Original Message-----
>> From: help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org
>> [mailto:help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org] On
>> Behalf Of Tory S. Anderson
>> Sent: Friday, September 19, 2014 10:12 AM
>> To: Oliver Kappel
>> Cc: help-gnu-emacs@gnu.org
>> Subject: Re: emacsclient command line use existing client
>> 
>> *sigh* still no go. I've put the full path in the calls everywhere, and I've
>> named the server "server" instead of "emacs-client" (you were right; that
>> was one problem). When I use a shortcut that calls just the "emacs-client -c"
>> it opens, attached to "server" (with all the same buffers still available). When
>> I go to the start menu and find "emacs client", it is also working appropriately.
>> However, when I hit ~/email.so from my Firefox, it launches a new server.
>> Adding the fully qualified path, and/or "-s server" doesn't change this.
>> 
>> $ whereis emacsclient
>> emacsclient: /usr/bin/emacsclient /usr/share/man/man1/emacsclient.1.gz
>> 
>> I have only one location. Is there some reason that .so script (I could just as
>> well rename it to .sh) is opening it as a new server?
>> 
>> Running:
>> GNU Emacs 24.3.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.10.9) of 2014-
>> 08-18 on buildvm-21.phx2.fedoraproject.org Fedora 20 x64 in KDE
>> 
>> << full contents of email.so >>
>> -------------------------------
>> #!/bin/sh
>> # emacs-mailto-handler
>> 
>> mailto=$1
>> mailto="mailto:${mailto#mailto:}"
>> mailto=$(printf '%s\n' "$mailto" | sed -e 's/[\"]/\\&/g')
>> emacs_server="server"
>> elisp_expr="(mailto-compose-mail \"$mailto\")"
>> 
>> /usr/bin/emacsclient -a "" -c -n -s "$emacs_server" --eval "$elisp_expr" \
>> 	'(set-window-dedicated-p (selected-window) t)'
> ^^^^^^
> This line is your most obvious potential point of failure.  Have you checked your running script to make sure that your variable expansion is proper?
> IE Is -s "$emacs_server" actually expanding to "server" and not say ""server"" or something obnoxious like that? 
> Try hard-coding the call line to -s "server" and see what happens.
>
>
>
> This message is intended for the sole use of the individual and entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message.  Thank you.



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

* Re: emacsclient command line use existing client
  2014-09-19 17:12           ` Tory S. Anderson
  2014-09-19 17:38             ` Subhan Michael Tindall
@ 2014-09-20  2:14             ` Charles Philip Chan
  2014-09-20 10:42               ` Tory S. Anderson
  1 sibling, 1 reply; 20+ messages in thread
From: Charles Philip Chan @ 2014-09-20  2:14 UTC (permalink / raw)
  To: help-gnu-emacs


[-- Attachment #1.1: Type: text/plain, Size: 574 bytes --]

On 19 Sep 2014, torys.anderson@gmail.com wrote:

> << full contents of email.so >>
> -------------------------------
> #!/bin/sh
> # emacs-mailto-handler
>
> mailto=$1
> mailto="mailto:${mailto#mailto:}"
> mailto=$(printf '%s\n' "$mailto" | sed -e 's/[\"]/\\&/g')
> emacs_server="server"
> elisp_expr="(mailto-compose-mail \"$mailto\")"
>
> /usr/bin/emacsclient -a "" -c -n -s "$emacs_server" --eval
> 	"$elisp_expr" \ '(set-window-dedicated-p (selected-window) t)'

This is the small script that I have been using with Firefox's mailto
handler for years with no problems:


[-- Attachment #1.2: Mozmail --]
[-- Type: application/x-shellscript, Size: 122 bytes --]

[-- Attachment #1.3: Type: text/plain, Size: 66 bytes --]


Charles

-- 
"World domination.  Fast"
(By Linus Torvalds)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: emacsclient command line use existing client
  2014-09-20  2:14             ` Charles Philip Chan
@ 2014-09-20 10:42               ` Tory S. Anderson
  2014-09-20 11:35                 ` Charles Philip Chan
  0 siblings, 1 reply; 20+ messages in thread
From: Tory S. Anderson @ 2014-09-20 10:42 UTC (permalink / raw)
  To: Charles Philip Chan; +Cc: help-gnu-emacs

Ok. I did the following tests:

- Tried your script. From Firefox, it doesn't seem to run at all. From the command-line, it opens TWO emacs windows, one in a blank  "server" buffer and another with the email I want. Both are connected to the correct server, though. 
- My old script (as listed below) does exactly what it should from the command line; it's, apparently, just from Mozilla that it creates a new server. 

Charles Philip Chan <cpchan@bell.net> writes:

> On 19 Sep 2014, torys.anderson@gmail.com wrote:
>
>> << full contents of email.so >>
>> -------------------------------
>> #!/bin/sh
>> # emacs-mailto-handler
>>
>> mailto=$1
>> mailto="mailto:${mailto#mailto:}"
>> mailto=$(printf '%s\n' "$mailto" | sed -e 's/[\"]/\\&/g')
>> emacs_server="server"
>> elisp_expr="(mailto-compose-mail \"$mailto\")"
>>
>> /usr/bin/emacsclient -a "" -c -n -s "$emacs_server" --eval
>> 	"$elisp_expr" \ '(set-window-dedicated-p (selected-window) t)'
>
> This is the small script that I have been using with Firefox's mailto
> handler for years with no problems:
>
>
>
> Charles



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

* Re: emacsclient command line use existing client
  2014-09-20 10:42               ` Tory S. Anderson
@ 2014-09-20 11:35                 ` Charles Philip Chan
  2014-09-20 13:04                   ` Tory S. Anderson
  0 siblings, 1 reply; 20+ messages in thread
From: Charles Philip Chan @ 2014-09-20 11:35 UTC (permalink / raw)
  To: help-gnu-emacs

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

On 20 Sep 2014, torys.anderson@gmail.com wrote:

> - Tried your script. From Firefox, it doesn't seem to run at all.

Did you set "network.protocol-handler.app.mailto" in "about:config" in
Firefox to the script? It works for me.

> From the command-line, it opens TWO emacs windows, one in a blank
> "server" buffer and another with the email I want. Both are connected
> to the correct server,

Your are right. Something is screwy in message-mode. This didn't use to
happen (no server buffer).

Charles

-- 
I did this 'cause Linux gives me a woody.  It doesn't generate revenue.
(Dave '-ddt->` Taylor, announcing DOOM for Linux)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: emacsclient command line use existing client
  2014-09-20 11:35                 ` Charles Philip Chan
@ 2014-09-20 13:04                   ` Tory S. Anderson
  2014-09-21  1:32                     ` Charles Philip Chan
  2014-09-21  1:32                     ` Charles Philip Chan
  0 siblings, 2 replies; 20+ messages in thread
From: Tory S. Anderson @ 2014-09-20 13:04 UTC (permalink / raw)
  To: Charles Philip Chan; +Cc: help-gnu-emacs

Hmm.... I don't have a network.protocal-handler.app.mailto. I see:

network.protocal-handler.expose.mailto -> false
network.protocal-handler.external.mailto -> true
network.protocal-handler.warn-external.mailto -> false

I set email.sh as the handler under Firefox Preferences -> Applications -> mailto:

Running Firefox 32.0, Fedora 20, KDE



Charles Philip Chan <cpchan@bell.net> writes:

> On 20 Sep 2014, torys.anderson@gmail.com wrote:
>
>> - Tried your script. From Firefox, it doesn't seem to run at all.
>
> Did you set "network.protocol-handler.app.mailto" in "about:config" in
> Firefox to the script? It works for me.
>
>> From the command-line, it opens TWO emacs windows, one in a blank
>> "server" buffer and another with the email I want. Both are connected
>> to the correct server,
>
> Your are right. Something is screwy in message-mode. This didn't use to
> happen (no server buffer).
>
> Charles



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

* Re: emacsclient command line use existing client
  2014-09-20 13:04                   ` Tory S. Anderson
  2014-09-21  1:32                     ` Charles Philip Chan
@ 2014-09-21  1:32                     ` Charles Philip Chan
  2014-09-22 18:53                       ` Tory S. Anderson
  1 sibling, 1 reply; 20+ messages in thread
From: Charles Philip Chan @ 2014-09-21  1:32 UTC (permalink / raw)
  To: help-gnu-emacs


[-- Attachment #1.1.1: Type: text/plain, Size: 766 bytes --]

On 20 Sep 2014, torys.anderson@gmail.com wrote:

> Hmm.... I don't have a network.protocal-handler.app.mailto. I see:
>
> network.protocal-handler.expose.mailto -> false
> network.protocal-handler.external.mailto -> true
> network.protocal-handler.warn-external.mailto -> false

See, there is no mailto handler in your prefs.js.

> I set email.sh as the handler under Firefox Preferences ->
> Applications -> mailto:

Strange, setting "Firefox Preferences -> Applications -> mailto:" should
set "network.protocal-handler.app.mailto".[1]

Maybe you can try adding it manually in "about:config". Right click on
the column head -> New -> String.

Charles

Footnotes: 
[1] http://kb.mozillazine.org/Network.protocol-handler.app.%28protocol%29



[-- Attachment #1.1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: emacsclient command line use existing client
  2014-09-20 13:04                   ` Tory S. Anderson
@ 2014-09-21  1:32                     ` Charles Philip Chan
  2014-09-21  1:32                     ` Charles Philip Chan
  1 sibling, 0 replies; 20+ messages in thread
From: Charles Philip Chan @ 2014-09-21  1:32 UTC (permalink / raw)
  To: help-gnu-emacs

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

On 20 Sep 2014, torys.anderson@gmail.com wrote:

> Hmm.... I don't have a network.protocal-handler.app.mailto. I see:
>
> network.protocal-handler.expose.mailto -> false
> network.protocal-handler.external.mailto -> true
> network.protocal-handler.warn-external.mailto -> false

See, there is no mailto handler in your prefs.js.

> I set email.sh as the handler under Firefox Preferences ->
> Applications -> mailto:

Strange, setting "Firefox Preferences -> Applications -> mailto:" should
set "network.protocal-handler.app.mailto".[1]

Maybe you can try adding it manually in "about:config". Right click on
the column head -> New -> String.

Charles

Footnotes: 
[1] http://kb.mozillazine.org/Network.protocol-handler.app.%28protocol%29



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: emacsclient command line use existing client
  2014-09-21  1:32                     ` Charles Philip Chan
@ 2014-09-22 18:53                       ` Tory S. Anderson
  0 siblings, 0 replies; 20+ messages in thread
From: Tory S. Anderson @ 2014-09-22 18:53 UTC (permalink / raw)
  To: Charles Philip Chan; +Cc: help-gnu-emacs

Yeah, I created network.protocal-handler.app.mailto manually but it still doesn't change things; it starts a new server. 

Charles Philip Chan <cpchan@bell.net> writes:

> On 20 Sep 2014, torys.anderson@gmail.com wrote:
>
>> Hmm.... I don't have a network.protocal-handler.app.mailto. I see:
>>
>> network.protocal-handler.expose.mailto -> false
>> network.protocal-handler.external.mailto -> true
>> network.protocal-handler.warn-external.mailto -> false
>
> See, there is no mailto handler in your prefs.js.
>
>> I set email.sh as the handler under Firefox Preferences ->
>> Applications -> mailto:
>
> Strange, setting "Firefox Preferences -> Applications -> mailto:" should
> set "network.protocal-handler.app.mailto".[1]
>
> Maybe you can try adding it manually in "about:config". Right click on
> the column head -> New -> String.
>
> Charles
>
> Footnotes: 
> [1] http://kb.mozillazine.org/Network.protocol-handler.app.%28protocol%29



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

end of thread, other threads:[~2014-09-22 18:53 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11 12:58 emacsclient command line use existing client Tory S. Anderson
2014-09-12  2:42 ` Michael Heerdegen
2014-09-12  7:43   ` Thorsten Jolitz
2014-09-12 12:16   ` Tory S. Anderson
2014-09-12 13:42     ` Oliver Kappel
2014-09-15 11:22       ` Tory S. Anderson
2014-09-15 12:04         ` Michael Heerdegen
2014-09-15 12:28         ` Oliver Kappel
2014-09-19 17:12           ` Tory S. Anderson
2014-09-19 17:38             ` Subhan Michael Tindall
2014-09-19 17:44               ` Tory S. Anderson
2014-09-20  2:14             ` Charles Philip Chan
2014-09-20 10:42               ` Tory S. Anderson
2014-09-20 11:35                 ` Charles Philip Chan
2014-09-20 13:04                   ` Tory S. Anderson
2014-09-21  1:32                     ` Charles Philip Chan
2014-09-21  1:32                     ` Charles Philip Chan
2014-09-22 18:53                       ` Tory S. Anderson
2014-09-12 16:28     ` Subhan Michael Tindall
2014-09-13 17:29     ` Harry Putnam

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