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

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

Re: Inserting date, Disabling the Yes/No question


From: Oliver Scholz
Subject: Re: Inserting date, Disabling the Yes/No question
Date: Tue, 10 Sep 2002 15:14:43 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu)

Jesse Mathias Marder <address@hidden> writes:

> Hello,
>
> Is there a built in function or a package to gnu emacs 21.2 that
> inserts the current date in the document, undepedent of the current
> major mode?

Yes. There is time-stamp.el, which ships with Emacs 21

,----
| Commentary:
| A template in a file can be updated with a new time stamp when
| you save the file.  For example:
|     static char *ts = "sdmain.c Time-stamp: <1996-08-13 10:20:51 gildea>";
| See the top of `time-stamp.el' for another example.
| 
| To use time-stamping, add this line to your .emacs file:
|     (add-hook 'write-file-hooks 'time-stamp)
| Now any time-stamp templates in your files will be updated automatically.
| 
| See the documentation for the functions `time-stamp'
| and `time-stamp-toggle-active' for details.
`----


> And besides that, I'd like to disable the yes/no question when killing
> a modified buffer,m or at least chatnge t it no y/n. How can I do
> this?
[...]

Thomas Burdick once posted a nice macro to change `yes-or-no-p' to
`y-or-n-p' function-wise:

(require 'cl)

(defmacro make-shorter-response (&rest names)
  `(progn
     ,@(mapcar (lambda (name)
                 `(defadvice ,name (around shorter-response)
                    (flet ((yes-or-no-p (prompt) (y-or-n-p prompt)))
                      ad-do-it)))
               names)
     ,@(mapcar (lambda (name) `(ad-activate (quote ,name)))
               names)))


Then you can simply do:

(make-shorter-response kill-buffer)

    -- Oliver

-- 
24 Fructidor an 210 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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