all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Regex Expression for syntax highlight between delimiters
@ 2006-02-12  5:40 Tim Johnson
  2006-02-12 18:45 ` Tim Johnson
       [not found] ` <mailman.159.1139769380.2858.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 5+ messages in thread
From: Tim Johnson @ 2006-02-12  5:40 UTC (permalink / raw)


Hello:
The following form is used to provide syntax highlighting for
a 'lisp variant. The regex expression for 'font-lock-string-face
doesn't work. The other forms do work as expected.
(cond (running-xemacs)  ;; Xemacs doesn't have 'font-lock-add-keywords
  (t
    (make-local-variable 'lisp-font-lock-keywords-tj)
    (defvar newlisp-font-lock-keywords-tj  ;; faces defined in 'extra-faces
    (list
      (list tj-newlisp-user-keywords '1 'font-lock-user-keyword-face)
      (list tj-newlisp-user-lib-keywords '1 'font-lock-user-lib-face)
      (list tj-newlisp-constant-keywords '1 'font-lock-constant-face)
      '("\\[text\\][^\"]*[.]*[^\"]*\\[/text\\]" 1 font-lock-string-face t) ;; This one doesn't work
      ) "Additional keywords and groups for lisp-mode")))
;; .......

The regex is meant to highlight the delimiters "[text]" & "[/text]" and
everything between (multi-line string literal). The regex itself was tested with re-builder, seems
to work there. 

Can anyone tell me what else I need to do here? 

TIA
tim

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

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

* Re: Regex Expression for syntax highlight between delimiters
  2006-02-12  5:40 Regex Expression for syntax highlight between delimiters Tim Johnson
@ 2006-02-12 18:45 ` Tim Johnson
  2006-02-13 17:07   ` Kevin Rodgers
       [not found] ` <mailman.159.1139769380.2858.help-gnu-emacs@gnu.org>
  1 sibling, 1 reply; 5+ messages in thread
From: Tim Johnson @ 2006-02-12 18:45 UTC (permalink / raw)


* Tim Johnson <tim@johnsons-web.com> [060211 22:14]:
> Hello:
> The following form is used to provide syntax highlighting for
> a 'lisp variant. The regex expression for 'font-lock-string-face
> doesn't work. The other forms do work as expected.
> (cond (running-xemacs)  ;; Xemacs doesn't have 'font-lock-add-keywords
>   (t
>     (make-local-variable 'lisp-font-lock-keywords-tj)
>     (defvar newlisp-font-lock-keywords-tj  ;; faces defined in 'extra-faces
>     (list
>       (list tj-newlisp-user-keywords '1 'font-lock-user-keyword-face)
>       (list tj-newlisp-user-lib-keywords '1 'font-lock-user-lib-face)
>       (list tj-newlisp-constant-keywords '1 'font-lock-constant-face)
>       '("\\[text\\][^\"]*[.]*[^\"]*\\[/text\\]" 1 font-lock-string-face t) ;; This one doesn't work
>       ) "Additional keywords and groups for lisp-mode")))
> ;; .......
> 
> The regex is meant to highlight the delimiters "[text]" & "[/text]" and
> everything between (multi-line string literal). The regex itself was tested with re-builder, seems
> to work there. 
> 
> Can anyone tell me what else I need to do here? 
 
  Okay. I fixed this one. 
  [^#]\\(\\[text\\][^{}]*\\[/text\\]\\) 
  is the regex that I need. 
  But comments are still welcome...
  tim


-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

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

* Re: Regex Expression for syntax highlight between delimiters
       [not found] ` <mailman.159.1139769380.2858.help-gnu-emacs@gnu.org>
@ 2006-02-12 20:59   ` Stefan Monnier
  2006-02-13 16:17     ` Tim Johnson
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2006-02-12 20:59 UTC (permalink / raw)


>   Okay. I fixed this one. 
>   [^#]\\(\\[text\\][^{}]*\\[/text\\]\\) 
>   is the regex that I need. 
>   But comments are still welcome...

Better use font-lock-syntactic-keywords to mark [text] and [/text] as string
starter and string ender respectively.  At least, if multi-line strings
are important.


        Stefan

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

* Re: Regex Expression for syntax highlight between delimiters
  2006-02-12 20:59   ` Stefan Monnier
@ 2006-02-13 16:17     ` Tim Johnson
  0 siblings, 0 replies; 5+ messages in thread
From: Tim Johnson @ 2006-02-13 16:17 UTC (permalink / raw)


* Stefan Monnier <monnier@iro.umontreal.ca> [060212 12:37]:
> >   Okay. I fixed this one. 
> >   [^#]\\(\\[text\\][^{}]*\\[/text\\]\\) 
> >   is the regex that I need. 
> >   But comments are still welcome...
> 
> Better use font-lock-syntactic-keywords to mark [text] and [/text] as string
> starter and string ender respectively.  At least, if multi-line strings
> are important.
 
  They are. Will do.
  Thanks Stefan.
  tj

> 
>         Stefan
> _______________________________________________
> help-gnu-emacs mailing list
> help-gnu-emacs@gnu.org
> http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

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

* Re: Regex Expression for syntax highlight between delimiters
  2006-02-12 18:45 ` Tim Johnson
@ 2006-02-13 17:07   ` Kevin Rodgers
  0 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2006-02-13 17:07 UTC (permalink / raw)


Tim Johnson wrote:
>   Okay. I fixed this one. 
>   [^#]\\(\\[text\\][^{}]*\\[/text\\]\\) 
>   is the regex that I need. 
>   But comments are still welcome...

Instead of:

(cond (running-xemacs)  ;; Xemacs doesn't have 'font-lock-add-keywords
       (t ...))

Do this:

(when (fboundp 'font-lock-add-keywords)
   ...)

-- 
Kevin Rodgers

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

end of thread, other threads:[~2006-02-13 17:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-12  5:40 Regex Expression for syntax highlight between delimiters Tim Johnson
2006-02-12 18:45 ` Tim Johnson
2006-02-13 17:07   ` Kevin Rodgers
     [not found] ` <mailman.159.1139769380.2858.help-gnu-emacs@gnu.org>
2006-02-12 20:59   ` Stefan Monnier
2006-02-13 16:17     ` Tim Johnson

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.