Subject: Re: strange indent
Date: Thu, 30 Jan 2003 16:10:11 +1100
From: Mei Wu <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
On Thursday 30 January 2003 02:15 pm, you wrote:
Hi,
I found that what breaks it is:
(setq jde-mode-hook (lambda() (auto-fill-mode 1)))
The indent gets back when this line is taken out, does anyone know why it
conflicts with my settings ?
Attached is my .emacs.
Thanks
Mei
> Hi,
> When I'm customizing some of the Jdee variables, the correct indent lost
> for me, although I have :
> c-set-offset 'substatement-open 0
> in the jde hook:
>
> I still have :
>
> if(i==0)
> {
> i =0;
> }
> which should be :
> if(i==0)
> {
> i =0;
> }
>
> It has been working well for a while but just got it wrong all of a sudden,
> and restarting emacs didn't help .
>
> Anyone has the same problem before ?
> Thanks
> Mei
>
> (defun my-jde-mode-hook ()
> (c-set-style "ellemtel")
> (setq c-indent-tabs-mode t ; Pressing TAB should cause
> ; indentation
> c-indent-level 4 ; A TAB is equivilent to four
> spaces
> c-argdecl-indent 0 ; Do not indent argument decl's
> extra
> c-tab-always-indent t
> c-comment-continuation-stars "*"
> c-set-offset 'substatement-open 0
> c-continued-statement-offset 4
> ; do NOT expand tabs when deleting
> ; them
> c-auto-newline t)
> (c-set-offset 'substatement-open '0)
> ; brackets should be at same
> ; indentation level as the
> ; statements they open
> (c-set-offset 'inline-open '+)
> (c-set-offset 'block-open '+)
> (c-set-offset 'brace-list-open '+)
> ; all "opens" should be indented
> ; by the c-indent-level
> (c-set-offset 'case-label '+)
> (c-toggle-auto-hungry-state 1)
> ; we like auto-newline and
> ; hungry-delete
> (define-key c-mode-map "\C-m" 'c-context-line-break))
> ; indent
> ; case labels
> (add-hook 'jde-mode-hook 'my-jde-mode-hook)
-------------------------------------------------------
;---------------------------------------------------;
; Emacs starts ;
;---------------------------------------------------;
(setq debug-on-error t)
;; reload .emacs
(global-set-key "\M-r" '(lambda ()
(interactive)
(load-file "~/.emacs")))
;; replace yes or no with y or n
(fset 'yes-or-no-p 'y-or-n-p)
(global-font-lock-mode t)
;; The 5.28 cc mode
(add-to-list 'load-path "~/emacs_lisp/cc-mode-5.28")
(add-to-list 'load-path "~/emacs_lisp")
(autoload 'gnuserv-start "gnuserv-compat"
"Allow this Emacs process to be a server for client processes."
t)
(gnuserv-start)
;---------------------------------------------------;
; C,C++,JAVA mode ;
;---------------------------------------------------;
(defun my-c-mode-hook ()
(c-set-style "ellemtel")
(setq c-indent-tabs-mode t ; Pressing TAB should cause
; indentation
c-indent-level 4 ; A TAB is equivilent to four spaces
c-argdecl-indent 0 ; Do not indent argument decl's extra
c-tab-always-indent t
c-comment-continuation-stars "*"
c-set-offset 'substatement-open 0
c-continued-statement-offset 4
; do NOT expand tabs when deleting
; them
c-auto-newline t)
(c-set-offset 'substatement-open '0)
; brackets should be at same
; indentation level as the
; statements they open
(c-set-offset 'inline-open '+)
(c-set-offset 'block-open '+)
(c-set-offset 'brace-list-open '+)
; all "opens" should be indented
; by the c-indent-level
(c-set-offset 'case-label '+)
(c-toggle-auto-hungry-state 1)
; we like auto-newline and
; hungry-delete
(define-key c-mode-map "\C-m" 'c-context-line-break))
; indent
; case labels
(require 'filladapt)
(setq-default filladapt-mode t)
(defun my-c-mode-common-hook ()
(c-setup-filladapt)
(filladapt-mode 1)
(auto-fill-mode ))
(add-hook 'jde-mode-hook 'my-c-mode-common-hook)
(add-hook 'c-mode-hook 'my-c-mode-hook)
(add-hook 'c++-mode-hook 'my-c-mode-hook)
(add-hook 'jde-mode-hook 'my-c-mode-hook)
(add-hook 'jde-mode-hook 'turn-on-font-lock)
;(setq jde-mode-hook (lambda() (auto-fill-mode 1)))
;---------------------------------------------------;
; Global key bindings ;
;---------------------------------------------------;
(defun query-region (from to)
(interactive "r")
(save-excursion
(save-restriction
(narrow-to-region from to)
(let ((mark-active nil))
(goto-char (point-min))
(call-interactively `query-replace)))))
(defun my-shell ()
"Start a shell in the directory of current buffer"
(interactive)
(if (eq buffer-file-name nil) (setq my-file-dir default-directory)
(setq my-file-dir (file-name-directory buffer-file-name)))
(setq my-file-dir (expand-file-name my-file-dir))
(switch-to-buffer my-file-dir)
(shell my-file-dir))
(global-set-key [f1] 'my-shell)
(global-set-key [f2] 'recentf-open-files)
(global-set-key [f3] 'goto-line)
(global-set-key [f4] 'query-region)
(global-set-key [f5] 'untabify)
(global-set-key [f7] 'indent-region)
(global-set-key [f8] 'bookmark-set)
(global-set-key [f9] 'bookmark-delete)
(global-set-key [f10] 'bookmark-jump)
(global-set-key [f12] 'customize-variable)
;---------------------------------------------------;
; html helper mode ;
;---------------------------------------------------;
(setq auto-mode-alist (cons '("\\.html$" . html-helper-mode) auto-mode-alist))
(autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t)
;; The following is the template for opening a new HTML file
(setq html-helper-new-buffer-template
'(html-helper-htmldtd-version
" \n"
"\n\n\n"
"\n \n\n"
p
"\n\n"
"\n \n"))
;---------------------------------------------------;
; Uniquify ;
;---------------------------------------------------;
;;Set directory name to the buffer name to make buffer name unique
(require 'uniquify)
(setq uniquify-non-file-buffer-names t)
(setq uniquify-after-kill-buffer-p t)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
(setq uniquify-ignore-buffers-re "\\`\\*")
;---------------------------------------------------;
; JDEE Packages ;
; cua eieio speedbar semantic elib ;
;---------------------------------------------------;
;;cua.el
(pc-selection-mode)
(require 'cua)
(CUA-mode t)
;;eieio
(add-to-list 'load-path "~/emacs_lisp/eieio-0.17")
;;speedbar
(add-to-list 'load-path "~/emacs_lisp/speedbar-0.14beta4")
(autoload 'speedbar-frame-mode "speedbar" "Popup a speedbar frame" t)
(autoload 'speedbar-get-focus "speedbar" "Jump to speedbar frame" t)
(define-key-after (lookup-key global-map [menu-bar tools])
[speedbar] '("Speedbar" . speedbar-frame-mode) [calendar])
; Texinfo fancy chapter tags
(add-hook 'texinfo-mode-hook (lambda () (require 'sb-texinfo)))
; HTML fancy chapter tags
(add-hook 'html-mode-hook (lambda () (require 'sb-html)))
(autoload 'rpm "sb-rpm" "Rpm package listing in speedbar.")
; chapter listings
(autoload 'Info-speedbar-buttons "sb-info"
"Info specific speedbar button generator.")
; folder listings
(autoload 'rmail-speedbar-buttons "sb-rmail"
"Rmail specific speedbar button generator.")
; current stack display
(autoload 'gud-speedbar-buttons "sb-gud"
"GUD specific speedbar button generator.")
;you want to access speedbar using only
;the keyboard
;Using F11, you can now toggle between
;the speedbar frame, and the
;frame speedbar was started from.
(global-set-key [(f11)] 'speedbar-get-focus)
;;Semantic
(add-to-list 'load-path "~/emacs_lisp/semantic-1.4.2")
(setq semantic-load-turn-everything-on t)
(require 'semantic-load)
;;elib
(add-to-list 'load-path "~/emacs_lisp/elib")
;;jde
(add-to-list 'load-path (expand-file-name "~/emacs_lisp/jde-2.3.2/lisp"))
(require 'jde)
;---------------------------------------------------;
; General settings for all modes ;
;---------------------------------------------------;
(setq make-backup-files nil) ; Don't want any backup files
(setq auto-save-list-file-name nil) ; Don't want any .saves files
(setq auto-save-default nil) ; Don't want any auto saving
(setq search-highlight t) ; Highlight search object
(setq query-replace-highlight t) ; Highlight query object
(setq mouse-sel-retain-highlight t) ; Keep mouse high-lightening
(setq transient-mark-mode t)
(setq show-trailing-whitespace t)
(setq backward-delete-function nil)
(setq tab-width 4)
(setq indent-tabs-mode nil) ; Spaces are used instead of tabs
(setq-default auto-fill-hook 'do-auto-fill)
;; the auto fill mode puts a hard return after the cursor
;; approaches the right edge of the window. If this mode is
;; off the lines continue and wraps around.
(setq text-mode-hook '(lambda() (auto-fill-mode 1)))
;---------------------------------------------------;
; GNU Server ;
;---------------------------------------------------;
;;Reusing Frames And Popping The Frame To The Foreground
(defadvice server-find-file (before server-find-file-in-one-frame activate)
;; "Make sure that the selected frame is stored in `gnuserv-frame', and raised."
(setq gnuserv-frame (selected-frame))
(raise-frame))
(defadvice server-edit (before server-edit-in-one-frame activate)
"Make sure that the selected frame is stored in `gnuserv-frame', and lowered."
(setq gnuserv-frame (selected-frame))
(lower-frame))
;---------------------------------------------------;
; customize ;
;---------------------------------------------------;
(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
)
(custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
;; Your init file should contain only one such instance.
'(jde-enable-abbrev-mode t)
'(jde-gen-k&r nil)
'(jde-javadoc-command-path "/home/meiwu/java/bin/javadoc")
'(jde-javadoc-gen-destination-directory "../JavaDoc")
'(browse-url-browser-function (quote browse-url-kde))
'(pc-select-meta-moves-sexps t)
'(pc-select-selection-keys-only t)
'(pc-selection-mode t nil (pc-select))
'(uniquify-buffer-name-style (quote forward) nil (uniquify)))