Skip to content

Instantly share code, notes, and snippets.

@scotthaleen
Last active February 21, 2026 01:51
Show Gist options
  • Select an option

  • Save scotthaleen/c2e589cc006a5836ec4a9c096667dc6f to your computer and use it in GitHub Desktop.

Select an option

Save scotthaleen/c2e589cc006a5836ec4a9c096667dc6f to your computer and use it in GitHub Desktop.
emacs master
#!/usr/bin/env sh
emacs -nw -Q --no-site-file --load ~/.emacs.d/minimal.el -f text-mode "$@"
#!/bin/bash
export EMACSLOADPATH="${EMACSLOADPATH}:$(pwd)"
open -a ~/Applications/Emacs.app --args --eval "(cd \"${PWD}\")" "$@"

Emacs 29 (2023-02-22)

export PATH="/usr/local/opt/imagemagick@7/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/imagemagick@7/lib"
export CPPFLAGS="-I/usr/local/opt/imagemagick@7/include"
export PKG_CONFIG_PATH="/usr/local/opt/imagemagick@7/lib/pkgconfig"


export LDFLAGS="-L/usr/local/opt/libffi/lib $LDFLAGS"
export CPPFLAGS="-I/usr/local/opt/libffi/include $CPPFLAGS"
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig:$PKG_CONFIG_PATH"

export LDFLAGS="-L$(brew --prefix libgccjit)/lib/gcc/current"
export CPPFLAGS="-I$(brew --prefix libgccjit)/include"
./autogen.sh
./configure --with-gnutls --without-pop --with-imagemagick --without-x --with-json --without-dbus --with-ns --with-tree-sitter --with-xml2 --with-modules

# make -C lisp autoloads-force
# need to remove old *.elc files from lisp/ if using _dirty_ git directory 
make
make install
mv nextstep/Emacs.app ~/Applications/

https://www.emacswiki.org/emacs/EmacsForMacOS#toc23

#!/bin/sh
## /usr/local/bin/emacsnw
## launch in terminal
~/Applications/Emacs.app/Contents/MacOS/Emacs -nw "$@"
;; -*- lexical-binding: t; -*-
;; ----------------------------
;; Minimal UI
;; ----------------------------
(menu-bar-mode -1) ;; no menu bar
(tool-bar-mode -1) ;; no toolbar
(scroll-bar-mode -1) ;; no scrollbars
(setq inhibit-startup-screen t)
;; ----------------------------
;; Line numbers
;; ----------------------------
(global-display-line-numbers-mode 1)
(global-hl-line-mode 1) ;; highlight current line
;; ----------------------------
;; No backups / autosave
;; ----------------------------
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq create-lockfiles nil)
;; ----------------------------
;; Basic editing defaults
;; ----------------------------
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
(setq select-enable-clipboard t)
;; copy buff
(defun save-region-to-temp-file (beg end)
"Save region to /tmp/.emacs_clip and show byte count in the minibuffer."
(interactive "r")
(write-region beg end "/tmp/.emacs_clip")
;; exact byte size
(let ((byte-count (string-bytes (buffer-substring-no-properties beg end))))
(message "Copied %d bytes to /tmp/.emacs_clip" byte-count)))
(global-set-key (kbd "C-c C-y") 'save-region-to-temp-file)
;; Keep normal kill-ring copy too
(global-set-key (kbd "M-w") 'kill-ring-save)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment