unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / 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

* Re: auto encrypt .gpg file
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2013-06-06  0:26 UTC (permalink / raw)
  To: help-gnu-emacs

> 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.

Why not just use (auto-encryption-mode 1) ?


        Stefan




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

* Re: auto encrypt .gpg file
  2013-06-06  0:26 ` Stefan Monnier
@ 2013-06-07  8:28   ` armando.fella
  0 siblings, 0 replies; 3+ messages in thread
From: armando.fella @ 2013-06-07  8:28 UTC (permalink / raw)
  To: Help-gnu-emacs

Thanks a lot, it works fine. I notified the source of the wrong code. Cheers, 
Armando



--
View this message in context: http://emacs.1067599.n5.nabble.com/auto-encrypt-gpg-file-tp287896p288063.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

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).