all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* auto encrypt .gpg file
@ 2013-06-05 17:33 armando.fella
  2013-06-06  0:26 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: armando.fella @ 2013-06-05 17:33 UTC (permalink / raw)
  To: Help-gnu-emacs

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.



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

end of thread, other threads:[~2013-06-07  8:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-05 17:33 auto encrypt .gpg file armando.fella
2013-06-06  0:26 ` Stefan Monnier
2013-06-07  8:28   ` armando.fella

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.