all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* auto-save directory?
@ 2022-03-19  4:06 hw
  2022-03-19  5:30 ` Jean Louis
  2022-03-19  6:10 ` tomas
  0 siblings, 2 replies; 4+ messages in thread
From: hw @ 2022-03-19  4:06 UTC (permalink / raw)
  To: Help GNU Emacs


Hi,

I'm wondering if there is a way to have emacs put all auto-save files
into a configurable directory.  We can set `tramp-auto-save-directory`,
but there doesn't seem an equivalent option for files that are not
remote.  I couldn't find one in either the documentation, nor the source.

I'd find it nicer to have all auto-save files in one place instead of
all over the place.  Is there such an option, and if there isn't, would
that be worth making a feature request?




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: auto-save directory?
  2022-03-19  4:06 auto-save directory? hw
@ 2022-03-19  5:30 ` Jean Louis
  2022-03-20  9:27   ` hw
  2022-03-19  6:10 ` tomas
  1 sibling, 1 reply; 4+ messages in thread
From: Jean Louis @ 2022-03-19  5:30 UTC (permalink / raw)
  To: hw; +Cc: Help GNU Emacs

* hw <hw@adminart.net> [2022-03-19 07:07]:
> 
> Hi,
> 
> I'm wondering if there is a way to have emacs put all auto-save files
> into a configurable directory.  We can set `tramp-auto-save-directory`,
> but there doesn't seem an equivalent option for files that are not
> remote.  I couldn't find one in either the documentation, nor the source.
> 
> I'd find it nicer to have all auto-save files in one place instead of
> all over the place.  Is there such an option, and if there isn't, would
> that be worth making a feature request?
> ‘auto-save-file-name-transforms’
> 

Evaluate this below to get into Info file:

(info "(emacs) Auto Save Files")

   The variable ‘auto-save-file-name-transforms’ allows a degree of
control over the auto-save file name.  It lets you specify a series of
regular expressions and replacements to transform the auto save file
name.  The default value puts the auto-save files for remote files
(*note Remote Files::) into the temporary file directory on the local
machine.

On my side the variable ‘auto-save-file-name-transforms’ looks as
this:

[INS] [DEL] List:
            Regexp: \`/[^/]*:\([^/]*/\)*\([^/]*\)\'
            Replacement: /home/data1/protected/tmp/\2
            Uniquify: [Toggle]  on (non-nil)


or as this:

auto-save-file-name-transforms ⇒ (("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" "/home/data1/protected/tmp/\\2" t))



-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: auto-save directory?
  2022-03-19  4:06 auto-save directory? hw
  2022-03-19  5:30 ` Jean Louis
@ 2022-03-19  6:10 ` tomas
  1 sibling, 0 replies; 4+ messages in thread
From: tomas @ 2022-03-19  6:10 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 936 bytes --]

On Sat, Mar 19, 2022 at 05:06:55AM +0100, hw wrote:
> 
> Hi,
> 
> I'm wondering if there is a way to have emacs put all auto-save files
> into a configurable directory.  We can set `tramp-auto-save-directory`,
> but there doesn't seem an equivalent option for files that are not
> remote.  I couldn't find one in either the documentation, nor the source.
> 
> I'd find it nicer to have all auto-save files in one place instead of
> all over the place.  Is there such an option, and if there isn't, would
> that be worth making a feature request?

You can modify the variable `auto-save-file-name-transforms' to replace
the leading part of the path to a value which suits you. Besides, you
might want to do something about the further slashes.

By default, Emacs comes with one transform defined for remote files
(whose auto-saved twins end up locally). Perhaps you can reuse this,
if it suits you.

Cheers
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: auto-save directory?
  2022-03-19  5:30 ` Jean Louis
@ 2022-03-20  9:27   ` hw
  0 siblings, 0 replies; 4+ messages in thread
From: hw @ 2022-03-20  9:27 UTC (permalink / raw)
  To: help-gnu-emacs

On Sat, 2022-03-19 at 08:30 +0300, Jean Louis wrote:
> * hw <hw@adminart.net> [2022-03-19 07:07]:
> > 
> > Hi,
> > 
> > I'm wondering if there is a way to have emacs put all auto-save files
> > into a configurable directory.  We can set `tramp-auto-save-directory`,
> > but there doesn't seem an equivalent option for files that are not
> > remote.  I couldn't find one in either the documentation, nor the source.
> > 
> > I'd find it nicer to have all auto-save files in one place instead of
> > all over the place.  Is there such an option, and if there isn't, would
> > that be worth making a feature request?
> > ‘auto-save-file-name-transforms’
> > 
> 
> Evaluate this below to get into Info file:
> 
> (info "(emacs) Auto Save Files")
> 
>    The variable ‘auto-save-file-name-transforms’ allows a degree of
> control over the auto-save file name.  It lets you specify a series of
> regular expressions and replacements to transform the auto save file
> name.  The default value puts the auto-save files for remote files
> (*note Remote Files::) into the temporary file directory on the local
> machine.
> 
> On my side the variable ‘auto-save-file-name-transforms’ looks as
> this:
> 
> [INS] [DEL] List:
>             Regexp: \`/[^/]*:\([^/]*/\)*\([^/]*\)\'
>             Replacement: /home/data1/protected/tmp/\2
>             Uniquify: [Toggle]  on (non-nil)
> 
> 
> or as this:
> 
> auto-save-file-name-transforms ⇒ (("\\`/[^/]*:\\([^/]*/\\)*\\([^/]*\\)\\'" "/home/data1/protected/tmp/\\2" t))

Thanks!

When I let emacs evaluate above expression, it takes me to the info
node '18.6.1 Auto-Save Files' and doesn't tell me what might be
replaced by what.

Now the problem is that the regexp is kinda impossible to read and to
reasonably alter ...  It seems to match only file specifications
containing a colon and maybe other characters I would never
intentionally put into file names ...

Is there a stable database library like perls DBI for emacs, or can I
directly integrate perl into emacs?  If I save all auto-save files in
the same place, all information where they were originally edited gets
lost.  It might be nice if I could store some meta-information along
with the file in a database.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-20  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-19  4:06 auto-save directory? hw
2022-03-19  5:30 ` Jean Louis
2022-03-20  9:27   ` hw
2022-03-19  6:10 ` tomas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.