;;; Sample ~./emacs - specially suited for for UNI-C PD distribution. ;;; Tested with emacs version 20.5. ;;; ;;; Created by Henning Christiansen 19990207 ;;; Minor update 19990503 ;;; Minor update 20010610 ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; First part: Key bindings (cond (window-system ; (global-set-key [?\M-@] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-£] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-$] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-{] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-[] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-]] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-}] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-\\] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-~] 'self-insert-command) ;; For danish keyboards ; (global-set-key [?\M-|] 'self-insert-command) ;; For danish keyboards (global-set-key [C-backspace] 'backward-kill-word);; Kill backward word (global-set-key [home] 'beginning-of-line) ;; Go to beginning of line (global-set-key [S-home] 'beginning-of-buffer) ;; Go to beginning of buffer (global-set-key [end] 'end-of-line) ;; Go to end of line (xterm) (global-set-key [S-end] 'end-of-buffer) ;; Go to end of buffer (xterm) (global-set-key [select] 'end-of-line) ;; Go to end of line (ws) (global-set-key [S-select] 'end-of-buffer) ;; Go to end of buffer (ws) (global-set-key [C-prior] 'beginning-of-buffer) ;; Go to beginning of buffer (global-set-key [C-next] 'end-of-buffer) ;; Go to end of buffer (global-set-key [C-left] 'backward-word) ;; Jump to previous word (global-set-key [C-right] 'forward-word) ;; Jump to next word (global-set-key [C-up] 'backward-paragraph) ;; Jump to previous paragraph (global-set-key [C-down] 'forward-paragraph) ;; Jump to next paragraph (global-set-key [insertchar] 'overwrite-mode) ;; Toggle between insert-mode and non insert-mode (global-set-key [hpDeleteChar] 'delete-char) ;; Delete char (not backspace) (global-set-key [f1] 'insert-ae) ;; (global-set-key [f2] 'insert-o-slash) ;; (global-set-key [f3] 'insert-a-ring) ;; (global-set-key [f4] 'ispell-word) ;; (global-set-key [f5] 'global-set-key) ;; (global-set-key [f6] 'auto-fill-mode) ;; Togle between autofill-mode (global-set-key [f7] 'next-error) ;; (global-set-key [f8] 'compile) ;; (global-set-key [f9] 'goto-line) ;; Goto line (global-set-key [f10] 'nil) ;; This key is resrved for invocation of the motif menu (global-set-key [f11] 'advertised-undo) ;; Undo (global-set-key [f12] 'query-replace) ;; Replace rest of buffer (with confirmation) (global-set-key [S-f1] 'insert-AE) ;; (global-set-key [S-f2] 'insert-O-slash) ;; (global-set-key [S-f3] 'insert-A-ring) ;; (global-set-key [S-f4] 'ispell-region) ;; (global-set-key [S-f5] 'nil) ;; (global-set-key [S-f6] 'font-lock-mode) ;; Toggle font lock mode (global-set-key [S-f7] 'nil) ;; (global-set-key [S-f8] 'next-error) ;; Used in conjunction with compile (global-set-key [S-f9] 'nil) ;; (global-set-key [S-f10] 'nil) ;; (global-set-key [S-kp-f1] 'nil) ;; (global-set-key [S-kp-f2] 'nil) ;; (global-set-key [S-kp-f3] 'revert-buffer) ;; Undo (global-set-key [S-kp-f4] 'replace-string) ;; Replace rest of buffer (without confirmation) (WS) (xterm) (global-set-key [C-f4] 'ispell-change-dictionary);; Change directory for ispell (global-set-key [menu] 'ps-print-region-with-faces) ;; Print region (ws) (global-set-key [S-key-21] 'ps-print-buffer-with-faces) ;; Print buffer (ws) (global-set-key [print] 'ps-print-region-with-faces) ;; Print region (xterm) (global-set-key [S-print] 'ps-print-buffer-with-faces) ;; Print buffer (xterm) (global-set-key [SunF36] 'advertised-undo) ;; Undo (SUN keyboard) (global-set-key [SunF37] 'query-replace) ;; Replace rest of buffer (with confirmation) (SUN keyboard) (global-set-key [S-SunF36] 'advertised-undo) ;; Undo (SUN keyboard) (global-set-key [S-SunF37] 'replace-string) ;; Replace rest of buffer (without confirmation) (SUN keyboard) (global-set-key [f14] 'advertised-undo) ;; Undo (SUN keyboard) (global-set-key [S-f14] 'revert-buffer) ;; Undo (SUN keyboard) (global-set-key [f18] 'yank) ;; Paste kiled region (SUN keyboard) (global-set-key [f20] 'kill-region) ;; Kill region (SUN keyboard) (global-set-key [f22] 'ps-print-region-with-faces) ;; Print region (SUN keyboard) (global-set-key [S-f22] 'ps-print-buffer-with-faces) ;; Print buffer (SUN keyboard) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Second part: color settings. ;;; Note: If you use the "Make new frame" feature you will loose the color settings. To avoid that problem ;;; you should add the folowing 6 lines to your ~/.Xdefaults ;;; Emacs.background: midnightblue ;;; Emacs.foreground: white ;;; Emacs.cursorColor: green ;;; Emacs.pointerColor: green ;;; Emacs.pane.menubar.*.background: steelblue ;;; Emacs.pane.menubar.*.foreground: white (cond (window-system (load-library "paren") ;; This will highlight the matching bracket (set-face-background 'modeline "gray77") (set-face-foreground 'modeline "black") (set-background-color "midnightblue") (set-foreground-color "white") (set-mouse-color "green") (set-cursor-color "green") ;;; Font lock settings. Change the color to your liking. ;;; Please note that the colours are intended for a dark background (setq font-lock-face-attributes '( (font-lock-comment-face "#ff0000") (font-lock-string-face "LightSalmon") (font-lock-keyword-face "Green") (font-lock-function-name-face "Yellow") (font-lock-variable-name-face "LightGoldenrod") (font-lock-type-face "PaleGreen") (font-lock-reference-face "lightblue") )) (setq font-lock-maximum-decoration 't) (global-font-lock-mode t) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Third part: Misc ;;; Enable us to write iso-latin chars (load-library "iso-insert") ;;; Use Standard European Display ;(load-library "dispdk") ; Arrow key's shouldn't create new lines (setq-default next-line-add-newlines nil) ; Always use transient mode (setq-default transient-mark-mode t) ; Permits "upcase'ing" of regions (put 'upcase-region 'disabled nil) ; Permits "downcase'ing" of regions (put 'downcase-region 'disabled nil) ; This may not work properly (setq-default scroll-step 1) ; Reduce the noise, please (setq-default visible-bell t) ; A few text settings (setq tex-dvi-view-command "xdvi") (setq tex-dvi-print-command "dvips -f * | lp ") (setq tex-default-mode 'latex-mode) ; In calendar-mode, Monday should be first day (setq calendar-week-start-day '1) ; Enable column mode (setq column-number-mode 't) ; Use AUC tex ;(require 'tex-site) ; Pine, Mutt and Elm tmp files should be considered as text buffers. (setq auto-mode-alist (cons '("^/var/tmp/pico" . text-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("^/tmp/mutt" . text-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("^/tmp/snd" . text-mode) auto-mode-alist)) ; Always use auto fill mode in text buffers. (add-hook 'text-mode-hook '(lambda () (auto-fill-mode 1))) ;; Set up the keyboard so the delete key on both the regular keyboard ;; and the keypad delete the character under the cursor and to the right ;; under X, instead of the default, backspace behavior. (global-set-key [delete] 'delete-char) (global-set-key [kp-delete] 'delete-char) ;;; If we are not using X-windows we can still use ;;; natianol characters like "æøå". (set-terminal-coding-system 'iso-latin-1) (set-language-environment "Latin-1") (set-keyboard-coding-system 'iso-latin-1) ;; new matlab mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq load-path (cons "~dfvflec/bin/emacs_add_ons" load-path)) (autoload 'matlab-mode "matlab" "Enter Matlab mode." t) (setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist)) (autoload 'matlab-shell "matlab -nojvm" "Interactive Matlab mode." t) (setq matlab-indent-function t) ; if you want function bodies indented (defun my-matlab-mode-hook () (setq fill-column 76)) ; where auto-fill should wrap (add-hook 'matlab-mode-hook 'my-matlab-mode-hook) (defun my-matlab-shell-mode-hook ()'()) (add-hook 'matlab-shell-mode-hook 'my-matlab-shell-mode-hook) (global-font-lock-mode 1 t) (setq font-lock-maximum-decoration t) ;;;;;;;;;;;;;;;;; end of new matlab mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; =================================================================== ;;; ;;; ESS ;;; ;; This affects all modes that use 'comint' (e.g. shell-mode and ESS) (eval-after-load "comint" '(progn (setq S-directory nil) (setq comint-scroll-to-bottom-on-output t) (setq comint-scroll-to-bottom-on-input nil) (setq comint-scroll-show-maximum-output t) (define-key comint-mode-map [up] 'comint-previous-matching-input-from-input) (define-key comint-mode-map [down] 'comint-next-matching-input-from-input) (define-key comint-mode-map "^A" 'comint-bol) ) ) ;; (global-set-key [f12] 'ess-eval-line-and-step) ;; ESS (load "~dfvflec/bin/ess-5.2.5/lisp/ess-site") ; IMM(HAN) installation ;; Here we put some lines to enable emacs to show GAMS syntax. (autoload 'gams-mode "~/.emacs_addons/gams.el" "Enter gams mode." t) (setq auto-mode-alist (cons '("\\.gms\\'" . gams-mode) auto-mode-alist)) (autoload 'gams-shell "~/.emacs_addons/gams.el" "Interactive gams mode." t)