;; -*- emacs-lisp -*- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; $Id: emacs_internals.el,v 1.21 2006-11-06 21:02:42 rscholz Exp $ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Emacs-Interna und Essentials ;; ;; Die offizielle Quelle dieser Datei ist ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; gnuserv ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;(when (string= "home" zonix-location) ; (require 'gnuserv) ; (gnuserv-start)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Speicherverwaltung ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq gc-cons-threshold 4000000) (setq garbage-collection-messages t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Evaluierung ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Emacs-Macroviren (setq enable-local-variables t) ;(setq enable-local-eval t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Interaktion ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Makes things a little bit more consistent. (fset 'yes-or-no-p 'y-or-n-p) ;; keine automatischen Newlines beim Scrollen einfuegen (setq next-line-add-newlines nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Versions-Kontrolle ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq vc-command-messages t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Darstellung ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq baud-rate 100000000) ;; (setq initial-frame-alist '((top . 1) (left . 1) (width . 80) (height . 55))) ;; (setq initial-frame-alist '((tool-bar-lines . 0) (menu-bar-lines . 0))) ;; Emacs 21 (when (>= emacs-major-version 21) ;; keine Toolbar (setq initial-frame-alist '((tool-bar-lines . 0))) ;; falls doch, Platz minimieren (setq tool-bar-button-relief 1) (setq tool-bar-button-margin 1) (set-face-attribute 'tool-bar t :box nil) ;; nur ein Cursor sichtbar (setq-default cursor-in-non-selected-windows nil) ;; kein blinkender Cursor (blink-cursor-mode 0) ;; Randfarbe (set-face-background 'fringe "#d5d2de")) (transient-mark-mode 1) (setq search-highlight t) ;; Startup (setq inhibit-startup-message t) (setq visible-bell t) (global-font-lock-mode 1) (setq font-lock-maximum-decoration t) ;; Anzeige von Zeile und Spalte (line-number-mode 1) (column-number-mode 1) ;; Anzeige von TABs und Blanks (autoload 'blank-mode "blank-mode" "Toggle blank visualization." t) ;; Farben fuer primaeren Frame (if window-system (progn ;; Scrollbar bitte rechts (if (> emacs-major-version 19) (set-scroll-bar-mode 'right)) (set-cursor-color "blue") (set-background-color "#d5d2de") (set-mouse-color "red"))) ;; auf der Console keine Menueleiste (unless window-system (menu-bar-mode 0)) ;; Undo scrolling ;(require 'unscroll) ;(define-key global-map "\C-\M-v" 'unscroll) ;; Kein Buffer-Menü (global-unset-key [menu-bar buffer ]) ;; Einfügen an der Textcursor-Position ;(setq mouse-yank-at-point t) ;; "Bildschirmschoner" ;; (when (>= emacs-major-version 21) ;; (require 'zone) ;; (zone-when-idle 600)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Backup ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun make-backup-file-name (file-name) "Create the non-numeric backup file name for `file-name'." ; (require 'dired) ;; no need for that -- speedup start (if (file-exists-p "~/.emacs-backup") (concat (expand-file-name "~/.emacs-backup/") (dired-replace-in-string "/" "|" file-name)) (concat file-name "~"))) (defun ecm-backup-enable-predicate (filename) (and (not (string= "/tmp/" (substring filename 0 5))) (not (string-match "/Mail/" filename)) (not (string-match "/News/" filename)))) (setq backup-enable-predicate 'ecm-backup-enable-predicate) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Über Neuheiten informatiert sein (C-h C-n) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun site-lisp-news () "show site-lisp news" (interactive) (find-file "/usr/local/share/emacs/site-lisp/NEWS")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Abbreviations ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq dabbrev-case-replace nil) (setq dabbrev-abbrev-char-regexp nil) (setq dabbrev-case-fold-search nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Dateien öffnen ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'find-file) (setq ff-always-try-to-create nil) (require 'ffap) (ffap-bindings) (remove-hook 'gnus-summary-mode-hook 'ffap-gnus-hook) (auto-compression-mode 1) ;; Emacs21 ;(auto-image-file-mode) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Text-Mode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (global-set-key (kbd "RET") 'newline-and-indent) (define-key text-mode-map (kbd "RET") 'newline) (defun zonix-text-mode-hook () (set-fill-column 70) (auto-fill-mode 1)) (add-hook 'text-mode-hook 'zonix-text-mode-hook) (add-hook 'html-mode-hook 'zonix-text-mode-hook) (defun zonix-insert-period () (interactive) (insert ". ")) ;(define-key text-mode-map "." 'zonix-insert-period) (defun zonix-insert-exclamation-mark () (interactive) (insert "! ")) ;(define-key text-mode-map "!" 'zonix-insert-exclamation-mark) (defun zonix-insert-question-mark () (interactive) (insert "? ")) ;(define-key text-mode-map "?" 'zonix-insert-question-mark) ;; ". " bedeutet Satzende ;(setq sentence-end-double-space nil) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Einstellungen fuer die 8-bit-Welt ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (require 'iso-insert) ;; Emacs 19 (when (< emacs-major-version 20) (standard-display-european 1) (require 'iso-syntax)) ;; Emacs 20 (when (= emacs-major-version 20) (set-language-environment "Latin-1") (setq unibyte-display-via-language-environment t)) ;; Emacs 21 (when (= emacs-major-version 21) (set-language-environment "Latin-1") ; (set-keyboard-coding-system 'iso-latin-9) ;; Windows-Charset umsetzen (define-coding-system-alias 'windows-1252 'iso-8859-1) ;; iso-8859-X vereinheitlichen (unify-8859-on-encoding-mode t) (unify-8859-on-decoding-mode t) ) ;; Emacs 22 (when (>= emacs-major-version 22) (set-language-environment "Latin-1") ;; iso-8859-X vereinheitlichen (unify-8859-on-encoding-mode t) (unify-8859-on-decoding-mode t) ) ;; 8Bit-Zeichen darstellen und eingeben können (unless window-system (progn (set-terminal-coding-system 'iso-8859-1) (set-input-mode (car (current-input-mode)) (nth 1 (current-input-mode)) 0))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; whois ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq whois-server-name "whois.thur.de") (setq whois-guess-server nil) ;; das kann whois.thur.de selbst ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Shell-Command ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq-default start-command "") (setq dm-term-command "xterm") (defun dischi/shell (command &optional output-buffer) "Execute string COMMAND in inferior shell. Uses Variable term-command to show the Program. See shell-command; provide file-name completion as well." (interactive (list (read-from-minibuffer "Shell-Command: " start-command cabo:shell-minibuffer-local-map nil 'shell-command-history) current-prefix-arg)) (setq start-command command) (setq mycommand (concat (concat (concat (concat dm-term-command " -T \"output for ") command) "\" -e sh -c '" command) " ; echo ; echo Press ENTER to return to emacs ; read'")) (shell-command mycommand output-buffer)) (defun cabo:shell-command (command &optional output-buffer) "Execute string COMMAND in inferior shell; display output, if any. See shell-command; provide file-name completion as well." (interactive (list (read-from-minibuffer "Shell command: " nil cabo:shell-minibuffer-local-map nil 'shell-command-history) current-prefix-arg)) (shell-command command output-buffer)) (defun cabo:shell-command-on-region (start end command &optional output-buffer replace) "Execute string COMMAND in inferior shell with region as input. See shell-command-on-region; provide file-name completion as well." (interactive (let ((string (read-from-minibuffer "Shell command on region: " nil cabo:shell-minibuffer-local-map nil 'shell-command-history))) ;; call-interactively recognizes region-beginning and ;; region-end specially, leaving them in the history. (list (region-beginning) (region-end) string current-prefix-arg current-prefix-arg))) (shell-command-on-region start end command output-buffer replace)) (defun cabo:dired-smart-shell-command (cmd &optional insert) "Like function `shell-command', but in the current Tree Dired directory." (interactive (list (read-from-minibuffer "Shell command: " nil cabo:shell-minibuffer-local-map nil 'shell-command-history) current-prefix-arg)) (let ((default-directory (default-directory))) (cabo:shell-command cmd insert))) (defun dischi:shell-command-insert (command) (interactive (let ((string (read-from-minibuffer "Shell command: " nil cabo:shell-minibuffer-local-map nil 'shell-command-history))) (list string))) (shell-command command 1 )) (defun dischi:shell-command-on-region-replace (command) (interactive (let ((string (read-from-minibuffer "Shell command on region: " nil cabo:shell-minibuffer-local-map nil 'shell-command-history))) (list string))) (shell-command-on-region (region-beginning) (region-end) command 1 1)) ;; ^M weglassen (add-hook 'comint-output-filter-functions 'comint-strip-ctrl-m) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Nützliche Funktionen ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Florian Weimer in <877lhs476b.fsf@deneb.cygnus.argh.org> (defun global-change-directory (from to) "Change directory of all buffers with default-directory FROM to TO." (interactive "DGlobally change directory from: \nDTo: ") (let ((bufs (buffer-list)) (from (expand-file-name from))) (while bufs (with-current-buffer (car bufs) (when (equal from (expand-file-name default-directory)) (setq default-directory to))) (setq bufs (cdr bufs))))) ;; Kai Großjohann in (defun kai-turn-on-viper (dummy) (setq viper-mode t) (require 'viper)) (add-to-list 'command-switch-alist '("-vi" . kai-turn-on-viper))