emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: org-exp-bibtex missing in git?
Date: Fri, 08 Mar 2013 20:40:15 +0100	[thread overview]
Message-ID: <878v5xhe8w.fsf@pank.eu> (raw)
In-Reply-To: <87txolk7qk.fsf@gmail.com> (aaronecay@gmail.com's message of "Fri, 08 Mar 2013 14:32:35 -0500")


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	other threads:[~2013-03-08 19:54 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-03  7:06 org-exp-bibtex missing in git? Vikas Rawal
2013-03-03 10:39 ` François Allisson
2013-03-03 17:11   ` Bastien
2013-03-03 17:19     ` Nicolas Goaziou
2013-03-03 20:00       ` Andreas Leha
2013-03-03 20:42         ` Nicolas Goaziou
2013-03-04  9:29           ` Eric S Fraga
2013-03-06 13:38           ` Andreas Leha
2013-03-06 18:25             ` Bastien
2013-03-06 18:39               ` Nicolas Goaziou
2013-03-06 21:16                 ` Andreas Leha
2013-03-06 22:55                 ` Bastien
2013-03-06 23:37                   ` Andreas Leha
2013-03-07  8:32                     ` Bastien
2013-03-07  8:44                       ` Andreas Leha
2013-03-07  5:38               ` aaronecay
2013-03-07  8:54                 ` Eric S Fraga
2013-03-07 10:21                 ` Bastien
2013-03-07 11:04                   ` Aaron Ecay
2013-03-07 11:16                     ` Bastien
2013-03-07 12:03                       ` Aaron Ecay
2013-03-07 13:13                   ` Nicolas Goaziou
2013-03-07 15:28                     ` Bastien
2013-03-07 17:39                       ` Achim Gratz
2013-03-07 22:06                         ` Bastien
2013-03-07 22:46                           ` Achim Gratz
2013-03-07 23:37                             ` Rasmus Pank Roulund
2013-03-07 23:43                               ` Rasmus
2013-03-08  0:10                                 ` Thomas S. Dye
2013-03-08  9:27                                   ` Rasmus
2013-03-08 17:36                                     ` Thomas S. Dye
2013-03-08 19:32                               ` aaronecay
2013-03-08 19:40                                 ` Rasmus [this message]
2013-03-08 19:29                       ` aaronecay
2013-03-09  9:28                         ` Bastien
2013-03-19  5:02                           ` Aaron Ecay
2013-04-18 10:58                             ` Bastien
2013-03-09 15:15                         ` Nicolas Goaziou
2013-03-09 16:04                           ` Jambunathan K
2013-03-09 16:12                             ` Jambunathan K
2013-03-09 17:08                             ` Thomas S. Dye
2013-03-07 10:04             ` Jambunathan K
2013-03-11 13:34               ` Andreas Leha
2013-03-04  4:40   ` Vikas Rawal
2013-03-04 13:55     ` Suvayu Ali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878v5xhe8w.fsf@pank.eu \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).