class Emacs < Formula desc "GNU Emacs text editor" homepage "https://www.gnu.org/software/emacs/" url "https://ftp.gnu.org/gnu/emacs/emacs-26.2.tar.xz" mirror "https://ftpmirror.gnu.org/emacs/emacs-26.2.tar.xz" sha256 "151ce69dbe5b809d4492ffae4a4b153b2778459de6deb26f35691e1281a9c58e" bottle do sha256 "dc49de7034346e692662d10ebacd75ea257d61ebba6f57699b855f158e4a7eda" => :mojave sha256 "de836e0766066201968c2dd0ef25ff4458ee532a61dc4ed9d7d8fb284b395b8d" => :high_sierra sha256 "6b07616447d66a8066c08591400dc8fed75d44bf51f81de2e1208635e03204c6" => :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