help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: highlight all lines with a certain prefix


From: tomas
Subject: Re: highlight all lines with a certain prefix
Date: Tue, 7 Jul 2009 08:54:34 +0200
User-agent: Mutt/1.5.15+20070412 (2007-04-11)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sun, Jul 05, 2009 at 11:13:04PM -0700, n179911 wrote:
> Hi,
> 
> In emacs, is there a way which highlight lines with certain prefix in a file?
> For example I want to highlight all lines with '-' or '     -' (a lot
> of spaces followed by a '-' of a file?

 1) Incremental search might be what you want. Hit C-s (Control key plus
    's'), type the string you are looking for. All matches within the
    window are highlighted while you type. If you hit C-s again, the
    current position is advanced to the next hit.

 2) If you want to see as many hits as possible, type M-x occur (Meta-x,
    where Meta is typically the Alt key, sometimes the ESC key), then
    the word 'occur' in the minibuffer, then <enter>. You are prompted
    for a regular expression, All hits are showed in a new window. Each
    hit is a link to the position in the original buffer.

As a variation to (1) there is "incremental regular expression search"
(look for "isearch-forward-regexp" and "isearch-backward-regexp" in the
docs).

HTH
- -- tomás
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFKUvEqBcgs9XrR2kYRArq0AJsGxCnKgAt3n+GbPJoyVhgq/uJBgACdFOrE
UPmKpiWZx+iaEaejJYb62dE=
=4Rhm
-----END PGP SIGNATURE-----




reply via email to

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