From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Oliver Kappel Newsgroups: gmane.emacs.help Subject: Re: emacsclient command line use existing client Date: Mon, 15 Sep 2014 14:28:42 +0200 Message-ID: References: <87zje671q3.fsf@gmail.com> <87egvhk19v.fsf@web.de> <87lhppvxsj.fsf@gmail.com> <87iokpuo0j.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410784176 8147 80.91.229.3 (15 Sep 2014 12:29:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Sep 2014 12:29:36 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 15 14:29:30 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XTVPK-0003Pf-Sq for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Sep 2014 14:29:26 +0200 Original-Received: from localhost ([::1]:59438 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTVPK-0006Xi-HF for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Sep 2014 08:29:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44271) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTVP2-0006SN-GQ for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 08:29:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTVOu-0007Nx-KA for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 08:29:08 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:45489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTVOu-0007Nn-A5 for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 08:29:00 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XTVOs-0003DH-M1 for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 14:28:58 +0200 Original-Received: from tmo-108-53.customers.d1-online.com ([80.187.108.53]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Sep 2014 14:28:58 +0200 Original-Received: from ngreply by tmo-108-53.customers.d1-online.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Sep 2014 14:28:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 87 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: tmo-108-53.customers.d1-online.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.90 (darwin) Cancel-Lock: sha1:zB3dvVUpyBW6OsImNbXe/0EgaDY= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99917 Archived-At: 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 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 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.