all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Search files in a folder
@ 2010-09-12 19:11 노정태
  2010-09-12 19:31 ` Eric S Fraga
  0 siblings, 1 reply; 10+ messages in thread
From: 노정태 @ 2010-09-12 19:11 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 285 bytes --]

Hello.

I want to search org files in my /org folder.
But I can't find a command to search files wholly.
C-c a s (org-search-view) does search only with headline.
I can't search the contents of my org files with just one command.

Does Org-mode have the function what I'm looking for?

[-- Attachment #1.2: Type: text/html, Size: 323 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Search files in a folder
  2010-09-12 19:11 Search files in a folder 노정태
@ 2010-09-12 19:31 ` Eric S Fraga
  2010-09-12 20:29   ` suvayu ali
  2010-09-13  1:51   ` Matt Lundin
  0 siblings, 2 replies; 10+ messages in thread
From: Eric S Fraga @ 2010-09-12 19:31 UTC (permalink / raw)
  To: 노정태; +Cc: org-mode mailing list

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

On Mon, 13 Sep 2010 04:11:48 +0900, 노정태 <basil83@gmail.com> wrote:
> 
> [1  <multipart/alternative (7bit)>]
> [1.1  <text/plain; ISO-8859-1 (7bit)>]
> Hello.
> 
> I want to search org files in my /org folder.
> But I can't find a command to search files wholly.
> C-c a s (org-search-view) does search only with headline.
> I can't search the contents of my org files with just one command.
> 
> Does Org-mode have the function what I'm looking for?

maybe org-mode does not but of course emacs does: M-x grep RET
or M-x occur RET

HTH,
eric

[-- Attachment #2: Type: text/plain, Size: 75 bytes --]

-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Search files in a folder
  2010-09-12 19:31 ` Eric S Fraga
@ 2010-09-12 20:29   ` suvayu ali
  2010-09-13  1:51   ` Matt Lundin
  1 sibling, 0 replies; 10+ messages in thread
From: suvayu ali @ 2010-09-12 20:29 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: org-mode mailing list, 노정태

On 12 September 2010 12:31, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:
> maybe org-mode does not but of course emacs does: M-x grep RET
> or M-x occur RET

Probably doesn't do as neatly as occur or grep, but the OP can get a
sparse tree based on a regex search.
`C-c / / <regex>'

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Search files in a folder
  2010-09-12 19:31 ` Eric S Fraga
  2010-09-12 20:29   ` suvayu ali
@ 2010-09-13  1:51   ` Matt Lundin
  2010-09-13  4:09     ` 노정태
  1 sibling, 1 reply; 10+ messages in thread
From: Matt Lundin @ 2010-09-13  1:51 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: org-mode mailing list, 노정태

Eric S Fraga <ucecesf@ucl.ac.uk> writes:

> On Mon, 13 Sep 2010 04:11:48 +0900, 노정태 <basil83@gmail.com> wrote:
>
>> I want to search org files in my /org folder.
>> But I can't find a command to search files wholly.
>> C-c a s (org-search-view) does search only with headline.
>> I can't search the contents of my org files with just one command.
>> 
>> Does Org-mode have the function what I'm looking for?
>
> maybe org-mode does not but of course emacs does: M-x grep RET
> or M-x occur RET
>

These work just fine. Org-mode also has a built-in interface to emacs'
multi-occur function --- it searches for (and displays) all lines
containing a given regexp in one's agenda files.[1]

Simply type:

C-c a / [regexp]

E.g.

C-c a / \(org\|org-\)mode


Best,
Matt

Footnotes:

[1] (info "(org) Agenda dispatcher")

,----
| `/'
|      Search for a regular expression in all agenda files and
|      additionally in the files listed in
|      `org-agenda-text-search-extra-files'.  This uses the Emacs command
|      `multi-occur'.  A prefix argument can be used to specify the
|      number of context lines for each match, default is 1.
`----

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Search files in a folder
  2010-09-13  1:51   ` Matt Lundin
@ 2010-09-13  4:09     ` 노정태
  2010-09-13  4:22       ` suvayu ali
  0 siblings, 1 reply; 10+ messages in thread
From: 노정태 @ 2010-09-13  4:09 UTC (permalink / raw)
  To: Matt Lundin, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1508 bytes --]

Thank you everyone.

I learned I could do it with grep, but I don't know how to use grep
properly.

Isn't there no way to search files which are not agenda file?

Sincerely, Jeongtae

2010/9/13 Matt Lundin <mdl@imapmail.org>

> Eric S Fraga <ucecesf@ucl.ac.uk> writes:
>
> > On Mon, 13 Sep 2010 04:11:48 +0900, 노정태 <basil83@gmail.com> wrote:
> >
> >> I want to search org files in my /org folder.
> >> But I can't find a command to search files wholly.
> >> C-c a s (org-search-view) does search only with headline.
> >> I can't search the contents of my org files with just one command.
> >>
> >> Does Org-mode have the function what I'm looking for?
> >
> > maybe org-mode does not but of course emacs does: M-x grep RET
> > or M-x occur RET
> >
>
> These work just fine. Org-mode also has a built-in interface to emacs'
> multi-occur function --- it searches for (and displays) all lines
> containing a given regexp in one's agenda files.[1]
>
> Simply type:
>
> C-c a / [regexp]
>
> E.g.
>
> C-c a / \(org\|org-\)mode
>
>
> Best,
> Matt
>
> Footnotes:
>
> [1] (info "(org) Agenda dispatcher")
>
> ,----
> | `/'
> |      Search for a regular expression in all agenda files and
> |      additionally in the files listed in
> |      `org-agenda-text-search-extra-files'.  This uses the Emacs command
> |      `multi-occur'.  A prefix argument can be used to specify the
> |      number of context lines for each match, default is 1.
> `----
>
>
>

[-- Attachment #1.2: Type: text/html, Size: 2196 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: Search files in a folder
  2010-09-13  4:09     ` 노정태
@ 2010-09-13  4:22       ` suvayu ali
  2010-09-13  7:15         ` 노정태
  0 siblings, 1 reply; 10+ messages in thread
From: suvayu ali @ 2010-09-13  4:22 UTC (permalink / raw)
  To: 노정태; +Cc: org-mode mailing list

2010/9/12 노정태 <basil83@gmail.com>:
> Thank you everyone.
>
> I learned I could do it with grep, but I don't know how to use grep
> properly.
>

grep is one of my favourite *nix tools. :)

