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

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

erase current file from disk


From: Emanuel Berg
Subject: erase current file from disk
Date: Thu, 02 Jun 2016 15:21:20 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Let's see if I can reach gmane.emacs.help (or
actually the mailing list) by way of
nntp.aioe.org...

Here is something I have thought about doing, and
now I've done it:

    (defun delete-current-file ()
      (interactive)
      (let*((file   (buffer-file-name))
            (prompt (format "delete %s on disk? " file)) )
        (when (yes-or-no-p prompt)
          (kill-buffer)
          (delete-file file) )))
    (defalias 'delete-this-file 'delete-current-file)

Useful for example when you open a file - Emacs says
it "has auto save data; consider M-x
recover-this-file", you get the file up and see it
isn't anything to loose, you fire off the defun and
all that gone.

-- 
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
                   - so far: 30 Blogomatic articles -                   


reply via email to

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