From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Kamphausen Newsgroups: gmane.emacs.help Subject: Re: highlight all lines with a certain prefix Date: Tue, 07 Jul 2009 08:17:10 +0200 Organization: Church of Emacs Message-ID: <87k52luie1.fsf@usenet.my.skamphausen.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1246950691 22781 80.91.229.12 (7 Jul 2009 07:11:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 7 Jul 2009 07:11:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jul 07 09:11:24 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MO4oW-0007WQ-QO for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Jul 2009 09:10:05 +0200 Original-Received: from localhost ([127.0.0.1]:48510 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MO4oW-0005tj-2C for geh-help-gnu-emacs@m.gmane.org; Tue, 07 Jul 2009 03:10:04 -0400 Original-Path: news.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed2.telusplanet.net!newsfeed.telus.net!feeder.erje.net!news.musoftware.de!wum.musoftware.de!news.albasani.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 Original-X-Trace: news.albasani.net U9MGL2K90jIN+J1yFH18DtzdnUsNoo+tllD4MlETmtXW86NhtmHRph1OxR/kjMpe5Bielk3MggEGskbwoL77Wx/JXaUGd8RhsZfvh4LgifDYW1rFrVv4gJJuRsJOzso6 Original-X-Complaints-To: abuse@albasani.net Original-NNTP-Posting-Date: Tue, 7 Jul 2009 06:19:26 +0000 (UTC) X-User-ID: mZtr6Zywxk/fCEesqs6u7TbGuBk6i4FXq9bKgM33+7Q= Cancel-Lock: sha1:WLlb0dVZX1u3nSWPSzUcrJi3BFA= sha1:2MPphk/lBkCTlUKqi5SK64NpPlE= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) X-NNTP-Posting-Host: zgsF3zOG3b9wNJOokymdiIqrcqMolOxUEyXaa9ddxi8= Original-Xref: news.stanford.edu gnu.emacs.help:170608 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:65810 Archived-At: Hi, n179911 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.