From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Nicolas Richard" Subject: Re: Is it possible to create links to M-x occur results? Date: Fri, 03 May 2013 14:10:46 +0200 Message-ID: <87bo8sclh5.fsf@yahoo.fr> References: <1770C68C-47FD-4E0A-89C1-79DFE3F9CE82@gmail.com> <8761z0jx6d.fsf@mean.albasani.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYEoM-0005Aa-MH for emacs-orgmode@gnu.org; Fri, 03 May 2013 08:10:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYEoK-00074f-Ul for emacs-orgmode@gnu.org; Fri, 03 May 2013 08:10:02 -0400 Received: from plane.gmane.org ([80.91.229.3]:54056) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYEoK-00074T-Nm for emacs-orgmode@gnu.org; Fri, 03 May 2013 08:10:00 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UYEoD-00022l-AN for emacs-orgmode@gnu.org; Fri, 03 May 2013 14:09:53 +0200 Received: from geodiff-mac3.ulb.ac.be ([164.15.131.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 May 2013 14:09:53 +0200 Received: from theonewiththeevillook by geodiff-mac3.ulb.ac.be with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 03 May 2013 14:09:53 +0200 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 Memnon Anon writes: > Carsten Dominik writes: >> On 2.5.2013, at 19:25, Leo Alekseyev wrote: >> Nice! Short and sweet, and works great. It should go on >> orgmode.org somewhere in the cool hacks section. >> Make a patch if you don't have write access to worg... > Go ahead, it is really not that difficult ;). Yeah, let's go ahead indeed. >From db3313e2e88741a4084988bba656530d09ac7356 Mon Sep 17 00:00:00 2001 From: Nicolas Richard Date: Fri, 3 May 2013 14:04:01 +0200 Subject: [PATCH] org-hacks.org: Support for occur: links --- org-hacks.org | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/org-hacks.org b/org-hacks.org index 290dcf1..56cd24b 100644 --- a/org-hacks.org +++ b/org-hacks.org @@ -1109,6 +1109,29 @@ accomplish this: Then just use `M-x my-org-insert-link' instead of `org-insert-link'. +*** Insert a link that activates =M-x occur= in the target buffer +Posted on the Org-mode mailing list by Rick Frankel +(http://lists.gnu.org/archive/html/emacs-orgmode/2013-05/msg00072.html), this +is support for =occur:= links to automagically open an *Occur* session. + +#+BEGIN_SRC elisp + (defun org-occur-open (uri) + "Visit the file specified by URI, and run `occur' on the fragment + \(anything after '#') in the uri." + (let ((list (split-string uri "#"))) + (org-open-file (car list) t) + (occur (mapconcat 'identity (cdr list) "#")))) + (org-add-link-type "occur" 'org-occur-open) +#+END_SRC + +Links are written like this : + +#+begin_src org + [[occur:m/file.txt#regex][text]] +#+end_src + + + ** Archiving Content in Org-Mode *** Preserve top level headings when archiving to a file #+index: Archiving!Preserve top level headings -- 1.8.1.5