This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: 'md' major mode for Emacs



Gary Thomas <g.thomas@opengroup.org> writes:

> Does anyone out there have a Emacs major mode description for GCC 'md'
> files?  With all the machine description editing (?) surely there is.

There used to be some local-variables sections in some md files.
Since I (then) always ignored local-variables sections, but this stuff
looked reasonable, I pulled it out and made a mode.  It doesn't amount
to much -- an auto-mode-alist hook and this code:

(defvar md-mode-syntax-table nil)
(defun md-mode nil
  (interactive)
  (emacs-lisp-mode)
  (setq major-mode 'md-mode)
  (setq mode-name "MD")
  (if md-mode-syntax-table
      (set-syntax-table md-mode-syntax-table)
    (set-syntax-table (copy-sequence (syntax-table)))
    (modify-syntax-entry ?[ "(]")
    (modify-syntax-entry ?] ")[")
    (modify-syntax-entry ?{ "(}")
    (modify-syntax-entry ?} "){")
    (setq md-mode-syntax-table (syntax-table))))

It works for me, but I think ordinary emacs-lisp mode would work about
as well.

If you want to write some spiffy mode that can switch between elisp
and c modes depending on context (e.g., for indentation rules, using C
rules inside strings and elisp rules outside), that would be
fantastic.  I don't know of such a thing.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]