From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: torys.anderson@gmail.com (Tory S. Anderson) Newsgroups: gmane.emacs.help Subject: Re: emacsclient command line use existing client Date: Mon, 15 Sep 2014 07:22:20 -0400 Message-ID: <87iokpuo0j.fsf@gmail.com> References: <87zje671q3.fsf@gmail.com> <87egvhk19v.fsf@web.de> <87lhppvxsj.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410780168 19876 80.91.229.3 (15 Sep 2014 11:22:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 15 Sep 2014 11:22:48 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Oliver Kappel Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 15 13:22:43 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 1XTUMl-0003gZ-12 for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Sep 2014 13:22:43 +0200 Original-Received: from localhost ([::1]:58874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUMk-0002Vq-K2 for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Sep 2014 07:22:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58790) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUMW-0002Vi-AP for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 07:22:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTUMR-0002q8-3z for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 07:22:28 -0400 Original-Received: from mail-yh0-x22b.google.com ([2607:f8b0:4002:c01::22b]:42231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTUMQ-0002pK-VE for help-gnu-emacs@gnu.org; Mon, 15 Sep 2014 07:22:23 -0400 Original-Received: by mail-yh0-f43.google.com with SMTP id v1so2032860yhn.16 for ; Mon, 15 Sep 2014 04:22:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=k8jmJfq37wAuAqTs4jqyxyjDpBQqkaHVFCKk/tM8uhs=; b=B1zQxI0ko373l2GXwUFLTbviAdF1NWVfqbF2b9cDI/IrH8TNKzdI5dKOnQd6hKBmi2 mDx9aWRIEbZGY4COWZD09w2zuhiIBpyYiCxTN5MBN6tWIbVGdjs2uGyxyLdMwyZsKNK5 DW5wAd8ysiF/SaYXYOTJ14rkqlKeBzwCpgT7bgFWxbcEotnqcnxYVPobimUudM4mgkM4 02kzj8e/2R6Hta61XJBYMwjEG1oUAr30F2UP8JOHKPKkfpMHd8+By/jK7oNTDnQgSBO8 RoB75pT88pd3VtVW9g/joeKCsta8V7Pd3uoPB17D3mf5/X8vl7nz2L9rLiQXSLj7YKAX WCbA== X-Received: by 10.236.83.132 with SMTP id q4mr81972yhe.124.1410780142181; Mon, 15 Sep 2014 04:22:22 -0700 (PDT) Original-Received: from localhost.localdomain ([2601:0:a000:4a1:ee55:f9ff:feb5:5589]) by mx.google.com with ESMTPSA id h92sm5116772yhq.21.2014.09.15.04.22.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Sep 2014 04:22:21 -0700 (PDT) In-Reply-To: (Oliver Kappel's message of "Fri, 12 Sep 2014 15:42:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c01::22b 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:99909 Archived-At: 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.