emacs-wiki-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[emacs-wiki-discuss] snippet to do bibtex urls


From: Jody Klymak
Subject: [emacs-wiki-discuss] snippet to do bibtex urls
Date: Wed, 30 Jun 2004 15:01:37 -0700
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (darwin)

Hi all,

I use bibtex to keep track of citations, and have wanted a way to
cross-reference in notes.  Here is a way.  It creates and parses
entries like:

bibtex:/Users/jklymak/texmf/bibtex/main.bib:alfordpinkel00b

and follows the link takes you to the citation key "alfordpinkel00b"
in main.bib.

You need to customize planner-url-list, though someone more clever
than me may know how to do it from the config file.

Also, any way to make the string-match stuff better would be
appreciated.  I'd have though the first string-match would have given
me match-string 1 and match-string 2, but no dice.

Thanks,  Jody


(defun planner-annotation-from-bibtex ()
  "Return the filename on the current line in dired"
  (when (planner-derived-mode-p 'bibtex-mode)
    (bibtex-beginning-of-entry)
    (re-search-forward bibtex-entry-maybe-empty-head nil t)
    (concat "bibtex:" (buffer-file-name) ":" (bibtex-key-in-head))))

;; (add-to-list 'planner-url-list "bibtex:");
;; (planner-option-customized 'planner-url-list (add-to-list 'planner-url-list 
"bibtex:"));

(defun planner-bibtex-browse-url (url)
  "If this is a Bibtex URL, jump to it."
  (when (string-match "^bibtex:\\(.+\\):\\(.+\\)" url)
    (find-file (match-string 1 url))
    (goto-char 0)
    (string-match "^bibtex:.+:\\(.+\\)" url)
    (search-forward (concat (concat "{" (match-string 1 url)) ","))))

(add-hook 'planner-browse-url-functions 'planner-bibtex-browse-url)
(add-hook 'planner-annotation-functions 'planner-annotation-from-bibtex)

-- 
Jody Klymak      http://opg1.ucsd.edu/~jklymak/
mailto:address@hidden   





reply via email to

[Prev in Thread] Current Thread [Next in Thread]