Created
March 7, 2012 20:21
-
-
Save ivey/1995762 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun intelligent-close () | |
"quit a frame the same way no matter what kind of frame you are on" | |
(interactive) | |
(if (eq (car (visible-frame-list)) (selected-frame)) | |
;;for parent/master frame... | |
(if (> (length (visible-frame-list)) 1) | |
;;close a parent with children present | |
(delete-frame (selected-frame)) | |
;;close a parent with no children present | |
(when (y-or-n-p "Quit emacs? ") (save-buffers-kill-emacs))) | |
;;close a child frame | |
(delete-frame (selected-frame)))) | |
(global-set-key (kbd "C-x C-c") 'intelligent-close) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment