all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Reliable indication that auto-saving should not be done
@ 2007-03-30  0:10 Denis Bueno
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Bueno @ 2007-03-30  0:10 UTC (permalink / raw)
  To: help-gnu-emacs

All-

I wrote a pretty simple function that saves the current buffer to a
file in a local darcs repo and records its changes. I wanted versioned
records of changes I make to the files I edit.

I install that function in `auto-save-hook'. However, in some buffers
auto-saving is off (for security reasons) but my hook still gets run.
My questions are, first of all, should the auto-save hook be run when
auto-saving is off? Secondly, if so, what is a reliable indication
that auto-save is on (or off)?

(In particular when I open encrypted files using crypt++.el, it sends
a message to the minibuffer, saying "Auto save off (in this buffer)"
and my hook is run just the same.)

Thanks in advance.

-Denis

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

* Re: Reliable indication that auto-saving should not be done
       [not found] <mailman.1599.1175213615.7795.help-gnu-emacs@gnu.org>
@ 2007-03-30 11:13 ` Johan Bockgård
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Bockgård @ 2007-03-30 11:13 UTC (permalink / raw)
  To: help-gnu-emacs

"Denis Bueno" <dbueno@gmail.com> writes:

> I install that function in `auto-save-hook'. However, in some buffers
> auto-saving is off (for security reasons) but my hook still gets run.
> My questions are, first of all, should the auto-save hook be run when
> auto-saving is off?

The auto-saving mechanism is global. Periodically Emacs runs the
function `do-auto-save' ("Auto-save all buffers that need it"). This
runs `auto-save-hook' once before saving the buffers.

> Secondly, if so, what is a reliable indication that auto-save is on
> (or off)?

    Variable: buffer-auto-save-file-name
     This buffer-local variable is the name of the file used for
     auto-saving the current buffer. It is `nil' if the buffer should
     not be auto-saved.

-- 
Johan Bockgård

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

end of thread, other threads:[~2007-03-30 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-30  0:10 Reliable indication that auto-saving should not be done Denis Bueno
     [not found] <mailman.1599.1175213615.7795.help-gnu-emacs@gnu.org>
2007-03-30 11:13 ` Johan Bockgård

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.