It is sometimes the case that you may accidentally press Ctrl-z while in Emacs and the Emacs Window magically disappears. Ctrl-z is by default bound to iconify-frame which is another way of saying minimize the window. To make this feature more pleasant, introduce a yes or no confirmation when Ctrl-z is pressed. Add the following code to your .emacs file.
(defun smart-iconify-or-deiconify-frame()
(interactive)
(if (yes-or-no-p (format "Are you sure you want to iconify/deiconify Emacs? "))
(iconify-frame))
)
(global-set-key [?\C-z] 'smart-iconify-or-deiconify-frame)
This comment has been removed by the author.
ReplyDeleteHello,
ReplyDeleteIve added a test for the graphical environment and also rebind C-x C-z here.
Great addition.
ReplyDelete