class Emacs < Formula desc "GNU Emacs text editor" homepage "https://www.gnu.org/software/emacs/" url "https://ftp.gnu.org/gnu/emacs/emacs-26.3.tar.xz" mirror "https://ftpmirror.gnu.org/emacs/emacs-26.3.tar.xz" sha256 "4d90e6751ad8967822c6e092db07466b9d383ef1653feb2f95c93e7de66d3485" bottle do sha256 "9ab33f4386ca5f7326a8c28da1324556ec990f682a7ca88641203da0b42dbdae" => :catalina sha256 "8162a26246de7db44c53ea0d0ef0a806140318d19c69e8e5e33aa88ce7e823a8" => :mojave sha256 "6a2629b6deddf99f81abb1990ecd6c87f0242a0eecbb6b6c2e4c3540e421d4c4" => :high_sierra sha256 "2a47477e71766d7dd6b16c29ad5ba71817ed80d06212e3261ef3c776e7e9f5a2" => :sierra end head do url "https://github.com/emacs-mirror/emacs.git" depends_on "autoconf" => :build depends_on "gnu-sed" => :build depends_on "texinfo" => :build end depends_on "pkg-config" => :build depends_on "gnutls" def install args = %W[ --disable-dependency-tracking --disable-silent-rules --enable-locallisppath=#{HOMEBREW_PREFIX}/share/emacs/site-lisp --infodir=#{info}/emacs --prefix=#{prefix} --with-gnutls --without-x --with-xml2 --without-dbus --with-modules --without-ns --without-imagemagick ] if build.head? ENV.prepend_path "PATH", Formula["gnu-sed"].opt_libexec/"gnubin" system "./autogen.sh" end system "./configure", *args system "make" system "make", "install" # Follow MacPorts and don't install ctags from Emacs. This allows Vim # and Emacs and ctags to play together without violence. (bin/"ctags").unlink (man1/"ctags.1.gz").unlink end plist_options :manual => "emacs" def plist; <<~EOS KeepAlive Label #{plist_name} ProgramArguments #{opt_bin}/emacs --fg-daemon RunAtLoad EOS end test do assert_equal "4", shell_output("#{bin}/emacs --batch --eval=\"(print (+ 2 2))\"").strip end end