emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thorsten Jolitz <tjolitz@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: A simple way to search only headlines
Date: Tue, 11 Jun 2013 16:42:28 +0200	[thread overview]
Message-ID: <87zjuwhfor.fsf@gmail.com> (raw)
In-Reply-To: 20130611122757.GB18792@kuru.dyndns-at-home.com

Suvayu Ali <fatkasuvayu+linux@gmail.com> 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	other threads:[~2013-06-11 14:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01 16:35 A simple way to search only headlines Xebar Saram
2013-06-01 20:10 ` Tassilo Horn
2013-06-03  7:48   ` Sebastien Vauban
2013-06-03 12:16     ` Xebar Saram
2013-06-04  7:18       ` Thorsten Jolitz
2013-06-04  7:50       ` Sebastien Vauban
2013-06-07 20:31         ` Xebar Saram
2013-06-07 21:50           ` Richard Lawrence
2013-06-08  0:05             ` Xebar Saram
2013-06-08  0:34               ` Richard Lawrence
2013-06-08  5:25             ` Nick Dokos
2013-06-10  7:34               ` Sebastien Vauban
2013-06-10 13:06                 ` Nick Dokos
2013-06-10 15:04                   ` Sebastien Vauban
2013-06-11  4:31                     ` Nick Dokos
2013-06-11 12:27                       ` Suvayu Ali
2013-06-11 14:42                         ` Thorsten Jolitz [this message]
2013-06-11 22:01                           ` Suvayu Ali
2013-06-11 23:55                             ` Thorsten Jolitz

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=87zjuwhfor.fsf@gmail.com \
    --to=tjolitz@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).