;; Function ;; c-return : In c: indent & open indented new line ;; fortran-return : In fortran: indent & open indented new line ;; f90-return : In F90: indent & open indented new line (defun c-return( ) (interactive) (c-indent-line) (newline-and-indent)) (defun fortran-return( ) (interactive) (fortran-indent-line) (newline-and-indent)) (defun f90-return( ) (interactive) (f90-indent-line) (newline-and-indent)) ;; c-mode (add-hook 'c-mode-hook '(lambda() (local-set-key [13] 'c-return) ;; RET with automatic indent (setq c-basic-offset 3) ;; 3 spaces for indentations (c-set-offset 'substatement-open 0) ;; No indent for open bracket (imenu-add-to-menubar "Functions") ;; Add index of func. to menu bar ) ) ;; c++-mode (add-hook 'c++-mode-hook '(lambda() (local-set-key [13] 'c-return) ;; RET with automatic indent (setq c-basic-offset 3) ;; 3 spaces for indentations (c-set-offset 'substatement-open 0) ;; No indent for open bracket (imenu-add-to-menubar "Functions") ;; Add index of func. to menu bar ) ) ;; fortran-mode (add-hook 'fortran-mode-hook '(lambda() (local-set-key [13] 'fortran-return) ;; RET with automatic indent ;(fortran-auto-fill-mode 1) ;(setq fortran-continuation-string "&") (imenu-add-to-menubar "Subprograms") ;; Add index of func. to menu bar ) ) ;; f90-mode (add-hook 'f90-mode-hook '(lambda() (local-set-key [13] 'f90-return) ;; RET with automatic indent (imenu-add-to-menubar "Program-Units") ;; Add index of func. to menu bar ) ) ;; makefile-mode (add-hook 'makefile-mode-hook '(lambda() (imenu-add-to-menubar "Index") ;; Add index of functions to menu bar ) ) ;; emacs-lisp-mode (add-hook 'emacs-lisp-mode-hook '(lambda() (imenu-add-to-menubar "Index") ;; Add index of func. to menu bar ) ) ;; add g95 to compilation mode (eval-after-load "compile" '(setq compilation-error-regexp-alist (cons '("^In file \\(.+\\):\\([0-9]+\\)" 1 2) compilation-error-regexp-alist))) ;; =========================================================================== ;; Files ending in .h should be edited in c++-mode. ;; Files ending in .inc should be edited in fortran-mode. ;; Files ending in .mak should be edited in makefile-mode. ;; Files ending in .f03 or .F03 should be edited in f90-mode. (setq auto-mode-alist (cons '("\\.h$" . c++-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.inc$" . fortran-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.mak$" . makefile-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.f03$" . f90-mode) auto-mode-alist)) ;; Do not save the auto-save-list file (avoiding to create HOME/.emacs.d/...) (setq auto-save-list-file-prefix nil) ;; cc-mode (the mode you're in when editing C, C++, and Objective C files) ;; Tell cc-mode not to check for old-style (K&R) function declarations. ;; This speeds up indenting a lot. ;; In Emacs 21.3 seems it does not exist! (setq c-recognize-knr-p nil) ;; Display the column number (column-number-mode t) ;; Set the default directory to $HOME (setq default-directory "~/") ;; Set the default Major Mode (setq default-major-mode 'text-mode) ;; Save desktop (desktop-save-mode t) ;; RET with automatic indent (global-font-lock-mode t) ;; RET with automatic indent (global-set-key [13] 'newline-and-indent) ;; Completing imenu setup (setq imenu-auto-rescan t) ;; Only for buffer lower than MAXOUT bytes (setq imenu-auto-rescan-maxout 500000) ;; The default is 60000 (setq imenu-scanning-message nil) ;; The scanning is so fast that we do ;; not need the message ;; The easy way to use Aspell with Emacs (setq ispell-program-name "aspell") ;; RET deleting highlighted text (pc-selection-mode t) ;; Set the base for character code (setq read-quoted-char-radix 10) ;; Show maching parenthesis clicking on (show-paren-mode t) ;; Show in which function is the cursor (which-function-mode t)