summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2016-10-24 21:23:07 -0400
committerKyle Meyer <kyle@kyleam.com>2016-10-24 21:28:42 -0400
commita6b566a4eca0dcc89a7d2af42e057b4e2561189d (patch)
treeaff82f1be9951f98f71501300391c21084ddb3c2
parentfc71c376546ed01060200de91d007f2a179bc601 (diff)
downloadbog-a6b566a4eca0dcc89a7d2af42e057b4e2561189d.tar.gz
Add bog-clean-bib-hook
-rw-r--r--NEWS3
-rw-r--r--bog.el10
2 files changed, 12 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 544b932..4ef2784 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ Bog NEWS -- history of user-visible changes -*- mode: org; -*-
make it easier to use Bog commands on citekeys that use Pandoc's
@citekey format.
+- New hook ~bog-clean-bib-hook~ is run for each file processed with
+ ~bog-clean-and-rename-staged-bibs~.
+
** Other changes
- The default value for ~bog-file-secondary-name~ has been changed
diff --git a/bog.el b/bog.el
index 4c5ae25..dd90bbc 100644
--- a/bog.el
+++ b/bog.el
@@ -272,6 +272,13 @@ Like `org-mode-syntax-table', but hyphens and underscores are
treated as word characters. '@' will be considered a word
character if `bog-citekey-format-allow-at' is non-nil.")
+(defcustom bog-clean-bib-hook nil
+ "Hook run during `bog-clean-and-rename-staged-bibs' call.
+After each bib file is processed, functions in this hook will be
+called in a buffer visiting the bib file."
+ :package-version '(bog . "1.3.0")
+ :type 'hook)
+
;;; Citekey methods
@@ -870,7 +877,8 @@ one entry per BibTeX file."
(let ((dir (file-name-directory bib-file)))
(unless (file-exists-p dir)
(make-directory dir)))
- (write-file bib-file))
+ (write-file bib-file)
+ (run-hooks 'bog-clean-bib-hook))
;; If a buffer was visiting the original bib file, point it to the
;; new file.
(let ((file-buf (find-buffer-visiting file)))