Skip to content

Instantly share code, notes, and snippets.

@jhrr
Last active January 6, 2024 07:25
Show Gist options
  • Save jhrr/8852178 to your computer and use it in GitHub Desktop.
Save jhrr/8852178 to your computer and use it in GitHub Desktop.
Make sure emacsen in a graphical frame running on OSX have the correct path and that the hash key (alt-3) is working.
;; Detect OS
(defvar macosx-p (string-match "darwin" (symbol-name system-type)))
;; osx fixes
(defun insert-hash ()
(interactive)
(insert "#"))
(defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell
(shell-command-to-string "$SHELL -i -c 'echo $PATH'")))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))
(when macosx-p
(global-set-key "\263" 'insert-hash)
(set-exec-path-from-shell-PATH))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment