all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "armando.fella" <armando.fella@pi.infn.it>
To: Help-gnu-emacs@gnu.org
Subject: auto encrypt .gpg file
Date: Wed, 5 Jun 2013 10:33:42 -0700 (PDT)	[thread overview]
Message-ID: <1370453622565-287896.post@n5.nabble.com> (raw)

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	other threads:[~2013-06-05 17:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 17:33 armando.fella [this message]
2013-06-06  0:26 ` auto encrypt .gpg file Stefan Monnier
2013-06-07  8:28   ` armando.fella

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1370453622565-287896.post@n5.nabble.com \
    --to=armando.fella@pi.infn.it \
    --cc=Help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.