Sorry if this is a very basic question - I admit to being a
less-than-sophisticated emacs user ....
I have tried to set up my .emacs file so that the basic offset
quantity for both C and Java code is 4 spaces. Works fine when
I edit just Java code, but when I start editting C as well c-basic-offset
seems to jump unpredictably (to me , anyway) between 4 and 2.
Simple answer???
Thanks for any help,
_Rich
Emacs : GNU Emacs 20.7.1 (i386-*-nt4.0.1381)
of Tue Jun 13 2000 on buffy
Package: JDE version 2.2.6.2
I have the following in my .emacs file(s):
;; < This stuff gets modified when a customizable variable setting
;; is "[Save[d] for Future Sessions]".
(custom-set-variables
'(jde-auto-parse-enable nil)
'(jde-compile-option-optimize nil)
'(jde-auto-parse-buffer-interval 600)
'(tab-width 4)
'(c-basic-offset 4)
'(jde-db-option-classpath (quote (".;../..")))
'(jde-gen-k&r nil)
'(jde-which-method-mode nil)
'(jde-bug-jdk-directory "d:/jdk1.3/")
'(jde-compile-option-classpath (quote (".;../..")))
'(jde-db-source-directories (quote ("d:/Riche/src" "d:/nsroot/Src/"
"d:/jdk1.3/src/")))
'(jde-db-debugger (quote ("JDEbug" "" . "Executable")))
'(dired-listing-switches "-al")
'(Info-additional-directory-list (quote ("/Programs/cygwin/usr/info")))
'(jde-enable-abbrev-mode nil)
'(jde-db-option-verbose (quote (nil nil nil)))
'(jde-bug-vm-includes-jpda-p t)
'(jde-run-classic-mode-vm t))
(custom-set-faces)
;;..rle.el..................................................................
;; Set tab stop list.
(defun set-tab-stops-4 ()
"Sets the tab-stop-list to every 4 characters."
(interactive)
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72
76 80 64 88 92 96 100 104 108 112 116 120))
)
;; Sets tab width to 4.
(defun set-tab-width-4 ()
"Set the tab-width variable to 4."
(interactive)
(setq tab-width 4)
(redraw-display)
(message "tab-width = 4")
)
;; Sets tab width to 8.
(defun set-tab-width-8 ()
"Set the tab-width variable to 8."
(interactive)
(setq tab-width 8)
(redraw-display)
(message "tab-width = 8")
)
;; Toggles between tab width of 4 and 8.
(defun toggle-tab-width-4-8 ()
"Toggles between tab width of 4 and 8."
(interactive)
(if (eq tab-width '4)
(set-tab-width-8)
(set-tab-width-4))
)
;; Sets tab stop list and width to 4.
(defun set-tab-stops-width-4 ()
"Sets tab stop list and width to 4."
(interactive)
(set-tab-stops-4)
(setq tab-width 4)
)
(defun my-java-mode-hook ()
"My java interaction mode settings."
(interactive)
(set-tab-stops-width-4)
)
(add-hook 'java-mode-hook 'my-java-mode-hook)
;;..........
;; < Start of JDE stuff >
;; This .emacs file illustrates the minimul setup
;; required to run the JDE.
;; Set the debug option to enable a backtrace when a
;; problem occurs.
(setq debug-on-error t)
;; Update the Emacs load-path to include the path to
;; the JDE and its require packages. This code assumes
;; that you have installed the packages in the emacs/site
;; subdirectory of your home directory.
(add-to-list 'load-path (expand-file-name
"d:/Programs/emacs/site-lisp/jde/lisp"))
(add-to-list 'load-path (expand-file-name
"d:/Programs/emacs/site-lisp/semantic"))
(add-to-list 'load-path (expand-file-name
"d:/Programs/emacs/site-lisp/speedbar"))
(add-to-list 'load-path (expand-file-name
"d:/Programs/emacs/site-lisp/eieio"))
(add-to-list 'load-path (expand-file-name
"d:/Programs/emacs/site-lisp/elib"))
(add-to-list 'load-path (expand-file-name
"d:/Programs/emacs/site-lisp/misc"))
;; If you want Emacs to defer loading the JDE until you open a
;; Java file, edit the following line
;;(setq defer-loading-jde nil)
;; to read:
;;
(setq defer-loading-jde t)
;;
(if defer-loading-jde
(progn
(autoload 'jde-mode "jde" "JDE mode." t)
(setq auto-mode-alist
(append
'(("\\.java\\'" . jde-mode))
auto-mode-alist)))
(require 'jde))
(add-hook 'jde-mode-hook 'my-java-mode-hook)
;;also: (add-hook 'jde-mode-hook 'turn-off-font-lock)
;; Include the following only if you want to run
;; bash as your shell.
;; Setup Emacs to run bash as its primary shell.
(setq shell-file-name "bash")
(setq shell-command-switch "-c")
(setq explicit-shell-file-name shell-file-name)
(setenv "SHELL" shell-file-name)
(setq explicit-sh-args '("-login" "-i"))
(if (boundp 'w32-quote-process-args)
(setq w32-quote-process-args ?\")) ;; Include only for MS Windows.
;; < 2000oct30/rlej From JDE install directions at http://sunsite.dk/jde:
;; Emacs's default text selection mode and cut-and-paste key bindings differ
from the CUA standard used by Windows. (Hardly surprising, as Emacs
antedates both CUA and Windows). If you prefer the CUA mode (as I do), you
can configure Emacs to emulate CUA mode. To do this, first copy the package
cua-mode.el into your Emacs site directory (see step 6 above). Then, insert
the following code into your .emacs file (see step 5 above).
;; (pc-selection-mode)
;; (load "cua-mode")
;; (CUA-mode t)
;; < 2001jan2/rlej From jde email list:
;; I was experiencing a slow down in scrolling through source files that was
directly proportional to the size of the file. (One of my files is 100+K.
This file was un-editable.)
;; Turning off which-method-mode solved the problem. Here are the relavent
jde setting from my .emacs file:
(custom-set-variables
'(jde-auto-parse-enable nil)
'(jde-gen-k&r nil)
'(jde-enable-abbrev-mode t)
'(jde-which-method-mode nil)
; '(jde-compiler "jikes")
; '(jde-compile-option-command-line-args "+E")
)
;; < End JDE stuff >
;; < Semantic stuff >
(require 'semantic-c) ; for C code integration
(require 'semantic-el) ; for Emacs Lisp code integration
(require 'semantic-make) ; for Makefile integration
(require 'semantic-imenu) ; if you use imenu or wich-function
(add-hook 'speedbar-load-hook (lambda () (require 'semantic-sb)))
; for speedbar integration
(autoload 'semantic-bnf-mode "semantic-bnf" "Mode for Bovine Normal Form."
t)
(add-to-list 'auto-mode-alist '("\\.bnf$" . semantic-bnf-mode))
; for editing .bnf parser files.
(autoload 'semantic-minor-mode "semantic-mode" "Mode managing semantic
parsing." t)
; for semantic-minor-mode
;; < End Semantic stuff >