Created
March 3, 2011 15:35
-
-
Save ivey/852946 to your computer and use it in GitHub Desktop.
This file contains 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)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment