[Top][All Lists]

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

Re: Familiar with Emacs *programming* modes? Newbie concerns...

From: Alexandre Brillant
Subject: Re: Familiar with Emacs *programming* modes? Newbie concerns...
Date: Sun, 10 Mar 2002 11:42:20 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.6) Gecko/20011120

I have tested the last emacs version from CVS (, indeed the
cc-mode.el contains the c major mode definition and some declinaison :
- idl-mode (for CORBA interface)
- pike-mode (who know what is it ?)
- c-objc-mode
- c-c++-mode

Here below the only code for the java-mode. Looks a bit short not ?

;; Support for Java

(defvar java-mode-abbrev-table nil
 "Abbreviation table used in java-mode buffers.")
(define-abbrev-table 'java-mode-abbrev-table
 '(("else" "else" c-electric-continued-statement 0 t)
   ("while" "while" c-electric-continued-statement 0 t)
   ("catch" "catch" c-electric-continued-statement 0 t)
   ("finally" "finally" c-electric-continued-statement 0 t)))

(defvar java-mode-map ()
 "Keymap used in java-mode buffers.")
(if java-mode-map
 (setq java-mode-map (c-make-inherited-keymap))
 ;; add bindings which are only useful for Java

(easy-menu-define c-java-menu java-mode-map "Java Mode Commands"
         (c-mode-menu "Java"))

(defun java-mode ()
 "Major mode for editing Java code.
To submit a problem report, enter `\\[c-submit-bug-report]' from a
java-mode buffer.  This automatically sets up a mail buffer with
version information already added.  You just need to add a description
of the problem, including a reproducible test case and send the

To see what version of CC Mode you are running, enter `\\[c-version]'.

The hook variable `java-mode-hook' is run with no args, if that value
is bound and has a non-nil value.  Also the common hook
`c-mode-common-hook' is run first.  Note that this mode automatically
sets the \"java\" style before calling any hooks so be careful if you
set styles in `c-mode-common-hook'.

Key bindings:
 (set-syntax-table java-mode-syntax-table)
 (setq major-mode 'java-mode
    mode-name "Java"
    local-abbrev-table java-mode-abbrev-table
   abbrev-mode t
   c-append-paragraph-start c-Java-javadoc-paragraph-start)
 (use-local-map java-mode-map)
 (setq comment-start "// "
    comment-end   ""
   c-keywords (c-identifier-re c-Java-keywords)
    c-conditional-key c-Java-conditional-key
    c-comment-start-regexp c-Java-comment-start-regexp
     c-class-key c-Java-class-key
   c-method-key nil
    c-baseclass-key nil
   c-recognize-knr-p nil
   c-inexpr-class-key c-Java-inexpr-class-key
   ;defun-prompt-regexp c-Java-defun-prompt-regexp
 (cc-imenu-init cc-imenu-java-generic-expression)
 (run-hooks 'c-mode-common-hook)
 (run-hooks 'java-mode-hook)


Christian Seberino wrote:

I have been neglecting learning about other emacs modes
because they seemed complicated.  I was also
afraid that different "modes" would change
a lot of things I was comfortable with.

Have you had good experience with C-mode, C++-mode,
Java-mode, etc???  Are they easy to customize
and bend to your will??? I'd like to turn off some features
and turn on other features and create other features.

It seems one could make Java, C & C++ files all go into
the *same* emacs mode since syntax for all 3 are so *similar*.
I'm just afraid of emacs modes and was curious
how you fared with them.

(My O'Reilly Emacs book was lacking so I'll read
GNU manual next...)


reply via email to

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