From: Vladimir Lomov <lomov.vl@gmail.com>
To: General discussions about Org-mode <emacs-orgmode@gnu.org>
Subject: Proper use of 'org-file-apps'
Date: Thu, 27 Jun 2013 13:27:13 +0900 [thread overview]
Message-ID: <20130627042713.GA688@smoon> (raw)
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 <199711071819.KAA29909@wall.org>
next reply other threads:[~2013-06-27 4:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-27 4:27 Vladimir Lomov [this message]
2013-06-27 5:52 ` Proper use of 'org-file-apps' Nick Dokos
2013-06-27 6:58 ` Vladimir Lomov
2013-06-27 13:33 ` Nick Dokos
2013-06-27 23:56 ` Vladimir Lomov
2013-06-28 2:14 ` Nick Dokos
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=20130627042713.GA688@smoon \
--to=lomov.vl@gmail.com \
--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).