From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chunyang Xu Newsgroups: gmane.emacs.help Subject: Re: Emacs, Mac OS X and opening from Shell Date: Sat, 26 Sep 2015 02:42:31 +0800 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1443216327 8170 80.91.229.3 (25 Sep 2015 21:25:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Sep 2015 21:25:27 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Alberto =?utf-8?Q?Sim=C3=B5es?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Sep 25 23:25:23 2015 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 1ZfaUW-00009v-7A for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Sep 2015 23:25:16 +0200 Original-Received: from localhost ([::1]:50551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfaUV-0000uf-JK for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Sep 2015 17:25:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34699) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfXxF-0007yS-06 for help-gnu-emacs@gnu.org; Fri, 25 Sep 2015 14:42:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfXxB-0003ZE-Q2 for help-gnu-emacs@gnu.org; Fri, 25 Sep 2015 14:42:44 -0400 Original-Received: from mail-qg0-x234.google.com ([2607:f8b0:400d:c04::234]:35673) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfXxB-0003Yt-MI for help-gnu-emacs@gnu.org; Fri, 25 Sep 2015 14:42:41 -0400 Original-Received: by qgt47 with SMTP id 47so76557679qgt.2 for ; Fri, 25 Sep 2015 11:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version:content-type:content-transfer-encoding; bh=70JLUdz2xJ3AuDhTUv7tqNw7gGt5m/SsUIjLsaVgFg0=; b=jPbH8sZgWNrfMWJNwE+H/bEyDGwOxg+Bc/vtzplvUi5PAU8Zj+HQh0YCDIPvLGgB9G nFTNHhrHu343dSZOY62kj3Znn7z4gIjKVRg9u2l+loJezMo8RgDNGwa0+RZF1R6jM2DK +ycqw6wP3LMi45+AaQ1a9/ybFmB217CuYS758dbY97BPqLWR6y36pbluosgs+7L2GT4Y HpDI5patMMBmPeMUjgNFFJmX0mKUM9YtlIU26hKTc/B6SGuBLq3h8ZZHFXiqx+IWQ27a GAU55VlqMFwQekKz6nmM47K8W0A4fEP4pi63P4TfnVsBvWAehqsZXBDFBqdXtTF6Ktd6 RPKA== X-Received: by 10.140.93.68 with SMTP id c62mr8223119qge.54.1443206561006; Fri, 25 Sep 2015 11:42:41 -0700 (PDT) Original-Received: from localhost ([104.131.188.61]) by smtp.gmail.com with ESMTPSA id b127sm1930050qhc.46.2015.09.25.11.42.36 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Sep 2015 11:42:39 -0700 (PDT) User-agent: mu4e 0.9.12-1c98835; emacs 25.0.50.9 In-reply-to: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::234 X-Mailman-Approved-At: Fri, 25 Sep 2015 17:24:57 -0400 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:107356 Archived-At: Alberto Simões writes: > Dear Emacs users, > > I've been an Emacs user for some decades, but never a really emacs hacker. > In the latest months I've been using Sublime for Mac, but I am missing > emacs a lot. > > So, in the come back, I am trying to make the emacs command to open an > emacs window, if one is open, or opening a new buffer in the current window > (and focus that buffer if possible). open(1) works for me, for example, $ open -a Emacs ~/.emacs.d/init.el if *.el has been set Emacs as its default opening App, you can also omit '-a Emacs': $ open ~/.emacs.d/init.el It should work out-of-box, i.e., no configuration needed from the Emacs side, the following should works for you: # Start a fresh Emacs $ open -a /Applications/Emacs.app -n --args -Q # Open a file $ open -a /Applications/Emacs.app ~/.emacs.d/init.el BTW, emacsclient(1) works as well. After 'M-x server-start' from a GUI Emacs window: $ emacsclient --no-wait ~/.emacs.d/init.el > Currently, my emacs command line is a shell script that looks like this: > > /Applications/Emacs.app/Contents/MacOS/Emacs "$@" & > > This, of course, open a new window (although I usually close it, as the > buffers are shared among windows). > > Any idea how I can make it behave as I described earlier? > > Thank you, > Alberto -- Chunyang Xu