help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Feature request] I suggest delete-frame command can prompt user for con


From: Christopher M. Miles
Subject: [Feature request] I suggest delete-frame command can prompt user for confirmation
Date: Sun, 14 Nov 2021 10:59:50 +0800
User-agent: mu4e 1.7.0; emacs 28.0.60

I found I always accidentally confused [C-x 5 0] and [C-x 5 o] keybindings. I 
hope Emacs can add add
prompt confirmation to avoid user accidentally delete frame. Because it can't 
undo with winner
package etc.

#+begin_src emacs-lisp
(defun my/delete-frame-confirm (origin-func &optional args)
  "Ask user to confirm whether really delete frame.
To avoid accidentally [C-x 5 0] delete frame which confused with keybinding 
[C-x 5 o]."
  (if (yes-or-no-p "Are you sure to delete current frame? ")
      (apply origin-func args)
    (message "I don't want to delete frame accidently!")))

(advice-add 'delete-frame :around #'my/delete-frame-confirm)
#+end_src

What do you think?

-- 
[ stardiviner ]
       I try to make every word tell the meaning that I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]