From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thorsten Jolitz Subject: Re: A simple way to search only headlines Date: Tue, 11 Jun 2013 16:42:28 +0200 Message-ID: <87zjuwhfor.fsf@gmail.com> References: <86y5arocrz.fsf@somewhere.org> <86k3mae2mo.fsf@somewhere.org> <87mwr1egjr.fsf@berkeley.edu> <87ip1pkwco.fsf@pierrot.dokosmarshall.org> <86bo7e4dww.fsf@somewhere.org> <87d2ruktd0.fsf@pierrot.dokosmarshall.org> <86txl60zy5.fsf@somewhere.org> <87bo7di7zf.fsf@pierrot.dokosmarshall.org> <20130611122757.GB18792@kuru.dyndns-at-home.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmPmc-0002Tq-E0 for emacs-orgmode@gnu.org; Tue, 11 Jun 2013 10:42:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UmPmZ-0004YE-KG for emacs-orgmode@gnu.org; Tue, 11 Jun 2013 10:42:50 -0400 Received: from plane.gmane.org ([80.91.229.3]:51910) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmPmZ-0004Y0-AP for emacs-orgmode@gnu.org; Tue, 11 Jun 2013 10:42:47 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UmPmT-0000ez-GX for emacs-orgmode@gnu.org; Tue, 11 Jun 2013 16:42:41 +0200 Received: from g231227170.adsl.alicedsl.de ([92.231.227.170]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Jun 2013 16:42:41 +0200 Received: from tjolitz by g231227170.adsl.alicedsl.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Jun 2013 16:42:41 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Suvayu Ali 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