Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option for supporting the interleave package #67

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ The second argument of ~helm-add-action-to-source~ is the function that executes

The function ~helm-add-action-to-source~ can also be used to add new actions to helm-bibtex.

** [[https://github.com/rudolfochrist/interleave][Interleave]] support
Setting the variable ~helm-bibtex-interleave-support~ to ~t~ will automatically
insert the

#+BEGIN_SRC org
#+INTERLEAVE_PDF:
#+END_SRC

header into empty notes files.

* Usage

** Searching publications
Expand Down
9 changes: 8 additions & 1 deletion helm-bibtex.el
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ used.")
"The a list of candidates obtained when the configured
bibliography files were last parsed.")

(defvar helm-bibtex-interleave-support nil
"If set to t then the interleave package is supported for note
taking by automatically inserting the #+INTERLEAVE_PDF header
in org mode notes.")


(defun helm-bibtex-init ()
"Checks that the files and directories specified by the user
Expand Down Expand Up @@ -697,7 +702,9 @@ defined. Surrounding curly braces are stripped."
(defun helm-bibtex-edit-notes (key)
"Open the notes associated with the entry using `find-file'."
(let ((path (f-join helm-bibtex-notes-path (s-concat key helm-bibtex-notes-extension))))
(find-file path)))
(find-file path)
(unless (or (file-exists-p path) (eq helm-bibtex-interleave-support nil))
(insert (concat "#+INTERLEAVE_PDF: " (f-join helm-bibtex-library-path (s-concat key ".pdf")))))))

(defun helm-bibtex-buffer-visiting (file)
(or (get-file-buffer file)
Expand Down