From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vladimir Lomov Subject: Re: Proper use of 'org-file-apps' Date: Fri, 28 Jun 2013 08:56:12 +0900 Message-ID: <20130627235612.GI688@smoon> References: <20130627042713.GA688@smoon> <87hagk3xse.fsf@gmail.com> <20130627065829.GB688@smoon> <8761wzk79m.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fdj2RfSjLxBAspz7" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42036) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsM32-0003wE-Ar for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 19:56:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UsM31-00081t-5V for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 19:56:20 -0400 Received: from mail-la0-x22c.google.com ([2a00:1450:4010:c03::22c]:60718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UsM30-0007zX-RO for emacs-orgmode@gnu.org; Thu, 27 Jun 2013 19:56:19 -0400 Received: by mail-la0-f44.google.com with SMTP id er20so1523413lab.3 for ; Thu, 27 Jun 2013 16:56:17 -0700 (PDT) Content-Disposition: inline In-Reply-To: <8761wzk79m.fsf@gmail.com> 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: emacs-orgmode@gnu.org Cc: Nick Dokos --fdj2RfSjLxBAspz7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hello, ** Nick Dokos [2013-06-27 09:33:41 -0400]: > Vladimir Lomov writes: >> ** Nick Dokos [2013-06-27 01:52:49 -0400]: >>> Vladimir Lomov writes: >>>> #+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 >>> \d is Perl regexp syntax for matching a digit, but (afaik) not emacs >>> syntax. Try >>>> '( ("\\.pdf::\\([0-9]+\\)\\'" . "run-me --page %1 %s") >>>or >>>> '( ("\\.pdf::\\([[:digit:]]+\\)\\'" . "run-me --page %1 %s") >>> instead. >> D'oh, I had searched Emacs manual about meaning of \' but didn't try to >> check if \d is acceptable. Nevertheless, 'org-file-apps' docstring must >> be updated then, because this \\d part is from it. > Yes, indeed. There's also the vexing question of backslashes. At least > in my version of the C-h v org-file-apps output, the examples appear > with single backslashes in the quoted strings, so if somebody just cuts > and pastes, it is *not* going to work. > Could you make a patch? Something like that? --- WBR, Vladimir Lomov -- Are we running light with overbyte? --fdj2RfSjLxBAspz7 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Fix-docstring-for-org-file-apps.patch" >From 7840435bd76b38ab536108dfc105fdc53a6aa80d Mon Sep 17 00:00:00 2001 From: Vladimir Lomov Date: Fri, 28 Jun 2013 08:42:15 +0900 Subject: [PATCH] Fix docstring for `org-file-apps' * lisp/org.el: `org-file-apps' docstring: doubled backslashes (would give usable output when run 'C-h v org-file-apps') and use correct regexp to match digits. TINYCHANGE --- lisp/org.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d0dffc7..5e56231 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1940,8 +1940,8 @@ file identifier are filename matches the regexp. If you want to use groups here, use shy groups. - Example: (\"\\.x?html\\'\" . \"firefox %s\") - (\"\\(?:xhtml\\|html\\)\" . \"firefox %s\") + Example: (\"\\\\.x?html\\\\'\" . \"firefox %s\") + (\"\\\\(?:xhtml\\\\|html\\\\)\" . \"firefox %s\") to open *.html and *.xhtml with firefox. - Regular expression which contains (non-shy) groups: @@ -1956,7 +1956,7 @@ file identifier are In a custom lisp form, you can access the group matches with (match-string n link). - Example: (\"\\.pdf::\\(\\d+\\)\\'\" . \"evince -p %1 %s\") + Example: (\"\\\\.pdf::\\\\([[:digit:]]+\\\\)\\\\'\" . \"evince -p %1 %s\") to open [[file:document.pdf::5]] with evince at page 5. `directory' Matches a directory -- 1.8.3.1 --fdj2RfSjLxBAspz7--