emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Enhancement : crypt and org-ctrl-c
@ 2010-01-25 18:51 Richard Riley
  0 siblings, 0 replies; only message in thread
From: Richard Riley @ 2010-01-25 18:51 UTC (permalink / raw)
  To: emacs-orgmode


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 : rileyrgdev@googlemail.com  http://www.google.com/talk
ASCII ribbon campaign ( )
 - against HTML email  X
             & vCards / \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-01-25 18:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-25 18:51 Enhancement : crypt and org-ctrl-c Richard Riley

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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