Skip to content

Instantly share code, notes, and snippets.

@nnja
Created December 10, 2016 00:14
Show Gist options
  • Save nnja/05b58743407642c1f1edda522b893660 to your computer and use it in GitHub Desktop.
Save nnja/05b58743407642c1f1edda522b893660 to your computer and use it in GitHub Desktop.
emacs config for playing nicely with osx
;;; OSX specific settings
;;; Borrowed heavily from https://github.com/rejeep/emacs
(defun live-copy-from-osx ()
(shell-command-to-string "pbpaste"))
(defun live-paste-to-osx (text &optional push)
(let ((process-connection-type nil))
(let ((proc (start-process "pbcopy" "*Messages*" "pbcopy")))
(process-send-string proc text)
(process-send-eof proc))))
(when (not window-system)
(setq interprogram-cut-function 'live-paste-to-osx)
(setq interprogram-paste-function 'live-copy-from-osx))
(defun finder ()
"Opens file directory in Finder."
(interactive)
(let ((file (buffer-file-name)))
(if file
(shell-command
(format "%s %s" (executable-find "open") (file-name-directory file)))
(error "Buffer is not attached to any file."))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment