all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to add prefix before running interactive regexp  search(isearch-forward-regexp)?
@ 2010-04-22 14:47 filebat Mark
  2010-04-22 15:06 ` Peter Dyballa
  2010-04-23 18:05 ` How to add prefix before running interactive regexp search(isearch-forward-regexp)? Juri Linkov
  0 siblings, 2 replies; 4+ messages in thread
From: filebat Mark @ 2010-04-22 14:47 UTC (permalink / raw)
  To: help-gnu-emacs

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

Hi emacsers

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?

-- 
Thanks & Regards

Denny Zhang

[-- Attachment #2: Type: text/html, Size: 580 bytes --]

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

* Re: How to add prefix before running interactive regexp search(isearch-forward-regexp)?
  2010-04-22 14:47 How to add prefix before running interactive regexp search(isearch-forward-regexp)? filebat Mark
@ 2010-04-22 15:06 ` Peter Dyballa
  2010-04-22 16:01   ` How to add prefix before running interactive regexpsearch(isearch-forward-regexp)? Drew Adams
  2010-04-23 18:05 ` How to add prefix before running interactive regexp search(isearch-forward-regexp)? Juri Linkov
  1 sibling, 1 reply; 4+ messages in thread
From: Peter Dyballa @ 2010-04-22 15:06 UTC (permalink / raw)
  To: filebat Mark; +Cc: help-gnu-emacs


Am 22.04.2010 um 16:47 schrieb filebat Mark:

> Do you have any suggestions?

Store that "prefix" in registers for easy insertion, re-use elder reg- 
exp's and edit them.

--
Greetings

   Pete

We are usually convinced more easily by reasons we have found  
ourselves than by those which have occurred to others.
				– Blaise Pascal





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

* RE: How to add prefix before running interactive regexpsearch(isearch-forward-regexp)?
  2010-04-22 15:06 ` Peter Dyballa
@ 2010-04-22 16:01   ` Drew Adams
  0 siblings, 0 replies; 4+ messages in thread
From: Drew Adams @ 2010-04-22 16:01 UTC (permalink / raw)
  To: 'Peter Dyballa', 'filebat Mark'; +Cc: help-gnu-emacs

> Store that "prefix" in registers for easy insertion

Or copy the string to the kill-ring and then yank it into Isearch using `M-y'.

Or copy it as the secondary selection and yank it using `C-M-y'. (You need
library second-sel.el for this.) The secondary selection doesn't get overwritten
when you update the clipboard or the kill ring.

http://www.emacswiki.org/emacs/SecondarySelection





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

* Re: How to add prefix before running interactive regexp search(isearch-forward-regexp)?
  2010-04-22 14:47 How to add prefix before running interactive regexp search(isearch-forward-regexp)? filebat Mark
  2010-04-22 15:06 ` Peter Dyballa
@ 2010-04-23 18:05 ` Juri Linkov
  1 sibling, 0 replies; 4+ messages in thread
From: Juri Linkov @ 2010-04-23 18:05 UTC (permalink / raw)
  To: help-gnu-emacs

> 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/





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

end of thread, other threads:[~2010-04-23 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-22 14:47 How to add prefix before running interactive regexp search(isearch-forward-regexp)? filebat Mark
2010-04-22 15:06 ` Peter Dyballa
2010-04-22 16:01   ` How to add prefix before running interactive regexpsearch(isearch-forward-regexp)? Drew Adams
2010-04-23 18:05 ` How to add prefix before running interactive regexp search(isearch-forward-regexp)? Juri Linkov

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.