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

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

Re: emacs should warn before editing a backup~ file~


From: Roland Winkler
Subject: Re: emacs should warn before editing a backup~ file~
Date: 29 Jan 2001 11:43:12 +0100

jidanni@kimo.FiXcomTHiS.tw (Dan Jacobson) writes:

> "Why didn't my changes take effect?  Spoiled the presentation,
> and the boss wasn't amused" I said to myself wistfully.
> No wonder, emacs has let me go ahead and edit a backup file without
> warning.  No wonder I now have a "~~" file:
> Directory /etc/importaint/
> config.fetching   config.fetching~  config.fetching~~
> I must have mistyped it in, or mis-selected it in dired.  I didn't see
> the tiny tilde and thought I was editing config.fetching.  Emacs ought
> to have a variable, on by default, to warn upon find-file [not
> read-only] of various backup files...

I have the following piece of code in my .emacs and I agree with Dan
Jacobson that something like this should be made the default.

Roland


(defun toggle-read-only-backup ()
  "Make backup files read-only."
  (if (string-match "~$" buffer-file-name)
      (toggle-read-only 1)))
(add-hook 'find-file-hooks 'toggle-read-only-backup)



reply via email to

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