emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] patch to support remember in evince


From: Jan Böcker
Subject: Re: [Orgmode] patch to support remember in evince
Date: Wed, 03 Feb 2010 10:44:55 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.7) Gecko/20100120 Shredder/3.0.1

On 31.01.2010 11:19, D M German wrote:
> 
> here is a patch to support remember inside evince.
> 
> http://turingmachine.org/~dmg/temp/0001-Added-support-for-xournal-but-docview-linking-needs-.patch
>  

Hi Daniel,

sorry for my late reply, I have just caught up with the list again.

The patch works for me, but as in your patch for xournal, there is a
problem with non-ASCII characters. An "ü" arrives in emacs as "%C3%BC",
which are the two URL-encoded bytes which make up the character in UTF-8.

I don't know if this one is a bug in org-protocol, though, because AFAIK
unix filenames are just a bunch of bytes and evince might not be able to
find out what the encoding is supposed to be.

> I tried to pass the text selection to remember, but it does not
> work (org-protocol://remember://docview:filename::pagenumber::selection).
> 
> Looking at the code of org-docview.el I can see that its code does not
> support splitting the selection. I suspect this is a minor change
> required. Any suggestions on how to change it?

As I already indicated in the "Protocol for PDFs" thread, I realized
that docview: is just a syntax for specialized file: links.

Take a look at the following patch I posted to the mailing list two
weeks ago:
http://thread.gmane.org/gmane.emacs.orgmode/21474

This allows you to define customized file: links.
These are some entries from my org-file-apps variable:

        Extension: \.pdf\'
        Command: evince "%s"

        Extension: \.pdf::\([0-9]+\)\'
        Command: evince -p %1 "$s"
        
        Extension: \.xoj\'
        Command: /home/jan/.local/bin/xournal %s
        
        Extension: \.xoj::\([0-9]+\)\'
        Command: /home/jan/.local/bin/xournal -p %1 %s

This allows me to link to PDFs and Xournal files using normal file:
links, both with and without page numbers.

You could easily define a custom regexp which captures the page number
and the selection with groups, then uses them in a command as %1 and %2.

You can also use the groups in custom lisp forms, like this:
        Extension: \.pdf::\(.*\)::\(.*\)\'
        Lisp form: (progn
(message (concat "Page Number: " (match-string 1 link)))
(message (concat "Selection: " (match-string 2 link)))
(message (concat "File Name: " file)))

HTH, Jan




reply via email to

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