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

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

Re: Font-lock with newcomment.el


From: David C Sterratt
Subject: Re: Font-lock with newcomment.el
Date: 30 May 2003 16:20:28 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>>>>> Stefan Monnier writes:

 >> (setq font-lock-defaults `((nnrnhoc-font-lock-keywords) nil nil
 >> ((?_ . "w") (?\n . "> b") (?/ . ,(if (string-match "XEmacs"
 >> (emacs-version)) ". 1456" ". 124b")) (?* . ". 23") (?\^m . ">
 >> b"))))

 > BTW, setting your syntax-table this way is probably not a good idea
 > because it will only affect font-locking whereas I suspect that you
 > might want the rest of Emacs to know about those comments as well
 > (newcomment.el for example uses the syntax-table (in place of and
 > in addition to comment-start/end)) so it's better to properly setup
 > your major mode's syntax-table.

Thanks for the advice.  The new version looks like this.  
 
  (setq font-lock-defaults '((nrnhoc-font-lock-keywords)
                             nil ; do not do string/comment highlighting
                             nil ; keywords are case sensitive.
                             nil
                             ))
  (modify-syntax-entry ?_  "w")
  (modify-syntax-entry ?\n  "> b")
  (modify-syntax-entry ?/  (
                            if (string-match "XEmacs" (emacs-version))
                               ". 1456"
                             ". 124b"))
  (modify-syntax-entry ?*  ". 23")
  (modify-syntax-entry ?\^m  "> b")

Much prettier.  And it seems to work too.
   
 > Oh, and David, regarding your mode: do a C-h f looking-at, that
 > will save you a bunch of buffer-substrings.

Thanks for looking at the code.  From the looking-at documentation,
it seems like it only matches regexps after the point, whereas in the
current way of doing indentation I need to match symbols anywhere in
the line, in most cases at least.  So it's not clear to me how
looking-at will help, unless I rethink the indentation code.  
 
David



reply via email to

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