Created
June 19, 2011 16:57
-
-
Save perusio/1034475 to your computer and use it in GitHub Desktop.
How to prevent accidental iconification in Emacs
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
;;; This is taken from planet Emacsen: http://tsengf.blogspot.com/2011/06/prevent-accidental-iconify-of-emacs.html. | |
;;; I've added a check to see if we're on a graphic environment. | |
;;; Prevent acidental iconify/suspend. | |
(when (window-system) | |
(defun smart-iconify-or-deiconify-frame () | |
"Present a confirmation before suspending/iconifying." | |
(interactive) | |
(if (yes-or-no-p (format "Are you sure you want to iconify/deiconify Emacs? ")) | |
(iconify-frame))) | |
;; Rebinding C-z to the new function. | |
(global-set-key (kbd "C-z") 'smart-iconify-or-deiconify-frame) | |
;; Rebinding C-x C-z to the new function. Overrides suspend-frame. | |
(global-set-key (kbd "C-x C-z") 'smart-iconify-or-deiconify-frame))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment