From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: how to force auto-save of buffers not visiting files, right now? Date: Sat, 19 Mar 2022 04:47:16 +0100 Message-ID: <87ilsa61tn.fsf@web.de> References: <019b7e509c29caa462ff1c30079ce9bfb8cdc668.camel@adminart.net> <87zglq200a.fsf@web.de> <8fffdb6b532a1fc1805229acfcf9510c3afe18ec.camel@adminart.net> <87wngsmdwp.fsf@web.de> <9f32ac59eb1bc186b015c0b6c5b94822e70d4135.camel@adminart.net> <87y2164u5p.fsf@web.de> <9c3935a33573d50e595f37103434db5e29c21063.camel@adminart.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4805"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:OqQyuOTpYwNKDnGuv+xruUf5Dig= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 19 04:48:04 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nVQ4S-00010G-4y for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Mar 2022 04:48:04 +0100 Original-Received: from localhost ([::1]:54774 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nVQ4Q-0000Lz-Ry for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 18 Mar 2022 23:48:02 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55140) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVQ3r-0000Lr-Vk for help-gnu-emacs@gnu.org; Fri, 18 Mar 2022 23:47:27 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:40282) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nVQ3q-0001Ev-Hi for help-gnu-emacs@gnu.org; Fri, 18 Mar 2022 23:47:27 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1nVQ3o-000093-2R for help-gnu-emacs@gnu.org; Sat, 19 Mar 2022 04:47:24 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=geh-help-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136669 Archived-At: hw writes: > > But why isn't your code located in a buffer visiting a file? > > It is. The output of perltidy replaces it. Ok - but does it have to be auto-save? Why not just use normal backup files? You can explicitly force the creation of backup files. And keep a lot of them around. See (info "(emacs) Backup") and (info "(emacs) Backup Deletion"). You can, for example, have hundred backups of each file you edit - in a folder of your choice so that they don't clobber your working directories. If you are familiar with git, I suggest to have a look at Magit and the wip modes. After some setup, you get a backup for every save - or even two, if the original state of the file was not yet backed up. Due to git's delta compression it doesn't waste much disk space. The interface lets you browse the versions and diff them etc. "helm-backup.el" does something similar. You can use more than one method to gain some protection by redundancy. The git based approaches have one big disadvantage though: deleting old versions is not trivial, you need to mess with git trees (that are not even branches) and manipulate references "by hand". Not cool. I always wanted to implement a similar interface for making backups using "bup" - which would offer efficient compression of subsequent versions without the need of registering (tracking) the files, but didn't start the task yet. With "bup" you can at least store backups in different places, it's somewhat easier to handle. But it also doesn't allow history manipulation in a simple way. And then you can make redundant backups of these backups to disk so that you finally can, without fear, rely on undo :-) In your case, undo should normally work, and it should be the fastest way to get the original contents back. Michael.