emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Willig <andreas.willig@canterbury.ac.nz>
To: Andreas Willig <andreas.willig@canterbury.ac.nz>Andreas Willig
	<andreas.willig@canterbury.ac.nz>
Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: Integration of RefTeX and LaTeX export
Date: Fri, 17 Feb 2012 21:36:05 +1300	[thread overview]
Message-ID: <A47458F1AE3BC545911B10628202E9D204D28DF6@ucexchange2.canterbury.ac.nz> (raw)
In-Reply-To: A47458F1AE3BC545911B10628202E9D204D28DF5@ucexchange2.canterbury.ac.nz


Hi,

it is a version problem. I have just downloaded the latest version of
org-mode (7.8.03) and now the handler gets called. 

Sorry for the fuss ...

Thanks again, i really appreciate the quick help i have received here!!

Andreas

-----Original Message-----
From: Andreas Willig
Sent: Fri 2/17/2012 9:10 PM
To: Andreas Willig; nicholas.dokos@hp.com
Cc: nicholas.dokos@hp.com; emacs-orgmode@gnu.org
Subject: RE: [O] Integration of RefTeX and LaTeX export
 

I should have added that the rt-follow-hander is properly called ...

Is this a version problem?

-----Original Message-----
From: emacs-orgmode-bounces+andreas.willig=canterbury.ac.nz@gnu.org on behalf of Andreas Willig
Sent: Fri 2/17/2012 8:39 PM
To: nicholas.dokos@hp.com
Cc: nicholas.dokos@hp.com; emacs-orgmode@gnu.org
Subject: Re: [O] Integration of RefTeX and LaTeX export
 

Hi Nick,

thanks for this, but i cannot get it to work ...
I have started a vanilla emacs without any init file
(emacs -q), have loaded your snippet from a file and
evaluated the buffer. Again, the export-handler does
not get called. I am running Debian 6.0.4 and my emacs
is the one coming with it (see below).

I feel so stupid :-))

Andreas


M-x emacs-version says: GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-12-12 on raven, modified by Debian

M-x org-version says: Org-mode version 6.33x

Debian version is 6.0.4 (/etc/debian_version)



-----Original Message-----
From: Nick Dokos [mailto:nicholas.dokos@hp.com]
Sent: Fri 2/17/2012 6:31 PM
To: Andreas Willig
Cc: Thomas S.Dye; emacs-orgmode@gnu.org; nicholas.dokos@hp.com
Subject: Re: [O] Integration of RefTeX and LaTeX export
 
Andreas Willig <andreas.willig@canterbury.ac.nz> wrote:

> 
> Hi Thomas,
> 
> thanks for this hint. I have looked at this, the changed / added functions are
> below, everything else has not changed. I still have a problem.
> 
> I have created a new link type as you suggested and have consulted google
> on how to do it (my emacs-lisp-fu is not good enough to sort out directly what
> this function is doing ...). In my understanding the third argument is a function
> that is called when an export process has started and a link is about to be
> exported. My first problem is: this handler function is never called, the error
> message that i have inserted below does never appear. I have seen that the
> variable "org-link-types" contains the defined link type, and the variable
> "org-link-protocols" shows my handler.
> 
> My second problem is that the generated LaTeX output is
>   "\texttt{\cite{key}}"
> but it should simply be "\cite{key}". I would guess that the second problem
> is a corollary of the first one ...
> 
> Any ideas?
> 
> Andreas
> 

I'm pretty sure the second function is not quoted properly in your
org-add-link-type so it ends up actually getting called at the time of
the org-add-link-type is called.

Try the following:

--8<---------------cut here---------------start------------->8---
(defun rt-follow-handler (path)
  (message "dummy handler called, path = %s" path)
  (let ((arg (concat "\\cite{" path "}")))
    (reftex-view-crossref arg)))

(defun rt-export-handler  (path desc format)
  (message "my handler is called")
  (cond ((eq format 'latex)
	 (if (or (not desc) (equal 0 (search "rtcite:" desc)))
	     (format "\\cite{%s}" path)
	   (format "\\cite[%s]{%s}" desc path)))))

(require 'org)
(org-add-link-type "rtcite" 
		   (function rt-follow-handler)
		   (function rt-export-handler))
--8<---------------cut here---------------end--------------->8---

By way of explanation:

I had this as part of a minimal .emacs and it seems to work more or
less OK: I replaced the error call with a message call, because it
actually triggered and blew up :-) The rt-export-handler needs tweaking
but you 'll know what to do better than I do when you see the latex
output.

I had to (require 'org) to pick up the definition of org-add-link-type:
that seems to be a missing autoload somewhere.

And finally I like to quote functions with function, not quote, for
compiled-code reasons, but in most cases, it won't make any difference:
use quotes if you prefer.

Nick

> ============================================
> 
> (defun rt-handler (path)
>   (message "dummy handler called, path = %s" path)
>   (let ((arg (concat "\\cite{" path "}")))
>     (reftex-view-crossref arg)))
> 
> (org-add-link-type "rtcite" 
> 		   'rt-handler
> 		   (lambda (path desc format)
> 		     (error "my handler is called")
> 		     (cond ((eq format 'latex)
> 			    (if (or (not desc) (equal 0 (search "rtcite:" desc)))
> 				(format "\\cite{%s}" path)
> 			      (format "\\cite[%s]{%s}" desc path))))))
> 
> 
> ....


This email may be confidential and subject to legal privilege, it may
not reflect the views of the University of Canterbury, and it is not
guaranteed to be virus free. If you are not an intended recipient,
please notify the sender immediately and erase all copies of the message
and any attachments.

Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more
information.




This email may be confidential and subject to legal privilege, it may
not reflect the views of the University of Canterbury, and it is not
guaranteed to be virus free. If you are not an intended recipient,
please notify the sender immediately and erase all copies of the message
and any attachments.

Please refer to http://www.canterbury.ac.nz/emaildisclaimer for more
information.

  reply	other threads:[~2012-02-17  8:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-16 20:59 Integration of RefTeX and LaTeX export Andreas Willig
2012-02-16 22:08 ` Thomas S. Dye
2012-02-17  4:46   ` Andreas Willig
2012-02-17  5:31     ` Nick Dokos
2012-02-17  7:39       ` Andreas Willig
2012-02-17  8:10         ` Andreas Willig
2012-02-17  8:36           ` Andreas Willig [this message]
2012-02-17 17:59             ` Nick Dokos
2012-02-17 19:12               ` Achim Gratz
2012-02-17 19:17                 ` Nick Dokos
2012-03-23 16:14       ` Navigatable and exportable bib/notes links - Was: " Olivier Berger

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=A47458F1AE3BC545911B10628202E9D204D28DF6@ucexchange2.canterbury.ac.nz \
    --to=andreas.willig@canterbury.ac.nz \
    --cc=emacs-orgmode@gnu.org \
    --cc=nicholas.dokos@hp.com \
    /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).