unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Chris McMahan <cmcmahan+n@one.net>
Subject: Re: How to make a command ask "You *really* want to do this?"
Date: 29 Apr 2003 13:41:29 -0400	[thread overview]
Message-ID: <un0i9b3qu.fsf@one.net> (raw)
In-Reply-To: 87ptn5jjs3.fsf@blarg.net

Here's some code to do just that...

;;;======================================================================
;;; ask if you REALLY want to quit emacs
;;;======================================================================
(defun ask-before-quit ()
  "Ask if the user really wants to quit Emacs."
  (interactive)
  (y-or-n-p "Really quit emacs? "))

(add-hook 'kill-emacs-query-functions 'ask-before-quit)



Eric Hanchrow <offby1@blarg.net> writes:

> >>>>> "David" == David Combs <dkcombs@panix.com> writes:
> 
>     David> Anyway, I do like how C-x n asks if I'm sure that I really
>     David> want to narrow; I'd like to get eg C-x C-c to do the same
>     David> thing (requiring a fully-typed-in "yes", maybe even two of
>     David> them!),
> 
> Simply "disable" the command, like so:
> 
> (put 'save-buffers-kill-emacs 'disabled 
>         "Nobody in their right mind would ever want to kill Emacs.\n")
> 
> -- 
> 
>       |\      _,,,---,,_
> ZZZzz /,`.-'`'    -.  ;-;;,_
>      |,4-  ) )-,_. ,\ (  `'-'
>     '---''(_/--'  `-'\_) fL
>         -- Igor Pechtchanski

-- 
     (.   .)
  =ooO=(_)=Ooo========================
  Chris McMahan | cmcmahan-AT-one.net
  ====================================

  reply	other threads:[~2003-04-29 17:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-29  1:51 How to make a command ask "You *really* want to do this?" David Combs
2003-04-29  2:17 ` Jesper Harder
2003-04-29  8:47 ` Heinz Rommerskirchen
2003-04-30 22:50   ` Stefan Monnier
2003-04-30 23:10     ` Henrik Enberg
2003-04-29 17:27 ` Eric Hanchrow
2003-04-29 17:41   ` Chris McMahan [this message]
2003-05-13  9:56 ` Per Abrahamsen
2003-05-23  6:31   ` David Combs

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=un0i9b3qu.fsf@one.net \
    --to=cmcmahan+n@one.net \
    /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).