You can try invoking grep in many ways. these are my most used options,

1. simply search for a regex and show results.
    grep -nH -E <regex> <wildcard_to_match files>
2. search for results and show results with context
    grep -nHB <number> -E <regex> <wildcard_to_match files>
    # context lines before matching lines
    grep -nHA <number> -E <regex> <wildcard_to_match files>
    # context lines after matching lines
    grep -nHC <number> -E <regex> <shell_wildcard_to_match files>
    # context lines from both before and after matching lines
3. You can try `M-x find-grep' if you want more control over what file
you want to search
    find -type f -name <shell_wildcard_to_match_files> -print0 | xargs
-0 grep -nH -E <regex>

Note: find and grep regex are a little different from emacs regex
because of some quoting differences. 'man grep' is your friend.

GL :)

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: Search files in a folder
  2010-09-13  4:22       ` suvayu ali
@ 2010-09-13  7:15         ` 노정태
  2010-09-13 16:19           ` Matt Lundin
  0 siblings, 1 reply; 10+ messages in thread
From: 노정태 @ 2010-09-13  7:15 UTC (permalink / raw)
  To: suvayu ali, emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1656 bytes --]

Suvayu, I read your comment, and googled about what I can't understand.

In Emacs, M-x grep <RET> Filename * <RET> does what I want. Thank you.

And now, I want to make it as one elisp command.

What should I do? Can anybody write a simple script?

Sincerely, Jeongtae.


suvayu ali <fatkasuvayu+linux@gmail.com <fatkasuvayu%2Blinux@gmail.com>>
2010/9/13 suvayu ali <fatkasuvayu+linux@gmail.com<fatkasuvayu%2Blinux@gmail.com>
>

> 2010/9/12 노정태 <basil83@gmail.com>:
> > Thank you everyone.
> >
> > I learned I could do it with grep, but I don't know how to use grep
> > properly.
> >
>
> grep is one of my favourite *nix tools. :)
>
> You can try invoking grep in many ways. these are my most used options,
>
> 1. simply search for a regex and show results.
>    grep -nH -E <regex> <wildcard_to_match files>
> 2. search for results and show results with context
>    grep -nHB <number> -E <regex> <wildcard_to_match files>
>    # context lines before matching lines
>    grep -nHA <number> -E <regex> <wildcard_to_match files>
>    # context lines after matching lines
>    grep -nHC <number> -E <regex> <shell_wildcard_to_match files>
>    # context lines from both before and after matching lines
> 3. You can try `M-x find-grep' if you want more control over what file
> you want to search
>    find -type f -name <shell_wildcard_to_match_files> -print0 | xargs
> -0 grep -nH -E <regex>
>
> Note: find and grep regex are a little different from emacs regex
> because of some quoting differences. 'man grep' is your friend.
>
> GL :)
>
> --
> Suvayu
>
> Open source is the future. It sets us free.
>

[-- Attachment #1.2: Type: text/html, Size: 2333 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Search files in a folder
  2010-09-13  7:15         ` 노정태
