emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: Leo Alekseyev <dnquark@gmail.com>
Cc: Rick Frankel <rick@rickster.com>, Emacs orgmode <emacs-orgmode@gnu.org>
Subject: Re: Is it possible to create links to M-x occur results?
Date: Fri, 3 May 2013 09:14:43 +0200	[thread overview]
Message-ID: <1770C68C-47FD-4E0A-89C1-79DFE3F9CE82@gmail.com> (raw)
In-Reply-To: <CADzxs1m2NJ0J4Qe+bNs2r8hdiKef+5e5TP07ayOxAXQ2VesKRA@mail.gmail.com>

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


On 2.5.2013, at 19:25, Leo Alekseyev <dnquark@gmail.com> 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...

- Carsten

> 
> 
> On Thu, May 2, 2013 at 7:07 AM, Rick Frankel <rick@rickster.com> wrote:
> On 01.05.2013 18:41, Leo Alekseyev wrote:
> Howdy Org-folks,
> 
> Something that I've found myself wishing for time and time again is to
> be able to follow the link to a file and immediately pop into a set of
> M-x occur results given some search term for that file.  That way I
> could link to an overview of a file's class/function definitions, or
> config stanzas, or other useful things.  Given that we can create
> links to arbitrary elisp, I am sure that this can be done in
> principle, but if there's a quick recipe that someone has come up
> with, I'd love to hear about it!
> 
> That seems like a fun exercise. so:
> 
> #+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
> 
> and you can use a link like:
> 
> occur:m/file.txt#regex
> 
> rick
> 


[-- Attachment #2: Type: text/html, Size: 2800 bytes --]

  reply	other threads:[~2013-05-03  7:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 22:41 Is it possible to create links to M-x occur results? Leo Alekseyev
2013-05-02 14:07 ` Rick Frankel
2013-05-02 17:25   ` Leo Alekseyev
2013-05-03  7:14     ` Carsten Dominik [this message]
2013-05-03  8:21       ` Memnon Anon
2013-05-03 12:10         ` Nicolas Richard
2013-05-03 12:39       ` Rick Frankel
2013-05-05 13:44         ` Viktor Rosenfeld

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=1770C68C-47FD-4E0A-89C1-79DFE3F9CE82@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=dnquark@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rick@rickster.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).