From f2460c249794138f57aee50337771c80120f541f Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 16 Feb 2014 00:40:37 -0500 Subject: ENH: Add refiling for Bog notes --- bog-todo.org | 3 ++- bog.el | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/bog-todo.org b/bog-todo.org index 475868e..ec72a62 100644 --- a/bog-todo.org +++ b/bog-todo.org @@ -41,7 +41,8 @@ Perhaps use a cache file. This could be used in ** ENH Check for duplicate citekeys headings -** ENH Refiling for just bib notes +** DONE Refiling for just bib notes + CLOSED: [2014-02-16 Sun 00:40] Redefine org refile targets. 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 @@ -411,6 +416,23 @@ The citekey is split by groups in `bog-citekey-format' and joined by (let ((query (bog-citekey-groups-with-delim citekey "+"))) (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 -- cgit v1.2.3