Skip to content

Commit

Permalink
default note fn to default-org
Browse files Browse the repository at this point in the history
  • Loading branch information
bdarcus committed Sep 7, 2021
1 parent df5f0f6 commit 2bd5965
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
8 changes: 4 additions & 4 deletions bibtex-actions-file.el
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
:type '(boolean))

(defcustom bibtex-actions-file-open-note-function
'bibtex-actions-file-open-notes-default
'bibtex-actions-file-open-notes-default-org
"Function to open and existing or create a new note.
If you use 'org-roam' and 'org-roam-bibtex', for example, you can
Expand Down Expand Up @@ -158,7 +158,7 @@ use 'orb-edit-note' for this value."
nil 0 nil
file)))

(defun bibtex-actions-file-open-notes-default (key)
(defun bibtex-actions-file-open-notes-default-org (key)
"Open a note file from KEY."
(if-let* ((file
(caar (bibtex-actions-file--files-to-open-or-create
Expand All @@ -168,12 +168,12 @@ use 'orb-edit-note' for this value."
(funcall bibtex-actions-file-open-function file)
(let* ((uuid (org-id-new))
(entry (bibtex-actions-get-entry key))
(note-title
(note-meta
(bibtex-actions--format-entry-no-widths
entry
(bibtex-actions-get-template 'note)))
(content
(concat ":PROPERTIES:\n:ID: " uuid "\n:END:\n" note-title "\n")))
(concat ":PROPERTIES:\n:ID: " uuid "\n:END:\n" note-meta "\n")))
(funcall bibtex-actions-file-open-function file)
(insert content))))

Expand Down
19 changes: 8 additions & 11 deletions bibtex-actions.el
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,10 @@ has not yet been created")

(defun bibtex-actions-get-entry (key)
"Return the cached entry for KEY."
(if (and (eq 'uninitialized bibtex-actions--candidates-cache)
(eq 'uninitialized bibtex-actions--local-candidates-cache))
(message "Something is wrong; your library is not initialized.")
(cddr (seq-find
(lambda (entry)
(string-equal key (cadr entry)))
(bibtex-actions--get-candidates)))))
(cddr (seq-find
(lambda (entry)
(string-equal key (cadr entry)))
(bibtex-actions--get-candidates))))

(defun bibtex-actions-get-template (template-name)
"Return template string for TEMPLATE-NAME."
Expand All @@ -467,10 +464,10 @@ If the cache is unintialized, this will load the cache.
If FORCE-REBUILD-CACHE is t, force reload the cache."
(if force-rebuild-cache
(bibtex-actions-refresh force-rebuild-cache)
(when (eq 'uninitialized bibtex-actions--candidates-cache)
(bibtex-actions-refresh nil 'global))
(when (eq 'uninitialized bibtex-actions--local-candidates-cache)
(bibtex-actions-refresh nil 'local)))
(when (eq 'uninitialized bibtex-actions--candidates-cache)
(bibtex-actions-refresh nil 'global))
(when (eq 'uninitialized bibtex-actions--local-candidates-cache)
(bibtex-actions-refresh nil 'local)))
(seq-concatenate 'list
bibtex-actions--local-candidates-cache
bibtex-actions--candidates-cache))
Expand Down

0 comments on commit 2bd5965

Please sign in to comment.