[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to add prefix before running interactive regexp search(isearch-f
From: |
Juri Linkov |
Subject: |
Re: How to add prefix before running interactive regexp search(isearch-forward-regexp)? |
Date: |
Fri, 23 Apr 2010 21:05:37 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) |
> I usually need to search only in the headings of org-mode file, with the
> content of entries excluded.
> For example, searching string of "org-mode", I used to type:
> isearch-forward-regexp: ^\*.*org-mode, times and times again.
>
> As you can see, I type the prefix of "^\*.*" many times, when performing
> interactive regexp search.
> I have checked isearch.el for some while, but I haven't find a clue to
> define prefix before search.
>
> Do you have any suggestions?
(add-hook 'isearch-mode-hook
(lambda ()
(if (eq major-mode 'org-mode)
(set (make-local-variable 'isearch-filter-predicate)
(lambda (beg end)
(save-excursion
(beginning-of-line)
(looking-at-p "^\\*"))))))
nil t)
--
Juri Linkov
http://www.jurta.org/emacs/