Re: [O] Is it possible to create links to M-x occur results?

2013-05-05 Thread Viktor Rosenfeld
Hi,

Rick Frankel wrote:

> On Fri, May 03, 2013 at 09:14:43AM +0200, Carsten Dominik wrote:
> >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...
> 
> I have added it to org-hacks.org between "Store link to a message when
> sending in Gnus" and "Send html messages and attachments with
> Wanderlust", but when i push to master, i get the following in the log
> output from the git-hook and it' doesn't show up in the website:
> 
>remote: Publishing file /home/emacs/git/worg/sitemap.org using 
> `org-publish-org-to-html'
>remote: Symbol's function definition is void: org-publish-org-to-html
> 

I just pushed a change to Worg and got the same error message.

Cheers,
Viktor



Re: [O] Is it possible to create links to M-x occur results?

2013-05-03 Thread Rick Frankel
On Fri, May 03, 2013 at 09:14:43AM +0200, Carsten Dominik wrote:
>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...

I have added it to org-hacks.org between "Store link to a message when
sending in Gnus" and "Send html messages and attachments with
Wanderlust", but when i push to master, i get the following in the log
output from the git-hook and it' doesn't show up in the website:

   remote: Publishing file /home/emacs/git/worg/sitemap.org using 
`org-publish-org-to-html'
   remote: Symbol's function definition is void: org-publish-org-to-html

rick



Re: [O] Is it possible to create links to M-x occur results?

2013-05-03 Thread Nicolas Richard
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




Re: [O] Is it possible to create links to M-x occur results?

2013-05-03 Thread Memnon Anon
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...

It is probably easier to fix it directly...

   http://orgmode.org/worg/worg-git.html 

should get you started with that.

Go ahead, it is really not that difficult ;).

And if things get messed up, it is VC after all, so very easy to fix any
'mistake' that may have happened.

Memnon





Re: [O] Is it possible to create links to M-x occur results?

2013-05-03 Thread Carsten Dominik

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...

- Carsten

> 
> 
> On Thu, May 2, 2013 at 7:07 AM, Rick Frankel  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
> 



Re: [O] Is it possible to create links to M-x occur results?

2013-05-02 Thread Leo Alekseyev
Nice!  Short and sweet, and works great.  It should go on
orgmode.orgsomewhere in the cool hacks section.


On Thu, May 2, 2013 at 7:07 AM, Rick Frankel  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
>


Re: [O] Is it possible to create links to M-x occur results?

2013-05-02 Thread Rick Frankel

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



[O] Is it possible to create links to M-x occur results?

2013-05-01 Thread Leo Alekseyev
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!

--Leo