emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Enhancement : crypt and org-ctrl-c


From: Richard Riley
Subject: [Orgmode] Enhancement : crypt and org-ctrl-c
Date: Mon, 25 Jan 2010 19:51:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Carsten,

This adds ctrl-c ctrl-c context sensitive processing to pgp blocks
created by org-crypt.

I wasnt entirely sure where to put the regexp func so, since its so
small with the crypt patch, I submit it "neat" rather than as a diff. I
didnt spot another org func which does the same thing. Hopefully not a
duplicate.

regards,

r.

,----
|   ; this small routine is handy for all "context" commands I think.
|   (defun pointInRegExp (startRE endRE)
|     "returns t if the current point is within a block represented by the reg 
exp pairing of startRE and endRE"
|     (interactive)
|     (let ((p (point)))
|       (save-excursion
|         (and (re-search-backward startRE nil t) (re-search-forward endRE nil 
t) (>= (point) p)))));
|   
|   ; inside a pgp block in org? if so then decrypt it.
|   (defun org-ctrl-c-encrypted ()
|     (interactive)
|     (if (pointInRegExp 
|      "^-----BEGIN PGP MESSAGE-----" 
|      "^-----END PGP MESSAGE-----")
|     (org-decrypt-entry) nil))
|   
|   ; add crypt decryption to org-mode context sensitive processing.
|   (add-hook 'org-ctrl-c-ctrl-c-hook 'org-ctl-c-encrypted)
`----

Seems to work fine. Only issue is that after decryption it then things
its on a tag line - not sure if thats to do with where the point
goes after decryption.

-- 
Google Talk : address@hidden  http://www.google.com/talk
ASCII ribbon campaign ( )
 - against HTML email  X
             & vCards / \





reply via email to

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