diff options
author | Carsten Dominik <carsten.dominik@gmail.com> | 2010-03-21 08:16:08 +0100 |
---|---|---|
committer | Carsten Dominik <carsten.dominik@gmail.com> | 2010-03-21 08:16:08 +0100 |
commit | 7ef096f3974952bb956e80351323f4790935ba03 (patch) | |
tree | 530e989139563544b64ab445aed0af867730e29b | |
parent | a36b60a6e8d326d71be6b8995463e90bc7c0e2aa (diff) | |
download | org-mode-7ef096f3974952bb956e80351323f4790935ba03.tar.gz |
Make `org-reveal' also decrypt encrypted entries
Thanks to Richard Riley for triggering this change.
-rwxr-xr-x | lisp/ChangeLog | 8 | ||||
-rw-r--r-- | lisp/org-crypt.el | 5 | ||||
-rw-r--r-- | lisp/org.el | 15 |
3 files changed, 28 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b2d4c33..b7ee647 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,9 +1,17 @@ 2010-03-21 Carsten Dominik <carsten.dominik@gmail.com> + * org-crypt.el (org-reveal-start-hook): Add a decryption function + to this hook. + (org-decrypt-entries, org-encrypt-entries, org-decrypt-entry): Add + docstrings. + * org.el (org-point-at-end-of-empty-headline) (org-level-increment, org-get-previous-line-level): New function. (org-cycle-level): Rewritten to be independent of when this function is called. + (org-in-regexps-block-p): New function. + (org-reveal-start-hook): New hook. + (org-reveal): Run new hook. 2010-03-19 Carsten Dominik <carsten.dominik@gmail.com> diff --git a/lisp/org-crypt.el b/lisp/org-crypt.el index 7ed650c..8f632f8 100644 --- a/lisp/org-crypt.el +++ b/lisp/org-crypt.el @@ -129,6 +129,7 @@ heading. This can also be overridden in the CRYPTKEY property." nil)))) (defun org-decrypt-entry () + "Decrypt the content of the current headline." (interactive) (require 'epg) (save-excursion @@ -152,12 +153,14 @@ heading. This can also be overridden in the CRYPTKEY property." nil)))) (defun org-encrypt-entries () + "Encrypt all top-level entries in the current buffer." (interactive) (org-scan-tags 'org-encrypt-entry (cdr (org-make-tags-matcher org-crypt-tag-matcher)))) (defun org-decrypt-entries () + "Decrypt all entries in the current buffer." (interactive) (org-scan-tags 'org-decrypt-entry @@ -169,6 +172,8 @@ file is saved to disk." (add-hook 'org-mode-hook (lambda () (add-hook 'before-save-hook 'org-encrypt-entries nil t)))) + +(add-hook 'org-reveal-start-hook 'org-decrypt-entry) (provide 'org-crypt) diff --git a/lisp/org.el b/lisp/org.el index 6dd1c80..c6c17e7 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11282,6 +11282,9 @@ How much context is shown depends upon the variables (org-flag-heading nil) (when siblings-p (org-show-siblings)))))))) +(defvar org-reveal-start-hook nil + "Hook run before revealing a location.") + (defun org-reveal (&optional siblings) "Show current entry, hierarchy above it, and the following headline. This can be used to show a consistent set of context around locations @@ -11294,6 +11297,7 @@ look like when opened with hierarchical calls to `org-cycle'. With double optional argument `C-u C-u', go to the parent and show the entire tree." (interactive "P") + (run-hooks 'org-reveal-start-hook) (let ((org-show-hierarchy-above t) (org-show-following-heading t) (org-show-siblings (if siblings t org-show-siblings))) @@ -17078,6 +17082,17 @@ really on, so that the block visually is on the match." (throw 'exit t))) nil)))) +(defun org-in-regexps-block-p (start-re end-re) + "Returns t if the current point is between matches of START-RE and END-RE. +This will also return to if point is on one of the two matches." + (interactive) + (let ((p (point))) + (save-excursion + (and (or (org-at-regexp-p start-re) + (re-search-backward start-re nil t)) + (re-search-forward end-re nil t) + (>= (point) p))))) + (defun org-occur-in-agenda-files (regexp &optional nlines) "Call `multi-occur' with buffers for all agenda files." (interactive "sOrg-files matching: \np") |