unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* [Feature request] I suggest delete-frame command can prompt user for confirmation
@ 2021-11-14  2:59 Christopher M. Miles
  2021-11-15  1:15 ` Michael Heerdegen
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher M. Miles @ 2021-11-14  2:59 UTC (permalink / raw)
  To: Emacs Help

[-- Attachment #1: Type: text/plain, Size: 949 bytes --]


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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-17 10:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-14  2:59 [Feature request] I suggest delete-frame command can prompt user for confirmation Christopher M. Miles
2021-11-15  1:15 ` Michael Heerdegen
2021-11-15  3:04   ` Michael Heerdegen
2021-11-15  3:39     ` [External] : " Drew Adams
2021-11-15  5:24     ` Lars Ingebrigtsen
2021-11-15 16:00       ` Vote for a Emacs built-in command to undo/restore killed frame Christopher M. Miles
2021-11-15 23:43       ` [Feature request] I suggest delete-frame command can prompt user for confirmation Michael Heerdegen
2021-11-17 10:06         ` Christopher M. Miles
2021-11-15 15:52     ` [SOLVED] " Christopher M. Miles

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).