From 63f1563f205ff4be73cb8364a0aa5e170f3f4c5d Mon Sep 17 00:00:00 2001 From: dowcet Date: Thu, 9 Apr 2015 12:22:28 +0800 Subject: [PATCH 1/2] quick fixes for compatibility and search problem Line 714: The idea here is to only catch keys if they are a `:BIBTEX-KEY:` property or at the start of an org-mode headline. Someone familiar with using regexps in org-mode could do this much better. Lines 716-718: I don't see `outline-hide-other` and `outline-show-subtree` defined in Emacs 24.3.1. I'm not sure what the side-effects of this change may be. --- helm-bibtex.el | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/helm-bibtex.el b/helm-bibtex.el index 48ed9f6..788742c 100644 --- a/helm-bibtex.el +++ b/helm-bibtex.el @@ -711,11 +711,9 @@ defined. Surrounding curly braces are stripped." ;; from the template: (find-file helm-bibtex-notes-path) (goto-char (point-min)) - (if (re-search-forward (concat "\\b" key "\\b") nil t) + (if (or (search-forward (concat ":BIBTEX-KEY: " key) nil t) (search-forward (concat "* " key) nil t)) (when (eq major-mode 'org-mode) - (outline-hide-other) - (outline-show-subtree) - (outline-previous-visible-heading 1) + (org-show-context) (recenter-top-bottom 1)) (goto-char (point-max)) (insert (s-format helm-bibtex-notes-template From a71002d852d9f5cc4e291fa35dfa60fc9dc36484 Mon Sep 17 00:00:00 2001 From: me Date: Sat, 11 Apr 2015 22:31:43 +0800 Subject: [PATCH 2/2] if no pdf found, look for txt --- helm-bibtex.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/helm-bibtex.el b/helm-bibtex.el index 788742c..73b5426 100644 --- a/helm-bibtex.el +++ b/helm-bibtex.el @@ -449,7 +449,6 @@ values." concat (car p)) nil)) - (defun helm-bibtex-open-pdf (_) "Open the PDF associated with the entry using the function specified in `helm-bibtex-pdf-open-function'," @@ -458,7 +457,10 @@ specified in `helm-bibtex-pdf-open-function'," (let ((path (f-join helm-bibtex-library-path (s-concat key ".pdf")))) (if (f-exists? path) (funcall helm-bibtex-pdf-open-function path) - (message "No PDF for this entry: %s" key)))))) + (let ((path (f-join helm-bibtex-library-path (s-concat key ".txt")))) + (if (f-exists? path) + (funcall helm-bibtex-pdf-open-function path) + (message "No PDF or TXT for this entry: %s" key)))))))) (defun helm-bibtex-open-url-or-doi (_) "Open the associated URL or DOI in a browser."