[Top][All Lists]

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

Font-lock with newcomment.el

From: David C Sterratt
Subject: Font-lock with newcomment.el
Date: 29 May 2003 17:07:16 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Portable Code)

I'm writing a mode for the HOC language used by the neuron simulator
(see for details of the

The mode was written under XEmacs, and now I'm trying to make it work
with gnu emacs.  The mode has C++/C style comments.  Everything seems
to work apart from the // form of comment syntax highlighting.  Under
XEmacs, the nrnhoc-mode definition appended at the end seemed
sufficient to get the font-locking of //-style comments working (I've
commented out values of comment-start and comment-start-skip that I
also tried with gnu emacs, following their values in c++ mode.)

I notice that comment-start and friends are defined in newcomment.el
in gnu emacs as opposed to simple.el in xemacs.  But it's not clear
from these files how the variables comment-start &c set up the
font-locking.  I'd be very grateful if someone could tell me whether
there some extra code I need to get font-locking working in gnu emacs.

Best wishes,


(defun nrnhoc-mode ()
  "NRNHOC-mode is a major mode for editing Neuron HOC dot-hoc files.

  `nrnhoc-indent-level'                Level to indent blocks.
  `nrnhoc-comment-column'                    The goal comment column
  `fill-column'                            Column used in auto-fill.
  `nrnhoc-return-function'           Customize RET handling with this function
  `nrnhoc-closing-brace-function' Customize } handling with this function

All Key Bindings:
  (use-local-map nrnhoc-mode-map)
  (setq major-mode 'nrnhoc-mode)
  (setq mode-name "Hoc")
  (make-local-variable 'indent-line-function)
  (setq indent-line-function 'nrnhoc-indent-line)
  (make-local-variable 'comment-start-skip)
  (setq comment-start-skip "//\\s-+")
  ;(setq comment-start-skip "/\\*+ *\\|//+ *")
  (make-local-variable 'comment-start)
  (setq comment-start "//")
  ;(setq comment-start "// ")
  (make-local-variable 'comment-column)
  (setq comment-column nrnhoc-comment-column)
  (make-local-variable 'font-lock-defaults)
  (setq font-lock-defaults '((nrnhoc-font-lock-keywords)
                             nil ; do not do string/comment highlighting
                             nil ; keywords are case sensitive.
                             ;; This puts _ as a word constituent,
                             ;; simplifying our keywords significantly
                             ((?_ . "w")
                              (?\n . "> b")
                              (?/ . ". 1456")
                              (?* . ". 23")
                              (?\^m . "> b")
  (run-hooks 'nrnhoc-mode-hook)

reply via email to

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