From c5b6a0774db7ecb2920db342abab5dbf5bcad9fb Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 14 Sep 2021 16:56:46 -0500 Subject: Add fat-finger-exit --- init.el | 3 +-- lisp/acdw.el | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index 47ca218..ec5a825 100644 --- a/init.el +++ b/init.el @@ -781,8 +781,7 @@ AKA, DO NOT USE THIS FUNCTION!!!" "C-x o" #'acdw/other-window-or-switch-buffer "C-x O" #'acdw/other-window-or-switch-buffer-backward "C-c _" #'add-file-local-variable - "C-x C-c" #'delete-frame ; I keep fat-fingering and exiting - ) + "C-x C-c" #'acdw/fat-finger-exit) (:with-map toggle-map (:bind "c" #'column-number-mode diff --git a/lisp/acdw.el b/lisp/acdw.el index 91381da..b8a1906 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -632,6 +632,18 @@ This function is internal. Use `acdw/make-password-fetcher' instead." (interactive "p") (dotimes (or n 1) (insert "💩"))) + +;;; Fat finger solutions +(defun acdw/fat-finger-exit (&optional prefix) + "Delete a frame, or kill Emacs with confirmation. +When called with PREFIX, just kill Emacs without confirmation." + (interactive "P") + (if (or prefix + (and (= 1 (length (frame-list))) + (yes-or-no-p "This is the last frame! Wanna quit?"))) + (kill-emacs) + (ignore-errors + (delete-frame)))) (provide 'acdw) ;;; acdw.el ends here -- cgit 1.4.1-21-gabe81