[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: highlight all lines with a certain prefix
From: |
Stefan Kamphausen |
Subject: |
Re: highlight all lines with a certain prefix |
Date: |
Tue, 07 Jul 2009 08:17:10 +0200 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
Hi,
n179911 <n179911@gmail.com> writes:
> 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?
first consider the regexp: ^[ ]*-
That is the beginning of a line (^) followed by a space (here rather
inelegantly represented as a group, [ ]) zero or more times (*),
followed by a dash (-).
Personally I'd use this regexp in occur which pops up a new buffer which
I can use to get an overview and to navigate to the matching lines:
M-x occur ABOVE_REGEXP RET
In your case it sounds more like highlight-lines-matching-regexp:
M-x highlight-lines-matching-regexp ABOVE_REGEXP RET RET
BTW: Just typing M-x highlight-TAB would have given you a hint.
Cheers,
Stefan
--
Stefan Kamphausen --- http://www.skamphausen.de
a blessed +42 regexp of confusion (weapon in hand)
You hit. The format string crumbles and turns to dust.