help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

auto encrypt .gpg file


From: armando.fella
Subject: auto encrypt .gpg file
Date: Wed, 5 Jun 2013 10:33:42 -0700 (PDT)

Hi all,

I inserted the following code lines in the init.el to obtain an auto
decryption on editing .gpg files and an auto encrypt at seve/close file time
with emacs-24.2-18.fc18.x86_64 on a fedora 18.

- emacs asks for the passphrase. Afterword reports the following message
after “Package pgg-gpg is obsolete!” 
- I edited the decrypted file in emacs 
- When I save it emacs reports: “Symbol’s value as variable is void:
pgg-text-mode” and forced me to quit without saving the file content

Do you have any hint to solve the problem?

Thanks a lot, Armando

(defvar pgg-gpg-user-id "YOUR-ID-HERE")
(autoload 'pgg-make-temp-file "pgg" "PGG")
(autoload 'pgg-gpg-decrypt-region "pgg-gpg" "PGG GnuPG")
(define-generic-mode 'gpg-file-mode
  (list ?#) 
  nil nil
  '(".gpg\\'" ".gpg-encrypted\\'")
  (list (lambda ()
            (add-hook 'before-save-hook
                      (lambda () 
                        (let ((pgg-output-buffer (current-buffer)))
                          (pgg-gpg-encrypt-region (point-min) (point-max)
                                                  (list pgg-gpg-user-id))))
                      nil t)
            (add-hook 'after-save-hook 
                      (lambda ()
                        (let ((pgg-output-buffer (current-buffer)))
                          (pgg-gpg-decrypt-region (point-min) (point-max)))
                        (set-buffer-modified-p nil)
                        (auto-save-mode nil))
                      nil t)
            (let ((pgg-output-buffer (current-buffer)))
              (pgg-gpg-decrypt-region (point-min) (point-max)))
            (auto-save-mode nil)
            (set-buffer-modified-p nil)))
  "Mode for gpg encrypted files")

source: http://www.emacswiki.org/emacs/AutoEncryption



--
View this message in context: 
http://emacs.1067599.n5.nabble.com/auto-encrypt-gpg-file-tp287896.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]