emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Vladimir Lomov <lomov.vl@gmail.com>
To: emacs-orgmode@gnu.org
Cc: Nick Dokos <ndokos@gmail.com>
Subject: Re: Proper use of 'org-file-apps'
Date: Fri, 28 Jun 2013 08:56:12 +0900	[thread overview]
Message-ID: <20130627235612.GI688@smoon> (raw)
In-Reply-To: <8761wzk79m.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1318 bytes --]

Hello,
** Nick Dokos [2013-06-27 09:33:41 -0400]:

> Vladimir Lomov <lomov.vl@gmail.com> writes:

>> ** Nick Dokos [2013-06-27 01:52:49 -0400]:

>>> Vladimir Lomov <lomov.vl@gmail.com> 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?

[-- Attachment #2: 0001-Fix-docstring-for-org-file-apps.patch --]
[-- Type: text/x-diff, Size: 1609 bytes --]

From 7840435bd76b38ab536108dfc105fdc53a6aa80d Mon Sep 17 00:00:00 2001
From: Vladimir Lomov <lomov.vl@gmail.com>
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


  reply	other threads:[~2013-06-27 23:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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=20130627235612.GI688@smoon \
    --to=lomov.vl@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ndokos@gmail.com \
    /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).