[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Proper use of 'org-file-apps'
From: |
Vladimir Lomov |
Subject: |
[O] Proper use of 'org-file-apps' |
Date: |
Thu, 27 Jun 2013 13:27:13 +0900 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hello,
I wonder how to use 'org-file-apps'.
As I understand, when I run ~C-c C-o~ on a link of form
[[file:file.pdf][a PDF file]] Org mode uses this variable to decide how
to 'open' this type of file. Instead of docview mode of Emacs I want to
use Okular (it allows to select text from PDF file), so I read docstring
of 'org-file-apps' variable and tried to change it accordingly, but
seems I do something strange because following example don't work.
#######################################################################
#+TITLE: Self-contained example
#+AUTHOR: Vladimir Lomov
#+PROPERTY: padline no
* Minimal configuration for Emacs
This is minimal configuration to run Emacs
#+BEGIN_SRC emacs-lisp :tangle org-apps-c.el
(add-to-list 'load-path "/usr/share/emacs/site-lisp/org")
(require 'org)
(setq org-file-apps
'( ("\\.pdf::\\(\\d+\\)\\'" . "run-me --page %1 %s")
("\\.pdf\\'" . "run-me %s")
)
)
#+END_SRC
The test script ~run-me~
#+BEGIN_SRC sh :tangle run-me :shebang "#!/bin/bash"
file=run-me.log
echo "INPUT" >> ${file}
echo "'$@'" >> ${file}
#+END_SRC
The test Org document
#+BEGIN_SRC org :tangle sample.org
,#+TITEL: A sample
,* Sample head
1. First item, PDF file, [[file:file.pdf][a file]];
2. second item, PDF file with selected page, [[file:file.pdf::2][a file]].
#+END_SRC
Note, that to actually test it one needs a PDF file named as
~file.pdf~ located in the same directory as the test Org document.
This is how I run Emacs to test my settings:
#+BEGIN_EXAMPLE
emacs -Q -l org-apps-c.el --eval '(find-file "sample.org")'
#+END_EXAMPLE
What I expect? After I run ~C-c C-o~ on both links, I would expect to
see two different lines (parameters passed to test script) in
~run-me.log~ file. Instead, both parameters are the same. What I do
wrong? Did I understand ~org-file-apps~ correctly?
Org mode version is
#+BEGIN_EXAMPLE
Org-mode version 8.0.3 (release_8.0.3-276-g685b29 @
/usr/share/emacs/site-lisp/org/)
#+END_EXAMPLE
Emacs version is
#+BEGIN_EXAMPLE
GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.2) of
2013-06-26 on HOST
#+END_EXAMPLE
#######################################################################
---
WBR, Vladimir Lomov
--
(Never thought I'd be telling Malcolm and Ilya the same thing... :-)
-- Larry Wall in <address@hidden>
- [O] Proper use of 'org-file-apps',
Vladimir Lomov <=