Re: Highlight all lines that begin with a "*"

David E <[email protected]> Tue, 17 Feb 2004 15:06:32 +0200
Newsgroups gmane.emacs.xemacs.general
Message-ID <20040217130632.GC25973@Narsil>
Thank you for the fast response, I tried both ways, but it's not
really what I'm looking for, How can I font-lock it? 
(I'm just using the text-mode with the files i need this feature in 
so it probably won't do any problems).

The reason I need this thing is this: I keep my data (to-do lists,
Linux-info, general-info, etc..) in text files, within the text files,
I separate the subjects using lines that begin with a "*", until now
I've used vim, where I just had these two lines: 

  syn region MyHeader start="^*" skip="\\$" end="$" keepend
  hi MyHeader gui=none guifg=yellow ctermfg=yellow

After moving to xemacs, I've started to miss this feature, and I'm
looking for a way to make this work on xemacs too (I know it's
possible, but it's just too complicated for a newbie like me to
implement, so after roaming google with no success I decided to 
come here for help).

Thanks and Best Regards,
  David.

On 13:04 Tue 17 Feb     , Stephen J. Turnbull wrote:
> In lisp you could do
> 
> (save-excursion
>   (goto-char (point-min))
>   (while (re-search-forward "^\\*.*$" nil t)
>     (set-extent-face (make-extent (match-beginning 0) (match-end 0))
>                      'highlight)))
> 
> which would be very permanent (there's no simple way to restore the
> previous state).  Or you could use font-lock to do it, but that might
> interfere with your major mode.
> 
> 
> -- 
> Institute of Policy and Planning Sciences     http://turnbull.sk.tsukuba.ac.jp
> University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
>                Ask not how you can "do" free software business;
>               ask what your business can "do for" free software.