emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Proper use of 'org-file-apps'
@ 2013-06-27  4:27 Vladimir Lomov
  2013-06-27  5:52 ` Nick Dokos
  0 siblings, 1 reply; 6+ messages in thread
From: Vladimir Lomov @ 2013-06-27  4:27 UTC (permalink / raw)
  To: General discussions about Org-mode

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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-28  2:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-27  4:27 Proper use of 'org-file-apps' Vladimir Lomov
2013-06-27  5:52 ` 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

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).