Skip to content

Instantly share code, notes, and snippets.

@Altech
Last active October 13, 2015 04:57
Show Gist options
  • Save Altech/4142388 to your computer and use it in GitHub Desktop.
Save Altech/4142388 to your computer and use it in GitHub Desktop.
The way to `cache` the application Cocoa Emacs.
(global-set-key (kbd "C-x C-c") 'close-on-mac)
(require 'cl)
(defun close-buffers-without-default ()
(interactive)
(loop for buffer being the buffers
do ((lambda (buffer)
(if (and (not (string= (buffer-name buffer) "*GNU Emacs*"))
(not (string= (buffer-name buffer) "*scratch*"))
(not (string= (buffer-name buffer) "*Messages*")))
(kill-buffer buffer))) buffer)))
(defun close-on-mac ()
(interactive)
(close-buffers-without-default)
(switch-to-buffer "*GNU Emacs*")
(delete-other-windows)
(delete-other-frames)
(beginning-of-buffer)
(ns-do-hide-emacs))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment