all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Font-lock with newcomment.el
@ 2003-05-29 16:07 David C Sterratt
  2003-05-29 17:22 ` lawrence mitchell
  2003-05-29 17:31 ` Stefan Monnier
  0 siblings, 2 replies; 11+ messages in thread
From: David C Sterratt @ 2003-05-29 16:07 UTC (permalink / raw)


I'm writing a mode for the HOC language used by the neuron simulator
(see http://www.anc.ed.ac.uk/~dcs/progs/neuron/ for details of the
mode).  

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,

David



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

Variables:
  `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:
\\{nrnhoc-mode-map}"
  (interactive)
  (kill-all-local-variables)
  (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)
  )

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

end of thread, other threads:[~2003-06-02 10:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-29 16:07 Font-lock with newcomment.el David C Sterratt
2003-05-29 17:22 ` lawrence mitchell
2003-05-29 17:31 ` Stefan Monnier
2003-05-30 11:12   ` David C Sterratt
2003-05-30 11:45     ` lawrence mitchell
2003-05-30 13:57       ` Stefan Monnier
2003-05-30 15:20         ` David C Sterratt
2003-05-30 16:23           ` Kevin Rodgers
2003-06-02 10:06             ` David C Sterratt
2003-05-30 16:34           ` Stefan Monnier
2003-05-30 15:02       ` David C Sterratt

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.