Skip to content

Instantly share code, notes, and snippets.

@scotthaleen
Last active March 18, 2026 04:05
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 31 (2026-03-17)

eval "$(/opt/homebrew/bin/brew shellenv)"
export PATH="/opt/homebrew/opt/texinfo/bin:$PATH"
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:/opt/homebrew/share/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
export CPPFLAGS="-I/opt/homebrew/include -I$(brew --prefix libgccjit)/include${CPPFLAGS:+ $CPPFLAGS}"
export LDFLAGS="-L/opt/homebrew/lib -L$(brew --prefix gcc)/lib/gcc/current -L$(brew --prefix libgccjit)/lib/gcc/current${LDFLAGS:+ $LDFLAGS}"

./autogen.sh
./configure --with-tree-sitter=yes --with-native-compilation=yes

# make -C lisp autoloads-force
# need to remove old *.elc files from lisp/ if using _dirty_ git directory 
make -j$(sysctl -n hw.ncpu)
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