MRW

Tipps zum XEmacs

Die Datei ~/.xemacs/custom.el

(custom-set-variables
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; chose UTF-8 as default coding for anything
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 '(buffer-file-coding-system 'utf-8 t)
 '(buffer-file-coding-system-for-read 'utf-8 t)
 '(buffer-process-coding-system 'utf-8)
 '(default-buffer-file-coding-system 'utf-8 t)
 '(default-file-coding-system 'utf-8)
 '(edict-default-coding-system 'utf-8)
 '(file-coding-system 'utf-8 t)
 '(file-coding-system-for-read 'utf-8 t)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; case insensitive search
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 '(case-fold-search t)

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; settings for sytax highlighting
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 '(font-lock-mode t nil (font-lock))
 '(paren-mode 'sexp nil (paren))
 '(pending-delete-mode t nil (pending-del)))


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; general settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq visible-bell t); invert screen in case of error, instead of beeping
(setq scroll-step 1); scroll one-by-one
(setq auto-save-default nil) ; do not automatically save buffer
(setq screen-default-alist '((width . 80) (height . 60))) ; ??? what's that?
(line-number-mode 1) ; show line numbers in status line


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; coding rules
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq-default indent-tabs-mode nil) ; never insert tabulators!
(setq tab-width 2) ; indent by two characters
;;;; C++ Rules
(setq c-offsets-alist
      '(
        (c                  . 4)  ;; inside multiline comment
        (case-label         . +)  ;; inside the case
        (func-decl-cont     . ++) ;; func throw declaration on new line
        (inclass            . ++) ;; increment access specifier
        (member-init-intro  . ++) ;; initialisation list
        (topmost-intro-cont . ++) ;; e.g. line break after func return value
        (template-args-cont . ++) ;; continuation within template arguments
        ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; inseart headers with Ctrl+C and a number from 1 to 8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; here are the headers to be inserted:
;; Header for Ctrl+C 1
(defvar header1 "/** @file

    @copy Meine Firma AG, vertraulich
    
    $Id$
*/
//       1          2         3         4         5         6         7         8
//  56789012345676890123456789012345678901234567890123456789012345678901234567890
"
  "*header to be inserted")
;; Header for Ctrl+C 2
(defvar header2 "# (c) Meine Firma AG, vertraulich
# $Id$
#
#        1          2         3         4         5         6         7         8
# 3456789012345676890123456789012345678901234567890123456789012345678901234567890
"
  "*header to be inserted")
;; Header for Ctrl+C 3
(defvar header3 ""
  "*header to be inserted")
;; Header for Ctrl+C 4
(defvar header4 "//----------------------------------------------------------------------------"
  "*header to be inserted")
;; Header for Ctrl+C 5
(defvar header5 "//============================================================================"
  "*header to be inserted")
;; Header for Ctrl+C 6
(defvar header6 "//............................................................... typedefs"
  "*header to be inserted")
;; Header for Ctrl+C 7
(defvar header7 "//.............................................................. variables"
  "*header to be inserted")
;; Header for Ctrl+C 8
(defvar header8 "//................................................................ methods"
  "*header to be inserted")
;;;; here are auxiliary functions to really insert the variables from above
(defun insert-header1()
  (interactive)
  (insert  header1))
(defun insert-header2()
  (interactive)
  (insert  header2))
(defun insert-header3()
  (interactive)
  (insert  header3))
(defun insert-header4()
  (interactive)
  (insert  header4))
(defun insert-header5()
  (interactive)
  (insert  header5))
(defun insert-header6()
  (interactive)
  (insert  header6))
(defun insert-header7()
  (interactive)
  (insert  header7))
(defun insert-header8()
  (interactive)
  (insert  header8))
;;;; here are the key bindings
(global-set-key "\C-c1" 'insert-header1)
(global-set-key "\C-c2" 'insert-header2)
(global-set-key "\C-c3" 'insert-header3)
(global-set-key "\C-c4" 'insert-header4)
(global-set-key "\C-c5" 'insert-header5)
(global-set-key "\C-c6" 'insert-header6)
(global-set-key "\C-c7" 'insert-header7)
(global-set-key "\C-c8" 'insert-header8)



;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; keyboard settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Sun Solaris special keys ("copy", "paste", "undo", etc. keys)
(global-set-key '(f27) 'beginning-of-line)
(global-set-key '(f29) 'scroll-down)
(global-set-key '(f31) 'recenter)
(global-set-key '(f33) 'end-of-line)
(global-set-key '(f35) 'scroll-up)
(global-set-key '(f37) 'delete-char)
(global-set-key '(control f27) 'beginning-of-buffer)
(global-set-key '(control f33) 'end-of-buffer)
(global-set-key '(control SunF36) 'save-some-buffers)
(global-set-key '(control SunF37) 'kill-emacs)
;; Also for PC, the "normal" functionality
(global-set-key "\C-o" 'dabbrev-expand)
(global-set-key '(backspace) 'delete-backward-char)
(global-set-key '(control backspace) 'backward-kill-word)
(global-set-key '(control delete) 'kill-word)
(global-set-key '(control down) 'scroll-window-up)
(global-set-key '(control end) 'end-of-buffer)
(global-set-key '(control f1) 'switch-to-other-buffer)
(global-set-key '(control f3) 'delete-window)
(global-set-key '(control f4) 'delete-other-windows)
(global-set-key '(control f5) 'what-line)
(global-set-key '(control f8) 'kill-compilation)
(global-set-key '(control f10) 'dired)
(global-set-key '(control f11) 'save-some-buffer)
(global-set-key '(control f12) 'kill-emacs)
(global-set-key '(control home) 'beginning-of-buffer)
(global-set-key '(control insert) 'x-copy-primary-selection)
(global-set-key '(control left) 'backward-word)
(global-set-key '(control return) 'dabbrev-expand)
(global-set-key '(control right) 'forward-word)
(global-set-key '(control shift down) 'shrink-window)
(global-set-key '(control shift f5) 'next-error)
(global-set-key '(control shift up) 'enlarge-window)
(global-set-key '(control up) 'scroll-window-down)
(global-set-key '(control w) 'fill-paragraph)
(global-set-key '(delete) 'delete-char)
(global-set-key '(meta f19) 'isearch-yank-x-selection-forward)
(global-set-key '(meta r) 'isearch-yank-x-selection)
(global-set-key '(meta s) 'isearch-yank-x-selection)
(global-set-key '(next) 'scroll-up)
(global-set-key '(prior) 'scroll-down)
(global-set-key '(shift delete) 'x-kill-primary-selection)
(global-set-key '(shift insert) 'x-yank-clipboard-selection)
(global-set-key 'SunF36 'save-buffer)
(global-set-key 'SunF37 'save-buffers-kill-emacs)
(global-set-key 'f1 'switch-between-buffers)
(global-set-key 'f2 'other-window)
(global-set-key 'f3 'split-window-vertically)
(global-set-key 'f4 'kill-this-buffer)
(global-set-key 'f5 'goto-line)
(global-set-key 'f6 'call-last-kbd-macro)
(global-set-key 'f8 'compile)
(global-set-key 'f10 'find-file)
(global-set-key 'f11 'save-buffer)
(global-set-key 'f12 'save-buffer)
(global-set-key 'f14 'undo)
(global-set-key 'f19 'isearch-forward)
(global-unset-key '(insert))
;; return key indents
(setq indent-line-function 'indent-relative-maybe)
(global-set-key "\C-m" 'newline-and-indent)
;; use ctrl-tab to insert spaces up to tabstop (to align)
(global-set-key '(control tab) 'tab-to-tab-stop)

(defun switch-between-buffers ()
  (interactive)
  (switch-to-other-buffer 0))

;;; Settings for Lucid emacs only ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(cond ((string-match "Lucid" emacs-version)

       (put 'narrow-to-region 'disabled nil)
       (setq buffers-menu-max-size 20)
       
       ;;; Mouse buttons
       (global-set-key 'button2 'x-set-point-and-insert-selection)
       (global-set-key '(control button3) 'popup-menu-one)

       ;;; Scrolling, positioning of cursor, deleting 
       (defun scroll-window-up ()
	 (interactive)
	 (scroll-up 1))

       (defun scroll-window-down ()
	 (interactive)
	 (scroll-down 1))))