emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] org-exp-bibtex missing in git?


From: Rasmus
Subject: Re: [O] org-exp-bibtex missing in git?
Date: Fri, 08 Mar 2013 20:40:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Aaron,

>>   2. Citation selection should be possible via Reftex.
>
> In principle this is true, but I think RefTeX is deeply intertwined with
> the assumption that it is running in a LaTeX buffer.  Going through its
> code and making it major-mode-agnostic is a worthy project all of its
> own.  But it might take less effort and be more long-run maintainable to
> just wire up the bibtex.el bundled with emacs, CompletionUI
> (http://www.emacswiki.org/CompletionUI) and YAsnippet
> (http://emacswiki.org/emacs/Yasnippet).

These are not shipped with Emacs.  Reftex is.  I don't know how big of
a project it would be to adapt Reftex.

This is what I use for selecting entries.  Admittedly, it's 'hackish'.

#+BEGIN_SRC emacs-lisp

(defun org-mode-reftex-setup ()
  (load-library "reftex")
  (and (buffer-file-name)
       (file-exists-p (buffer-file-name))
       (reftex-parse-all))
  (make-local-variable 'reftex-cite-format)
  (setq reftex-cite-format 'org)
  (define-key org-mode-map (kbd "C-c )") 'reftex-citation))

(add-hook 'org-mode-hook 'org-mode-reftex-setup)


(eval-after-load 'reftex-vars
  '(progn
     (add-to-list 'reftex-cite-format-builtin
                  '(org "Org-mode citation"
                        ((?\C-m . "[[cite:%l]]")
                         (?t . "[[textcite:%l]]")
                         (?p . "[[parencite:%l]]")
                         (?s . "[[citepos:%l]]")
                         (?a . "[[citeauthor:%l]]")
                         (?y . "[[citeyear:%l]]")
                         (?n . "%l")
                         ;; the following depends on 
org-link-search-must-match-exact-headline
                         (?o . "[[file:~/documents/literature/lit.org::*%t][%2a 
(%y). %T]]"))))))

#+END_SRC


>>   3. It should look nice in the buffer.  [...]
>
> One could do this with font-lock and the new citation syntax I proposed
> in my other email.  We would need two alists.  One would pair citation
> lookup types with functions to resolve them to a location, and to get
> their properties.  The other would pair display types with two
> functions: one to return a format string that would be displayed by
> font-lock instead of the citation markup, and one to return the code to
> export the citation.

> So, a citation like [cite:doi:parens:some-doi:key=val&key2=val2] would be
> displayed by:
> 1. call (org-lookup-cite-doi "some-doi") -> (:author "Foo" :title "bar" ...)
> 2. call (org-display-cite-parens '(:author "Foo" :title "bar" ...)) ->
>    "(Foo 2000)"
> 3. (font-lock puts an overlay over the citation markup, with the
>    returned string)

Looks nice. 

> If you click on the citation, org would open the location (URL or local
> file) returned by (org-resolve-cite-doi "some-doi")

Yeah, I that aspect of url'ing is nice, I agree.

> A citation could exported by calling (org-export-cite-parens 'doi
> "some-doi" (:author "foo" :title "bar") current-backend).  This function
> could just return \parencite{foo} if exporting to latex and the citation
> was already in a bibtex file.  But it could also just return “Foo 2000”
> as a static string for dumb backends like ASCII, or write the
> information to a temporary bibtex file (so that latex can atomatically
> use the bibliographic info looked up from a DOI citation).

That also sounds nice.  Reftex provide many ways to format strings
which could be useful for ASCII backend, say, but perhaps it's too
tied to LaTeX, as you suggest above.

> In any event, this is a big, complicated project.  Step zero for me (and
> many people, I guess) is to get a slightly less hackish way to export
> Bibtex-based citations to latex, and the other pieces can be built on
> top of that.

If such a project is undertaken it should, however, be done right, I
am sure we would agree. Making citation "first class citizens" would
be a first step IMO.

Cheers,
Rasmus

-- 
If you can mix business and politics wonderful things can happen!




reply via email to

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