From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Jan_B=F6cker?= Subject: [PATCH] org-file-apps docstring: document using regexp group matches as command line parameters, add examples Date: Wed, 12 May 2010 23:44:54 +0200 Message-ID: <4BEB2156.2080901@jboecker.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090902080500080004080602" Return-path: Received: from [140.186.70.92] (port=40997 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OCPG5-0008L5-88 for emacs-orgmode@gnu.org; Wed, 12 May 2010 23:38:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OCJk5-0003bX-Cs for emacs-orgmode@gnu.org; Wed, 12 May 2010 17:45:28 -0400 Received: from mail7.worldserver.net ([217.13.200.27]:46835) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OCJk1-0003ZZ-Sg for emacs-orgmode@gnu.org; Wed, 12 May 2010 17:45:24 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode This is a multi-part message in MIME format. --------------090902080500080004080602 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit This is also available via git pull git://github.com/jboecker/org-mode.git for-carsten I tried to document the new behaviour as concise and clear as possible. (If anyone reads this and finds it too confusing in any way, please say so . I introduced the changes, so I know what they do and why, but the docstring has to explain this to people who do not.) While I could not make it any shorter than my first draft, I hope that the clear separation of the three possible interpretations of a string as the file identifier and the short example for each one will allow the reader to quickly find what they need without having to understanding all of the complexity first. Regards, Jan --------------090902080500080004080602 Content-Type: text/x-patch; name="0001-org-file-apps-docstring-document-using-regexp-group-.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-org-file-apps-docstring-document-using-regexp-group-.pa"; filename*1="tch" >From 98fa677bc979ac9e89826d2b520233a7724a87ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6cker?= Date: Wed, 12 May 2010 23:15:56 +0200 Subject: [PATCH] org-file-apps docstring: document using regexp group matches as command line parameters, add examples The functionality which this patch documents was originally introduced in commit 75563bf71e6df356a5ae77a93152fcf913378107, then re-written in commit dfda58d720484124f9432a09d831a9d6292908af and the 5 commits before that. --- lisp/org.el | 34 +++++++++++++++++++++++++++++++--- 1 files changed, 31 insertions(+), 3 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 8dc806d..89879c2 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -1477,9 +1477,37 @@ you can use this variable to set the application for a given file extension. The entries in this list are cons cells where the car identifies files and the cdr the corresponding command. Possible values for the file identifier are - \"regex\" Regular expression matched against the file name. For backward - compatibility, this can also be a string with only alphanumeric - characters, which is then interpreted as an extension. + \"string\" A string as a file identifier can be interpreted in different + ways, depending on its contents: + + - Alphanumeric characters only: + Match links with this file extension. + Example: (\"pdf\" . \"evince %s\") + to open PDFs with evince. + + - Regular expression: Match links where the + filename matches the regexp. If you want to + use groups here, use shy groups. + + Example: (\"\\.x?html\\'\" . \"firefox %s\") + (\"\\(?:xhtml\\|html\\)\" . \"firefox %s\") + to open *.html and *.xhtml with firefox. + + - Regular expression which contains (non-shy) groups: + Match links where the whole link, + including \"::\" and anything after that, matches the regexp. + In a custom command string, %1, %2, etc. are replaced with the + parts of the link that were matched by the groups. + For backwards compatibility, if a command string is given that + does not use any of the group matches, this case is handled + identically to the second one (i.e. match against file name only). + + In a custom lisp form, you can access the group matches with + (match-string n link). + + Example: (\"\\.pdf::\\(\\d+\\)\\'\" . \"evince -p %1 %s\") + to open [[file:document.pdf::5]] with evince at page 5. + `directory' Matches a directory `remote' Matches a remote file, accessible through tramp or efs. Remote files most likely should be visited through Emacs -- 1.7.0.4 --------------090902080500080004080602 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --------------090902080500080004080602--