unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Chunyang Xu <xuchunyang56@gmail.com>
To: "Alberto Simões" <hashashin@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Emacs, Mac OS X and opening from Shell
Date: Sat, 26 Sep 2015 02:42:31 +0800	[thread overview]
Message-ID: <m2oagq1gtk.fsf@gmail.com> (raw)
In-Reply-To: <CAAkRyrvhswdYrtLeHcZ4poiB4xB-rxMV8FVcyfF3T753Jp4tcg@mail.gmail.com>


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



  parent reply	other threads:[~2015-09-25 18:42 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-25 14:47 Emacs, Mac OS X and opening from Shell Alberto Simões
2015-09-25 17:33 ` Eli Zaretskii
2015-09-25 17:38   ` Alberto Simões
2015-09-25 18:31     ` Eli Zaretskii
2015-09-25 18:41       ` Alberto Simões
2015-09-28 11:32         ` Alan Schmitt
2015-09-25 18:42 ` Chunyang Xu [this message]
2015-09-25 18:44   ` Alberto Simões

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2oagq1gtk.fsf@gmail.com \
    --to=xuchunyang56@gmail.com \
    --cc=hashashin@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).