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

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

Re: How to make a command ask "You *really* want to do this?"


From: Chris McMahan
Subject: Re: How to make a command ask "You *really* want to do this?"
Date: 29 Apr 2003 13:41:29 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

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 via email to

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