* new file mode: automatic gpg encryption
@ 2007-09-19 1:50 Mark A. Hershberger
2007-09-19 1:56 ` Leo
2007-09-19 2:35 ` Stefan Monnier
0 siblings, 2 replies; 5+ messages in thread
From: Mark A. Hershberger @ 2007-09-19 1:50 UTC (permalink / raw)
To: emacs-devel
On emacswiki.org, I found a snippet of code that uses mailcrypt to
automatically encrypt and decrypt a file with the .gpg extension.
I rewrote this to use the functions bundled with emacs and think it
would be a useful addition to emacs.
It looks like I could just add this to generic-x.el. Is there anything
else I should do?
Mark.
--
http://hexmode.com/
GPG Fingerprint: 7E15 362D A32C DFAB E4D2 B37A 735E F10A 2DFC BFF5
The most beautiful experience we can have is the mysterious.
-- Albert Einstein, The World As I See it
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: new file mode: automatic gpg encryption
2007-09-19 1:50 new file mode: automatic gpg encryption Mark A. Hershberger
@ 2007-09-19 1:56 ` Leo
2007-09-19 2:35 ` Stefan Monnier
1 sibling, 0 replies; 5+ messages in thread
From: Leo @ 2007-09-19 1:56 UTC (permalink / raw)
To: emacs-devel
On 2007-09-19 02:50 +0100, Mark A. Hershberger wrote:
> I rewrote this to use the functions bundled with emacs and think it
> would be a useful addition to emacs.
>
> It looks like I could just add this to generic-x.el. Is there anything
> else I should do?
EasyPG does many things and it seems it is soon to be part of Emacs.
--
.: Leo :. [ sdl.web AT gmail.com ] .: [ GPG Key: 9283AA3F ] :.
I use GNU Emacs <=
http://www.gnu.org/software/emacs/ <=
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: new file mode: automatic gpg encryption
2007-09-19 1:50 new file mode: automatic gpg encryption Mark A. Hershberger
2007-09-19 1:56 ` Leo
@ 2007-09-19 2:35 ` Stefan Monnier
2007-09-19 8:36 ` Leo
2007-09-19 15:39 ` Mark A. Hershberger
1 sibling, 2 replies; 5+ messages in thread
From: Stefan Monnier @ 2007-09-19 2:35 UTC (permalink / raw)
To: Mark A. Hershberger; +Cc: emacs-devel
> On emacswiki.org, I found a snippet of code that uses mailcrypt to
> automatically encrypt and decrypt a file with the .gpg extension.
> I rewrote this to use the functions bundled with emacs and think it
> would be a useful addition to emacs.
> It looks like I could just add this to generic-x.el. Is there anything
> else I should do?
How 'bout posting a patch here?
I think it'd be a valuable functionality, but details matter.
I don't care much about upon which package it builds, tho: if the design is
right, then it can later on be changed to use EasyPG, or whatever else we
feel like using.
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: new file mode: automatic gpg encryption
2007-09-19 2:35 ` Stefan Monnier
@ 2007-09-19 8:36 ` Leo
2007-09-19 15:39 ` Mark A. Hershberger
1 sibling, 0 replies; 5+ messages in thread
From: Leo @ 2007-09-19 8:36 UTC (permalink / raw)
To: emacs-devel
On 2007-09-19 03:35 +0100, Stefan Monnier wrote:
> I don't care much about upon which package it builds, tho: if the design is
> right, then it can later on be changed to use EasyPG, or whatever else we
> feel like using.
EasyPG does this already.
--
.: Leo :. [ sdl.web AT gmail.com ] .: [ GPG Key: 9283AA3F ] :.
I use GNU Emacs <=
http://www.gnu.org/software/emacs/ <=
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: new file mode: automatic gpg encryption
2007-09-19 2:35 ` Stefan Monnier
2007-09-19 8:36 ` Leo
@ 2007-09-19 15:39 ` Mark A. Hershberger
1 sibling, 0 replies; 5+ messages in thread
From: Mark A. Hershberger @ 2007-09-19 15:39 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> On emacswiki.org, I found a snippet of code that uses mailcrypt to
>> automatically encrypt and decrypt a file with the .gpg extension.
>
>> I rewrote this to use the functions bundled with emacs and think it
>> would be a useful addition to emacs.
> How 'bout posting a patch here?
I'm pretty sure the design is wrong. That is, you can see the buffer
fill with encrypted text for just a bit (when the before-save-hook is
run) and then return to its previous state (when after-save-hook is
run).
Since this is the first time I've worked with a mode like this at all, I
can modify it as needed.
After looking at "(elisp) Saving Buffers", I suspect that the proper
place for this is the write-file-functions hook (which
allout-write-file-hook-handler uses to encrypt specific regions of
text).
Also, I've used pgg-gpg-* functions when I should probably use pgg-*
functions.
In any case, here is the code snippet I'm using.
(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")
--
http://hexmode.com/
GPG Fingerprint: 7E15 362D A32C DFAB E4D2 B37A 735E F10A 2DFC BFF5
The most beautiful experience we can have is the mysterious.
-- Albert Einstein, The World As I See it
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-09-19 15:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-19 1:50 new file mode: automatic gpg encryption Mark A. Hershberger
2007-09-19 1:56 ` Leo
2007-09-19 2:35 ` Stefan Monnier
2007-09-19 8:36 ` Leo
2007-09-19 15:39 ` Mark A. Hershberger
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.