Function: org-crypt-check-auto-save

org-crypt-check-auto-save is a byte-compiled function defined in org-crypt.el.gz.

Signature

(org-crypt-check-auto-save)

Documentation

Check whether auto-save-mode is enabled for the current buffer.

auto-save-mode may cause leakage when decrypting entries, so check whether it's enabled, and decide what to do about it.

See org-crypt-disable-auto-save.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-crypt.el.gz
(defun org-crypt-check-auto-save ()
  "Check whether auto-save-mode is enabled for the current buffer.

`auto-save-mode' may cause leakage when decrypting entries, so
check whether it's enabled, and decide what to do about it.

See `org-crypt-disable-auto-save'."
  (when buffer-auto-save-file-name
    (cond
     ((or
       (eq org-crypt-disable-auto-save t)
       (and
	(eq org-crypt-disable-auto-save 'ask)
	(y-or-n-p "org-decrypt: auto-save-mode may cause leakage.  Disable it for current buffer? ")))
      (message "org-decrypt: Disabling auto-save-mode for %s"
               (or (buffer-file-name) (current-buffer)))
      ;; The argument to auto-save-mode has to be "-1", since
      ;; giving a "nil" argument toggles instead of disabling.
      (auto-save-mode -1))
     ((eq org-crypt-disable-auto-save nil)
      (message "org-decrypt: Decrypting entry with auto-save-mode enabled.  This may cause leakage."))
     ((eq org-crypt-disable-auto-save 'encrypt)
      (message "org-decrypt: Enabling re-encryption on auto-save.")
      (add-hook 'auto-save-hook
		(lambda ()
		  (message "org-crypt: Re-encrypting all decrypted entries due to auto-save.")
		  (org-encrypt-entries))
		nil t))
     (t nil))))