@ 2010-09-13 16:19           ` Matt Lundin
  2010-09-14 16:06             ` 노정태
  2010-09-20  8:31             ` Bastien
  0 siblings, 2 replies; 10+ messages in thread
From: Matt Lundin @ 2010-09-13 16:19 UTC (permalink / raw)
  To: 노정태; +Cc: emacs-orgmode

노정태 <basil83@gmail.com> writes:

> Suvayu, I read your comment, and googled about what I can't understand.
>
> In Emacs, M-x grep <RET> Filename * <RET> does what I want. Thank you.
>
> And now, I want to make it as one elisp command.
>
> What should I do? Can anybody write a simple script?

FWIW, here's my elisp function to search all my org files with lgrep:

--8<---------------cut here---------------start------------->8---
  (defun my-org-grep (search &optional context)
    "Search for word in org files. 

Prefix argument determines number of lines."
    (interactive "sSearch for: \nP")
    (let ((grep-find-ignored-files '("#*" ".#*"))
	  (grep-template (concat "grep <X> -i -nH " 
				 (when context
				   (concat "-C" (number-to-string context)))
				 " -e <R> <F>")))
      (lgrep search "*org*" "/home/matt/org/")))

  (global-set-key (kbd "<f8>") 'my-org-grep)
--8<---------------cut here---------------end--------------->8---

A prefix argument (e.g., C-u 3 <f8>) will change the number of
contextual lines pulled up by the search.

Best,
Matt

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Search files in a folder
  2010-09-13 16:19           ` Matt Lundin
@ 2010-09-14 16:06             ` 노정태
  2010-09-20  8:31             ` Bastien
  1 sibling, 0 replies; 10+ messages in thread
From: 노정태 @ 2010-09-14 16:06 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1399 bytes --]

Wow, It works like a magic! Thank you so much.

I wrote it to my .emacs. Thank you.

Sincerely, Jeongtae



2010/9/14 Matt Lundin <mdl@imapmail.org>

> 노정태 <basil83@gmail.com> writes:
>
> > Suvayu, I read your comment, and googled about what I can't understand.
> >
> > In Emacs, M-x grep <RET> Filename * <RET> does what I want. Thank you.
> >
> > And now, I want to make it as one elisp command.
> >
> > What should I do? Can anybody write a simple script?
>
> FWIW, here's my elisp function to search all my org files with lgrep:
>
> --8<---------------cut here---------------start------------->8---
>  (defun my-org-grep (search &optional context)
>    "Search for word in org files.
>
> Prefix argument determines number of lines."
>    (interactive "sSearch for: \nP")
>    (let ((grep-find-ignored-files '("#*" ".#*"))
>          (grep-template (concat "grep <X> -i -nH "
>                                 (when context
>                                   (concat "-C" (number-to-string context)))
>                                 " -e <R> <F>")))
>      (lgrep search "*org*" "/home/matt/org/")))
>
>  (global-set-key (kbd "<f8>") 'my-org-grep)
> --8<---------------cut here---------------end--------------->8---
>
> A prefix argument (e.g., C-u 3 <f8>) will change the number of
> contextual lines pulled up by the search.
>
> Best,
> Matt
>

[-- Attachment #1.2: Type: text/html, Size: 2361 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Re: Search files in a folder
  2010-09-13 16:19           ` Matt Lundin
  2010-09-14 16:06             ` 노정태
@ 2010-09-20  8:31             ` Bastien
  1 sibling, 0 replies; 10+ messages in thread
From: Bastien @ 2010-09-20  8:31 UTC (permalink / raw)
  To: Matt Lundin; +Cc: emacs-orgmode, 노정태

Matt Lundin <mdl@imapmail.org> writes:

> FWIW, here's my elisp function to search all my org files with lgrep:

Nice - I added an entry about this in org-hacks.org.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-09-20  8:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-12 19:11 Search files in a folder 노정태
2010-09-12 19:31 ` Eric S Fraga
2010-09-12 20:29   ` suvayu ali
2010-09-13  1:51   ` Matt Lundin
2010-09-13  4:09     ` 노정태
2010-09-13  4:22       ` suvayu ali
2010-09-13  7:15         ` 노정태
2010-09-13 16:19           ` Matt Lundin
2010-09-14 16:06             ` 노정태
2010-09-20  8:31             ` Bastien

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.