diff options
author | Kyle Meyer <kyle@kyleam.com> | 2014-12-11 00:19:01 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2014-12-11 00:19:01 -0500 |
commit | 7688cb0c61a757baab5fe830ed12520cb54756ae (patch) | |
tree | 9110bc35caf13e0ae6fab0d9b7b7fa6ca27bba0e /bog.el | |
parent | ebef5b183c959c2e228ca4c7f8107bec517d2582 (diff) | |
download | bog-7688cb0c61a757baab5fe830ed12520cb54756ae.tar.gz |
Add commands bog-{next,previous}-non-heading-citekey
Diffstat (limited to 'bog.el')
-rw-r--r-- | bog.el | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -820,6 +820,36 @@ be opened if locating a citekey from context fails." (org-open-at-point))) (message "Heading for %s not found in notes" citekey)))) +(defun bog-next-non-heading-citekey (&optional arg) + "Move foward to next non-heading citekey. +With argument ARG, do it ARG times." + (interactive "p") + (or arg (setq arg 1)) + (if (< arg 0) + (bog-previous-non-heading-citekey (- arg)) + (bog--with-citekey-syntax + (skip-syntax-forward "w") + (let (case-fold-search) + (while (and (> arg 0) + (re-search-forward bog-citekey-format nil t)) + (unless (org-at-heading-p) + (setq arg (1- arg)))))) + (org-show-context))) + +(defun bog-previous-non-heading-citekey (&optional arg) + "Move backward to previous non-heading citekey. +With argument ARG, do it ARG times." + (interactive "p") + (or arg (setq arg 1)) + (bog--with-citekey-syntax + (let (case-fold-search) + (while (and (> arg 0) + (re-search-backward bog-citekey-format nil t)) + (unless (org-at-heading-p) + (setq arg (1- arg))))) + (skip-syntax-backward "w")) + (org-show-context)) + ;;; Font-lock @@ -919,6 +949,8 @@ chosen." (define-key prefix-map "H" 'bog-goto-citekey-heading-in-notes) (define-key prefix-map "i" 'bog-citekey-tree-to-indirect-buffer) (define-key prefix-map "l" 'bog-open-first-citekey-link) + (define-key prefix-map "n" 'bog-next-non-heading-citekey) + (define-key prefix-map "p" 'bog-previous-non-heading-citekey) (define-key prefix-map "r" 'bog-rename-staged-file-to-citekey) (define-key prefix-map "s" 'bog-search-notes) (define-key prefix-map "w" 'bog-refile) |