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

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

Re: how to force auto-save of buffers not visiting files, right now?


From: Michael Heerdegen
Subject: Re: how to force auto-save of buffers not visiting files, right now?
Date: Sun, 20 Mar 2022 01:21:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

hw <hw@adminart.net> writes:

> For example, I may edit a file '/usr/local/bin/example.pl' which is
> owned by foo:foo because I made that so.  The directory
> '/usr/local/bin/' is owned by root.  How do you expect emacs to create
> a backup file there?  For remote files, I have set
> tramp-auto-save-directory to a local directory, and I'm missing an
> equivalent option for local files.

I'm was talking about backup files, not about auto save.  You can
control where these are saved.

> Who can remember things like ‘C-u C-u C-u C-x C-s’ just to save a
> file?

If you want to use that stuff automatically, you can do it otherwise,
you already wrote some Elisp code.  It's surely not my advice to always
save using that keystroke.

> How do you make sure that all obsolete backup files are being deleted
> without configuring about 20 instances of emacs on different machines
> for different users?

You could, for example, use directory local variables and configure
things so that all backups are located at one centralized place.

> Right, I wouldn't want to have obsolete copies cluttering the repos
> for every time I press C-x C-s or C-x s.  I rather commit only the
> version that is working after it was modified, not countless
> intermediate versions.

With Magit or helm-browse, these saves would not be commits or parts of
named branches.  They would live under a configurable separate namespace
in e.g. ".git/refs/wip/".

> Ok so I run perltidy to replace the contents of the buffer visiting
> the program I'm working on, save the buffer so I can run the program
> and the power goes out, the computer freezes, emacs crashes or
> something else goes wrong and it turns out that perltidy messed up my
> program.
>
> How do I undo the changes then?  Undo only works when nothing goes
> wrong.

My advice was to use undo when nothing went wrong, and your backup
concept when something went wrong.  Sorry if I wasn't clear enough in
that regard.

What kind of solution d you want to have?  I find some of your answers
contradicting, e.g. you say you don't want lots of backups because you
don't want to delete them manually.  But automatic deletion is also not
good because, what if the relevant backup was among the deleted files.
You do not want to loose anything but OTOH do not want to clobber your
repository, etc.

How could a solution you _do_ like look like?

Michael.




reply via email to

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