From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vladimir Lomov Subject: Proper use of 'org-file-apps' Date: Thu, 27 Jun 2013 13:27:13 +0900 Message-ID: <20130627042713.GA688@smoon> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Us3nl-0006OA-FM for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 00:27:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Us3nj-0005If-Ow for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 00:27:21 -0400 Received: from mail-la0-x235.google.com ([2a00:1450:4010:c03::235]:41037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Us3nj-0005IP-Hy for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 00:27:19 -0400 Received: by mail-la0-f53.google.com with SMTP id fs12so269990lab.26 for ; Wed, 26 Jun 2013 21:27:18 -0700 (PDT) Received: from smoon ([141.105.33.55]) by mx.google.com with ESMTPSA id c4sm287499lae.7.2013.06.26.21.27.15 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Jun 2013 21:27:16 -0700 (PDT) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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>