summaryrefslogtreecommitdiff
path: root/bog.el
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2014-02-16 00:40:37 -0500
committerKyle Meyer <kyle@kyleam.com>2014-02-16 00:41:57 -0500
commitf2460c249794138f57aee50337771c80120f541f (patch)
tree2c6e4889c920607c25f12bec112f35c5351816b8 /bog.el
parent92c4b934a115aa80fdc584feac45b2c6410d0e82 (diff)
downloadbog-f2460c249794138f57aee50337771c80120f541f.tar.gz
ENH: Add refiling for Bog notes
Diffstat (limited to 'bog.el')
-rw-r--r--bog.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/bog.el b/bog.el
index 40235a0..dc8dbc6 100644
--- a/bog.el
+++ b/bog.el
@@ -151,6 +151,11 @@ It should contain the placeholder \"%s\" for the query."
:group 'bog
:type 'string)
+(defcustom bog-refile-maxlevel 1
+ "Consider up to this level when refiling with `bog-refile'."
+ :group 'bog
+ :type 'integer)
+
;;; General utilities
@@ -412,6 +417,23 @@ The citekey is split by groups in `bog-citekey-format' and joined by
(format bog-web-search-url query)))
+;;; Refiling
+
+(defun bog-refile ()
+ "Refile heading with note files.
+All headings Org files in `bog-notes-directory' at or above level
+`bog-refile-maxlevel' are considered."
+ (interactive)
+ (let ((org-refile-targets `((,(bog-notes-files)
+ :maxlevel . ,bog-refile-maxlevel))))
+ (org-refile)))
+
+(defun bog-notes-files ()
+ (file-expand-wildcards
+ (concat (file-name-as-directory bog-notes-directory)
+ "*.org")))
+
+
;;; Font-lock
(defface bog-citekey-face