unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* auto-saving files
@ 2010-05-22 11:50 Andrea Crotti
  2010-05-22 12:24 ` David Engster
  2010-05-22 12:25 ` Tassilo Horn
  0 siblings, 2 replies; 6+ messages in thread
From: Andrea Crotti @ 2010-05-22 11:50 UTC (permalink / raw)
  To: help-gnu-emacs


When launching a compilation the function "save-some-buffers" it's
called.
This is nice because sometimes I forget to save before compiling, but
there are some files that you would always love to have automatically
saved.

For example .newrc is managed by news but every time I compile emacs
asks me to save it.
Is there a clean way to solve it?

I've seen auto-save-mode, but how can I make it working forever for some
buffers?
Thanks




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

* Re: auto-saving files
  2010-05-22 11:50 auto-saving files Andrea Crotti
@ 2010-05-22 12:24 ` David Engster
  2010-05-24  8:00   ` Andrea Crotti
  2010-05-22 12:25 ` Tassilo Horn
  1 sibling, 1 reply; 6+ messages in thread
From: David Engster @ 2010-05-22 12:24 UTC (permalink / raw)
  To: help-gnu-emacs

Andrea Crotti writes:
> When launching a compilation the function "save-some-buffers" it's
> called.
> This is nice because sometimes I forget to save before compiling, but
> there are some files that you would always love to have automatically
> saved.
>
> For example .newrc is managed by news but every time I compile emacs
> asks me to save it.
> Is there a clean way to solve it?

I guess you mean the .newsrc-dribble file? I'm using this:

(add-hook 'gnus-started-hook
	  (lambda ()
	    (when (buffer-live-p gnus-dribble-buffer)
	      (with-current-buffer gnus-dribble-buffer
		(setq buffer-save-without-query t)))))

This will get .newsrc-dribble automatically saved by
save-some-buffers. The other newsrc-files are usually not kept open
during a Gnus session.

Regards,
David




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

* Re: auto-saving files
  2010-05-22 11:50 auto-saving files Andrea Crotti
  2010-05-22 12:24 ` David Engster
@ 2010-05-22 12:25 ` Tassilo Horn
  1 sibling, 0 replies; 6+ messages in thread
From: Tassilo Horn @ 2010-05-22 12:25 UTC (permalink / raw)
  To: help-gnu-emacs

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

Hi Andrea,

> I've seen auto-save-mode, but how can I make it working forever for
> some buffers?

If those buffers have some special mode, add it to the mode hook:

   (add-hook 'foo-mode-hook 'auto-save-mode)

If those buffers can only be checked by their name or other properties,
hook into `find-file-hook', check these properties and enable
`auto-save-mode' there.

Bye,
Tassilo




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

* Re: auto-saving files
  2010-05-22 12:24 ` David Engster
@ 2010-05-24  8:00   ` Andrea Crotti
  2010-05-24  8:13     ` Tassilo Horn
  2010-05-24 21:07     ` David Engster
  0 siblings, 2 replies; 6+ messages in thread
From: Andrea Crotti @ 2010-05-24  8:00 UTC (permalink / raw)
  To: help-gnu-emacs

David Engster <deng@randomsample.de> writes:

>
> I guess you mean the .newsrc-dribble file? I'm using this:
>
> (add-hook 'gnus-started-hook
> 	  (lambda ()
> 	    (when (buffer-live-p gnus-dribble-buffer)
> 	      (with-current-buffer gnus-dribble-buffer
> 		(setq buffer-save-without-query t)))))
>
> This will get .newsrc-dribble automatically saved by
> save-some-buffers. The other newsrc-files are usually not kept open
> during a Gnus session.
>

Ok great I think it's more then enough :)
But why by the way gnus must keep a buffer open for it's own job?

I mean I don't need that buffer open, can't it work on the file without
visiting it on a buffer?




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

* Re: auto-saving files
  2010-05-24  8:00   ` Andrea Crotti
@ 2010-05-24  8:13     ` Tassilo Horn
  2010-05-24 21:07     ` David Engster
  1 sibling, 0 replies; 6+ messages in thread
From: Tassilo Horn @ 2010-05-24  8:13 UTC (permalink / raw)
  To: help-gnu-emacs

Andrea Crotti <andrea.crotti.0@gmail.com> writes:

Hi Andrea,

> But why by the way gnus must keep a buffer open for it's own job?
>
> I mean I don't need that buffer open, can't it work on the file
> without visiting it on a buffer?

Not really.  Almost all text modification operations work on buffers,
not files.  There are some exceptions: you can append to a file without
visiting it in a buffer.  But as soon as you have to do something
non-trivial, you will have to visit it in a buffer.

Bye,
Tassilo




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

* Re: auto-saving files
  2010-05-24  8:00   ` Andrea Crotti
  2010-05-24  8:13     ` Tassilo Horn
@ 2010-05-24 21:07     ` David Engster
  1 sibling, 0 replies; 6+ messages in thread
From: David Engster @ 2010-05-24 21:07 UTC (permalink / raw)
  To: Andrea Crotti; +Cc: help-gnu-emacs

Andrea Crotti writes:
> David Engster <deng@randomsample.de> writes:
>
>>
>> I guess you mean the .newsrc-dribble file? I'm using this:
>>
>> (add-hook 'gnus-started-hook
>> 	  (lambda ()
>> 	    (when (buffer-live-p gnus-dribble-buffer)
>> 	      (with-current-buffer gnus-dribble-buffer
>> 		(setq buffer-save-without-query t)))))
>>
>> This will get .newsrc-dribble automatically saved by
>> save-some-buffers. The other newsrc-files are usually not kept open
>> during a Gnus session.
>>
>
> Ok great I think it's more then enough :)
> But why by the way gnus must keep a buffer open for it's own job?

The dribble file is used to reconstruct Gnus' state in case Emacs/Gnus
crashes or quits in an unclean way. For this to work the dribble file
must be kept open so that it gets auto-saved.

You can set gnus-use-dribble-file to 'nil', but then you will lose your
current state in case of a crash, so I'd rather not do that.

-David



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

end of thread, other threads:[~2010-05-24 21:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-22 11:50 auto-saving files Andrea Crotti
2010-05-22 12:24 ` David Engster
2010-05-24  8:00   ` Andrea Crotti
2010-05-24  8:13     ` Tassilo Horn
2010-05-24 21:07     ` David Engster
2010-05-22 12:25 ` Tassilo Horn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).