unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Christopher M. Miles" <numbchild@gmail.com>
To: Emacs Help <help-gnu-emacs@gnu.org>
Subject: [Feature request] I suggest delete-frame command can prompt user for confirmation
Date: Sun, 14 Nov 2021 10:59:50 +0800	[thread overview]
Message-ID: <PAXPR08MB6640511C086629A6DF2D2245A3979@PAXPR08MB6640.eurprd08.prod.outlook.com> (raw)

[-- 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 --]

             reply	other threads:[~2021-11-14  2:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-14  2:59 Christopher M. Miles [this message]
2021-11-15  1:15 ` [Feature request] I suggest delete-frame command can prompt user for confirmation 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PAXPR08MB6640511C086629A6DF2D2245A3979@PAXPR08MB6640.eurprd08.prod.outlook.com \
    --to=numbchild@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).