Advertisement
dowcet

helm-bibtex defadvice

Apr 8th, 2015
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.95 KB | None | 0 0
  1. ;;; my defadvice to store bibtex notes under org-headings
  2. (defcustom helm-bibtex-notes-org-file "~/helm-bibtex-notes.org"
  3.   "The path and name of an org-mode file where notes are stored, used by the defadvice 'org-filed-notes' on helm-bibtex-edit-notes. This advice assumes that notes are stored under a unique headline that begins with a BibTeX-key."
  4.   :group 'helm-bibtex
  5.   :type 'file)
  6.  
  7. (defadvice helm-bibtex-edit-notes (around org-filed-notes)
  8.   "Attach notes as a headline in an org file, instead of as a file in a folder. If no headline found, creates a new top-level headline at the end of the file."
  9.   (setq target-note-headline (concat "* " key))
  10.   (find-file helm-bibtex-notes-org-file)
  11.   (goto-char (point-min))
  12.   (unless (search-forward target-note-headline nil t)
  13.     (goto-char (point-max))
  14.     (newline)
  15.     (beginning-of-line)
  16.     (insert target-note-headline))
  17.   (org-show-context)
  18.   (end-of-line))
  19.  
  20. (ad-activate 'helm-bibtex-edit-notes)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement