emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] A simple way to search only headlines


From: Thorsten Jolitz
Subject: Re: [O] A simple way to search only headlines
Date: Tue, 11 Jun 2013 16:42:28 +0200
User-agent: Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux)

Suvayu Ali <address@hidden> writes:

> I wonder if semantic search can be leveraged to achieve the same.  It
> might open other possibilities: searching only links, list items, source
> blocks, ...  I think you get the point.  :-p

navi-mode.el works for Org-mode buffers too, e.g. using 

,---------------------------------
| worg/org-contrib/babel/intro.org
`---------------------------------

as an sufficiently complex example file, the following simple
keybindings yield the following search results in the *Navi* buffer:

command (show headlines up to level 2):
,--
| 2
`--

result:
,--------------------------------------------------------------
| 28 matches for "^\*\*? " in buffer: intro.org
|      14:* Improving this document                  :noexport:
|      15:** DONE Document slice indexing of tables
|      16:** DONE Document synonymous alternatives
|      18:** DONE Describe useful functions
|      22:** DONE Language support
|      27:** DONE Document noweb references
|      29:** TODO Developments
|      55:** DONE Useful variables
|      57:** TODO Language specific header arguments
|     127:** DONE What function is bound to C-c '?
|     129:* Introduction
|     153:* Overview
|     179:* Initial Configuration
|     203:* Code Blocks
|     208:** Code Blocks in Org
|     241:** Code Blocks in Babel
|     268:* Source Code Execution
|     360:** Capturing the Results of Code Evaluation
|     429:** Session-based Evaluation
|     453:** Arguments to Code Blocks
|     539:** In-line Code Blocks
|     546:** Code Block Body Expansion
|     593:** A Meta-programming Language for Org-mode
|     652:* Using Code Blocks in Org Tables
|     842:* The Library of Babel
|     886:* Literate Programming
|    1098:* Reproducible Research
|    1136:* Footnotes
`--------------------------------------------------------------

command (show source-code blocks):
,--
| b
`--

result:

,-------------------------------------------------------------------------------
| 30 matches for [long regexp] in buffer:intro.org
| 
|      93:#+begin_src python :file outfile.txt
|     225:#+begin_src org
|     234:#+begin_src org
|     249:#+begin_src org
|     289:#+begin_src ruby
|     304:#+begin_src sh
|     322:#+begin_src R :colnames yes
|     346:#+begin_src ditaa :file blue.png :cmdline -r
|     385:#+begin_src python :results value
|     414:#+begin_src python :results output
|     469:#+begin_src python
|     512:#+begin_src emacs-lisp
|     579:#+begin_src emacs-lisp :rownames yes :var data=user-data
|     585:#+begin_src emacs-lisp
|     647:#+begin_src R :session R-pie-example :file ../../images/babel/dirs.png
|     696:#+begin_src R 
|     776:#+begin_src emacs-lisp
|     788:#+begin_src sh :results silent
|     800:#+begin_src sh :results silent
|     812:#+begin_src ruby :results silent
|     824:#+begin_src python :results silent
|     837:#+begin_src R :results silent
|     878:  #+begin_src emacs-lisp 
|     950:#+begin_src sh :exports none
|     962:#+begin_src sh :exports none
|     983:#+begin_src sh :tangle hello.sh :exports none :noweb yes
|     994:#+begin_src sh 
|    1051:   #+begin_src sh 
|    1056:   #+begin_src sh
|    1065:   #+begin_src emacs-lisp 
`-------------------------------------------------------------------------------

command (show headlines up to level 2 and source-code blocks):

,------
| C-2 b
`------

result:

,-------------------------------------------------------------------------------
| 58 matches for [long regexp] in buffer:intro.org
| 
|      14:* Improving this document                  :noexport:
|      15:** DONE Document slice indexing of tables
|      16:** DONE Document synonymous alternatives
|      18:** DONE Describe useful functions
|      22:** DONE Language support
|      27:** DONE Document noweb references
|      29:** TODO Developments
|      55:** DONE Useful variables
|      57:** TODO Language specific header arguments
|      93:#+begin_src python :file outfile.txt
|     127:** DONE What function is bound to C-c '?
|     129:* Introduction
|     153:* Overview
|     179:* Initial Configuration
|     203:* Code Blocks
|     208:** Code Blocks in Org
|     225:#+begin_src org
|     234:#+begin_src org
|     241:** Code Blocks in Babel
|     249:#+begin_src org
|     268:* Source Code Execution
|     289:#+begin_src ruby
|     304:#+begin_src sh
|     322:#+begin_src R :colnames yes
|     346:#+begin_src ditaa :file blue.png :cmdline -r
|     360:** Capturing the Results of Code Evaluation
|     385:#+begin_src python :results value
|     414:#+begin_src python :results output
|     429:** Session-based Evaluation
|     453:** Arguments to Code Blocks
|     469:#+begin_src python
|     512:#+begin_src emacs-lisp
|     539:** In-line Code Blocks
|     546:** Code Block Body Expansion
|     579:#+begin_src emacs-lisp :rownames yes :var data=user-data
|     585:#+begin_src emacs-lisp
|     593:** A Meta-programming Language for Org-mode
|     647:#+begin_src R :session R-pie-example :file ../../images/babel/dirs.png
|     652:* Using Code Blocks in Org Tables
|     696:#+begin_src R 
|     776:#+begin_src emacs-lisp
|     788:#+begin_src sh :results silent
|     800:#+begin_src sh :results silent
|     812:#+begin_src ruby :results silent
|     824:#+begin_src python :results silent
|     837:#+begin_src R :results silent
|     842:* The Library of Babel
|     878:  #+begin_src emacs-lisp 
|     886:* Literate Programming
|     950:#+begin_src sh :exports none
|     962:#+begin_src sh :exports none
|     983:#+begin_src sh :tangle hello.sh :exports none :noweb yes
|     994:#+begin_src sh 
|    1051:   #+begin_src sh 
|    1056:   #+begin_src sh
|    1065:   #+begin_src emacs-lisp 
|    1098:* Reproducible Research
|    1136:* Footnotes
`-------------------------------------------------------------------------------

These are the keyword searches implemented for Org-mode so far:

,------------------------------------------------
| [KEY] : [SEARCH]
| ================
|                         b : srcblock
|                         x : time
|                         I : inline-srcblock
|                         W : srcname-w-name
|                         M : multilineheader
|                         Y : priority
|                         T : target
|                         R : radiotarget
|                         D : drawer
|                         S : timestamp
|                         N : srcname
|                         U : result
|                         Z : result-w-name
|                         O : options
|                         P : propertydrawer
|                         A : deadline
|                         H : scheduled-time-hour
`------------------------------------------------

they can be combined with the headline searches [1..8], like e.g. 'C-4
D'. 

While the keyword searches for Emacs Lisp in navi-mode are quite
exhaustive and well defined, I did not invest too much work into the
searches for Org-mode, so there is room for improvement. Note that the
keybindings and the regexps are customizable (M-x customize-group RET
navi-mode RET), and that `navi-generic-command' binds all ASCII printing
characters by default.

Thus besides those keys used for navi-mode itself and those already used
in the keyword-searches shown above there are a lot one one-key commands
(keyword-searches) left to be defined by the user via the customizable
variables:

,------------------
| navi-key-mappings
| navi-keywords
`------------------

Any improvements or extensions of the keyword-searches for Org-mode
would be welcome, I'm sure there are more org-elements that people might
want to see listed for the org-buffer at hand. 

A nice thing about the *Navi* is that its plain text, so you can use
standard Emacs search commands to search in the
headlines/keyword-search-results. 

-- 
cheers,
Thorsten




reply via email to

[Prev in Thread] Current Thread [Next in Thread]