Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

Commit

Permalink
Use startup script instead of symlink for cocoa emacs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamv committed Sep 7, 2010
1 parent 5c9c699 commit 2a0250e
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions Library/Formula/emacs.rb
@@ -1,5 +1,7 @@
require 'formula'

# For tips on Cocoa Emacs, see:
# * http://superuser.com/questions/73500/on-os-x-how-do-i-start-cocoa-emacs-and-bring-it-to-front
class Emacs <Formula
url 'http://ftp.gnu.org/pub/gnu/emacs/emacs-23.2.tar.bz2'
md5 '057a0379f2f6b85fb114d8c723c79ce2'
Expand Down Expand Up @@ -52,33 +54,36 @@ def caveats
return s
end

def cocoa_startup_script; <<-EOS.undent
#!/bin/bash
open -a #{prefix}/Emacs.app/Contents/MacOS/Emacs --args $@
EOS
end

def install
fails_with_llvm "Duplicate symbol errors while linking."

configure_args = [
args = [
"--prefix=#{prefix}",
"--without-dbus",
"--enable-locallisppath=#{HOMEBREW_PREFIX}/share/emacs/site-lisp",
]

if ARGV.include? "--cocoa"
configure_args << "--with-ns" << "--disable-ns-self-contained"
system "./configure", *configure_args
args << "--with-ns" << "--disable-ns-self-contained"
system "./configure", *args
system "make bootstrap"
system "make install"
prefix.install "nextstep/Emacs.app"
bin.mkpath
ln_s prefix+"Emacs.app/Contents/MacOS/Emacs", bin+"emacs"
(bin+"emacs").write cocoa_startup_script
else
if ARGV.include? "--with-x"
configure_args << "--with-x"
configure_args << "--with-gif=no"
configure_args << "--with-tiff=no"
configure_args << "--with-jpeg=no"
args << "--with-x"
args << "--with-gif=no" << "--with-tiff=no" << "--with-jpeg=no"
else
configure_args << "--without-x"
args << "--without-x"
end
system "./configure", *configure_args
system "./configure", *args
system "make"
system "make install"
end
Expand Down

3 comments on commit 2a0250e

@mkhl
Copy link
Contributor

@mkhl mkhl commented on 2a0250e Sep 8, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using this script completely disables things like batch mode or server mode.
Also, its quoting is horribly broken.

@adamv
Copy link
Contributor Author

@adamv adamv commented on 2a0250e Sep 8, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to suggestion; the previous behavior of "open window in the background and hang the terminal" kind of sucked too.

@mkhl
Copy link
Contributor

@mkhl mkhl commented on 2a0250e Sep 8, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but only kind of. I'd suggest:

  1. Revert this commit (removing features is worse than opening windows in the background)
  2. Report this issue (this is an upstream problem, not a packaging one; the issue is the backgrounding window; the "hanging" is intentional and, in my opinion, correct)
  3. Symlink …/MacOS/bin/emacsclient to bin (so users wanting this behaviour can find the intended tool for it)

Please sign in to comment.