Anybody have a larger one? Some special support for perl, additional keybindings, support for really ancient emacsen (back to version 19, probably does not work anymore) ...
; -*- mode:emacs-lisp;coding:iso-8859-1; -*-
;
; perl -ne '/^;;;### PRIVATE BEGIN/ && ($no = 1); /^;;;### PRIVATE END/ and $_ = "", $no = 0; $no || print $_' .emacs
; exit 0
;
; sh hat mit den Zeilen oben Probleme ... besser csh verwenden
;;;
;;; $Id: .emacs,v 1.42 2007/11/20 15:54:15 eserte Exp $
;;;
;;-----------------------------------------------------------------
;; laedt default.el als erste Datei
(setq inhibit-default-init t)
(load "default" t nil)
;; bei manchen Installationen wird system-configuration nicht korrekt gesetzt
(or (boundp 'system-configuration)
(setq system-configuration (getenv "OSTYPE"))
(setq system-configuration (format "%s" system-type))
(setq system-configuration (getenv "ARCH"))
"unknown")
(setq is-windowsnt (and (or (string-match "i386-.*-windows.*" system-configuration)
(string-match "i386-.*-nt" system-configuration))
t))
;; emacs-Typ: xemacs oder gnu, sowie Versionsnummer als xxyy,
;; wobei xx für die Major- und yy für die Minor-Version steht
(setq emacs-type (or (and (string-match "XEmacs" emacs-version) 'xemacs)
'gnu))
(setq emacs-subtype
(or (and (boundp 'emacs-major-version)
(numberp 'emacs-major-version) ;; manchmal ein String :-(
(boundp 'emacs-minor-version)
(+ (* 100 emacs-major-version)
emacs-minor-version))
(and (string-match "^\\([0-9]+\\)\\.\\([0-9]+\\)" emacs-version)
(+ (* 100 (string-to-number
(substring emacs-version
(match-beginning 1)
(match-end 1))))
(string-to-number
(substring emacs-version
(match-beginning 2)
(match-end 2)))))))
(defun my-append (var arg &optional front)
"Appends ARG to VAR (which is a symbol). If FRONT is set, append to front
instead to tail"
(set var (if front
(append (list arg)
(eval var))
(append (eval var)
(list arg))
)))
(defun my-append-list (var arg &optional front)
"Appends ARG to VAR (which is a symbol). If FRONT is set, append to front
instead to tail"
(set var (if front
(append arg
(eval var))
(append (eval var)
arg)
)))
;;; XXX wenn domainname nicht gesetzt => (system-name) auseinandernehmen
(setq domain-name
(or (getenv "DOMAINNAME")
(progn
(condition-case ()
(kill-buffer "*domainname*")
(error nil))
(condition-case ()
(if (call-process "domainname" nil "*domainname*" nil)
(save-excursion
(set-buffer "*domainname*")
(buffer-substring (point-min) (1- (point-max)))))
(error nil)))
"unknown"))
(setq host-name (or (getenv "HOST")
(getenv "HOSTNAME")
(system-name) ; XXX strip domain!
"unknown"))
(setq english-styled-keyboard nil)
(setq is-ispell-installed nil)
(setq is-flyspell-installed nil)
;;;------------------------------------------------------------------
;;; zusätzlicher Suchpfad fuer Emacs-Lisp-Dateien
(my-append 'load-path (expand-file-name "~/emacs") t)
; t, damit gnus aus site-lisp Vorrang vor dem offiziellen gnus hat
(if (string-match "i386.*linux" system-configuration)
(my-append 'load-path "/usr/local/share/emacs/site-lisp" t))
;;;------------------------------------------------------------------
;;; my own autoloads
(load "~/emacs/loaddefs.el" t nil t)
;;;------------------------------------------------------------
;;; autoinsert from ~/emacs/insert
(if (>= emacs-subtype 2200)
(load "autoinsert" t nil)) ;; why?
(if (fboundp 'auto-insert)
(progn
(setq auto-insert-query nil)
(add-hook 'find-file-hooks 'auto-insert))
(load "autoinsert" t nil))
(setq auto-insert-alist nil) ;; alte Definitionen löschen
(setq auto-insert-directory (expand-file-name "~/emacs/insert/"))
;;;------------------------------------------------------------------
;;; my source repository
(autoload 'repository-insert "repository" "Source repository" t)
;;;------------------------------------------------------------------
;;; TeX und LaTex
(and (file-accessible-directory-p "/usr/TeX/lib/auctex")
(my-append 'load-path "/usr/TeX/lib/auctex"))
(load "tex-site" t nil)
(my-append 'auto-insert-alist '("\\.tex$" . "tex.tex"))
(setq TeX-open-quote "\"`")
(setq TeX-close-quote "\"'")
(setq tex-open-quote TeX-open-quote) ; standard TeX mode
(setq tex-close-quote TeX-close-quote)
;;;------------------------------------------------------------------
;;; Change Log
;;;------------------------------------------------------------------
;;; emacs lisp
(my-append 'auto-insert-alist '("\\.el$" . "emacs-lisp.el"))
;;;------------------------------------------------------------------
;;; XEmacs
(if (eq emacs-type 'xemacs)
(and (file-accessible-directory-p "/usr/local/lib/emacs/site-lisp")
(my-append 'load-path "/usr/local/lib/emacs/site-lisp")))
;;; ------------------------------------------------------------------
;;; text-mode
(add-hook 'text-mode-hook
(function (lambda ()
(if (not (eq major-mode 'html-mode))
(auto-fill-mode 1))
(if english-styled-keyboard
(iso-accents-german)
;;(iso2-accents-croatian)
))))
(my-append 'auto-mode-alist '("README$" . text-mode) t)
(setq sentence-end "[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*")
(setq sentence-end-double-space nil)
;;; ------------------------------------------------------------------
;;; twiki
;;;------------------------------------------------------------------
;;; perl
(condition-case ()
(progn
(cond
((file-exists-p "/usr/local/dist/cpan-manually/perl-5.8.x/emacs/cperl-mode.el")
(load "/usr/local/dist/cpan-manually/perl-5.8.x/emacs/cperl-mode.el"))
;((file-exists-p "/usr/local/src/perl-5.8.x/emacs/cperl-mode.el")
;(load "/usr/local/src/perl-5.8.x/emacs/cperl-mode.el"))
(t (load "cperl-mode")))
;(autoload 'perl-mode "cperl-mode" "alternate mode for editing Perl programs" t)
(setq cperl-indent-level 4)
(if (string-match "i[3456]86.*linux" system-configuration)
(fset 'perl-mode 'cperl-mode))
;; tut mir leid, Ilyaz --- es ist einfach zu langsam
(if (< emacs-subtype 2100)
(setq cperl-use-syntax-table-text-property nil))
(add-hook 'cperl-mode-hook (function (lambda ()
(cperl-set-style "PerlStyle"))))
(condition-case ()
(load "mode-compile")
(error nil))
)
(error nil))
(if (boundp 'cperl-mode-map)
(define-key cperl-mode-map "\C-c\C-c" 'comment-region))
(setq cperl-invalid-face nil)
;; space-efficient indentation
;(setq cperl-indent-parens-as-block t)
(my-append 'auto-mode-alist '("\\.\\([pP][Llm]x?\\|cgi\\|t\\|ppr\\)$" . perl-mode) t)
(my-append 'auto-mode-alist '("/repository/perl/" . perl-mode) t)
(my-append 'auto-mode-alist '("\\.xs$" . c-mode) t)
(my-append 'auto-insert-alist `("\\.\\([pP][lL]x?\\|cgi\\)$" .
,(cond
(t "perl.pl"))))
(my-append 'auto-insert-alist `("\\.pm$" .
,(cond
(t "perl-module.pm"))))
(my-append 'auto-insert-alist '(".*Tk.*\\.pm$" . "perl-widget.pm") t)
(my-append 'auto-insert-alist '("\\(^\\|[^g]\\)tk\\.pl$" . "perl-tk.pl") t)
(my-append 'auto-insert-alist '("gtk\\.pl$" . "perl-gtk.pl") t)
(my-append 'auto-insert-alist '("\\.t$" . "perl-test.t") t)
(my-append 'auto-insert-alist '("Makefile\\.PL$" . "Makefile.PL") t)
(my-append 'auto-insert-alist '("\\.ppr$" . "ppr.ppr") t)
(my-append 'interpreter-mode-alist '("miniperl" . perl-mode))
(and (eq emacs-type 'xemacs)
(put 'perl-mode 'font-lock-keywords 'perl-font-lock-keywords))
(defun perl-insert-data-dumper (&optional prefix)
(interactive "P")
(insert "require Data::Dumper; print STDERR \"Line \" . __LINE__ . \", File: \" . __FILE__ . \"\\n\" . Data::Dumper->new([")
(save-excursion
(insert "],[qw()])->Indent(1)->Useqq(1)")
(if prefix
(insert "->Deparse(1)"))
(insert "->Dump; # XXX\n"))
)
(defun perl-insert-data-dumper-deparse ()
(interactive)
(perl-insert-data-dumper "deparse"))
(defun perl-insert-yaml (&optional prefix)
(interactive "P")
(insert "require YAML::Syck; print STDERR \"Line \" . __LINE__ . \", File: \" . __FILE__ . \"\\n\" . YAML::Syck::Dump([");
(save-excursion
(insert "]); # XXX\n"))
)
(defun perl-insert-obj-scanner ()
(interactive)
(insert "use Tk::ObjScanner;use Tk;my $mw = tkinit;tkinit->ObjScanner(caller => )->pack;MainLoop;\n")
(forward-char -18))
(defun perl-insert-tracer ()
(interactive)
(insert "BEGIN {$Devel::Trace::TRACE=0}$Devel::Trace::TRACE=1;#XXX\n"))
(defun perl-insert-peek ()
(interactive)
(insert "use Devel::Peek; Dump ;#XXX\n")
(forward-char -6))
(defun perl-insert-bench ()
(interactive)
(insert "{our $XXX_last_t0; use Time::HiRes qw(gettimeofday tv_interval); if (defined $XXX_last_t0) { print STDERR \"Line \" . __LINE__ . \", File: \" . __FILE__ . \"\\n\" . tv_interval($XXX_last_t0) . \"s\\n\" } $XXX_last_t0 = [gettimeofday];}\n"))
(setq perl-insert-any-command 'perl-insert-data-dumper)
(defun perl-insert-any (&optional prefix)
(interactive "P")
(if prefix
(let* ((func (completing-read "Function to use: "
'(("perl-insert-data-dumper")
("perl-insert-data-dumper-deparse")
("perl-insert-yaml")
("perl-insert-obj-scanner")
("perl-insert-tracer")
("perl-insert-bench")
("perl-insert-peek")
)
nil t nil)))
(setq perl-insert-any-command (intern func))))
(funcall perl-insert-any-command))
(defun tt-insert-data-dumper ()
(interactive)
(insert "[% PERL %]\nrequire Data::Dumper; print STDERR \"Line \" . __LINE__ . \", File: \" . __FILE__ . \"\\n\" . Data::Dumper->new([$stash->get(\"\")],[])->Indent(1)->Useqq(1)->Dump; # XXX\n[% END %]\n")
(forward-char -52))
(autoload 'pod-mode "pod-mode" "mode for editing pod files" t)
(my-append 'auto-mode-alist '("\\.pod$" . pod-mode) t)
(my-append 'auto-insert-alist '("\\.pod$" . "perl.pod"))
;;;------------------------------------------------------------------
;;; tcl, tk
(my-append 'auto-mode-alist '("\\.\\(tcl\\|tk\\)$" . tcl-mode) t)
(my-append 'auto-insert-alist '("\\.tcl$" . "tcl.tcl"))
(my-append 'auto-insert-alist '("\\.tk$" . "tk.tk"))
;;;------------------------------------------------------------------
;;; Java
(my-append 'auto-mode-alist '("\\.java$" . java-mode) t)
(setq completion-ignored-extensions
(cons ".class" completion-ignored-extensions))
(my-append 'auto-insert-alist `("\\.java$" .
,(cond
(t "java.java")
)))
(add-hook 'java-mode-hook
(function (lambda ()
(if (string-match "\\.java$" (buffer-file-name))
(progn
(setq indent-tabs-mode nil)
(make-variable-buffer-local 'tab-width)
(setq tab-width 4))))))
(make-variable-buffer-local 'perltidy-profile)
(defun perltidy-region ()
"Run perltidy on the current region."
(interactive)
(save-excursion
(shell-command-on-region (point) (mark)
(concat "perltidy" (if perltidy-profile (concat " -pro=" perltidy-profile) "") " -q")
nil t)))
(defun perltidy-defun ()
"Run perltidy on the current defun."
(interactive)
(save-excursion (mark-defun)
(perltidy-region)))
;;;------------------------------------------------------------------
;;; Javascript, Hyperwave DC javascript
(my-append 'auto-mode-alist '("\\.dcjs$" . hyperwave-dcjs-mode) t)
(my-append 'auto-insert-alist '("\\.js$" . "js.js"))
(my-append 'auto-insert-alist '("\\.dcjs$" . "dcjs.js"))
(my-append 'auto-insert-alist '("\\.dcjs.hmi$" . "dcjs.hmi.js"))
(my-append 'auto-mode-alist `("\\.js$" .
'java-mode
) t)
;;;------------------------------------------------------------------
;;; python
;;;------------------------------------------------------------------
;;; Visual Basic
(autoload 'vb-mode "vb-mode" "Mode for Visual Basic scripts" t)
(my-append 'auto-mode-alist '("\\.\\(vba\\|asp\\|vbs\\)$" . vb-mode) t)
(if (or is-windowsnt
t)
(my-append 'auto-mode-alist '("\\.cls$" . vb-mode) t))
;;;------------------------------------------------------------------
;;; po-mode
(if (file-exists-p "/usr/local/share/emacs/site-lisp/po-mode.el")
(progn
(autoload 'po-mode "po-mode")
(my-append 'auto-mode-alist '("\\.po[tx]?\\'\\|\\.po\\." . po-mode))
(if (and (>= emacs-subtype 2000)
(not (eq emacs-type 'xemacs)))
(progn
(autoload 'po-find-file-coding-system "po-mode")
(modify-coding-system-alist 'file "\\.po[tx]?\\'\\|\\.po\\."
'po-find-file-coding-system)))))
;;;------------------------------------------------------------------
;;; Prolog
(if (not (string-match "freebsd" system-configuration))
(my-append 'load-path "/home/pub/lib/swipl/lisp"))
;;; ------------------------------------------------------------
;;; WWW
(if (not (eq window-system 'x))
(setq browse-url-browser-function 'browse-url-w3)
(if (>= emacs-subtype 2100)
(progn
(setq browse-url-browser-function 'browse-url-generic)
(if (string-match "biokovo-amd64" host-name)
(setq browse-url-generic-program "seamonkey")
(setq browse-url-generic-program "mozilla"))
(load "browse-url" t nil))))
;;; my be deleted?
;; ;; works only since browse-url 1.20, not included in 21.1
;; (if (fboundp 'browse-url-netscape)
;; (progn
;; (setq browse-url-browser-function 'browse-url-netscape)
;; (setq browse-url-galeon-new-window-is-tab t)
;; )
;; (setq browse-url-browser-function 'browse-url-netscape)
;; (setq browse-url-generic-program "mozilla")
;; (load "browse-url" t nil)
;;; my be deleted?
;; (defun browse-url-netscape (url &optional new-window)
;; "Ask the Netscape WWW browser to load URL.
;; Default to the URL around or before point. The strings in variable
;; `browse-url-netscape-arguments' are also passed to Netscape.
;;
;; When called interactively, if variable `browse-url-new-window-flag' is
;; non-nil, load the document in a new Netscape window, otherwise use a
;; random existing one. A non-nil interactive prefix argument reverses
;; the effect of `browse-url-new-window-flag'.
;;
;; When called non-interactively, optional second argument NEW-WINDOW is
;; used instead of `browse-url-new-window-flag'."
;; (interactive (browse-url-interactive-arg "URL: "))
;; ;; URL encode any `confusing' characters in the URL. This needs to
;; ;; include at least commas; presumably also close parens.
;; (while (string-match "[,)]" url)
;; (setq url (replace-match
;; (format "%%%x" (string-to-char (match-string 0 url))) t t url)))
;; (let* ((process-environment (browse-url-process-environment))
;; (process (apply 'start-process
;; (concat "netscape " url) nil
;; browse-url-netscape-program
;; (append
;; browse-url-netscape-arguments
;; (if (eq window-system 'w32)
;; (list url)
;; (list "-noraise"
;; "-remote"
;; (concat "openURL(" url ",new-tab"
;; ")")))))))
;; (set-process-sentinel process
;; `(lambda (process change)
;; (browse-url-netscape-sentinel process ,url)))))
;;
;; ; (setq browse-url-generic-args '("-n"))
;; )
;; (setq browse-url-new-window-flag t))
;; (let ((wwwbrowser "/home/e/eserte/src/perl/WWWBrowser"))
;; (cond
;; ((file-directory-p wwwbrowser)
;; (progn
;; (setq browse-url-browser-function 'browse-url-generic)
;; (setq browse-url-generic-program "perl")
;; (setq browse-url-generic-args `("-I" ,wwwbrowser ,(concat wwwbrowser "/anybrowser") "-nofork"))
;; ))
;; (t (setq browse-url-browser-function 'browse-url-netscape))))))
(if (not (string-match "freebsd" system-configuration))
(progn
(setq w3-default-homepage "http://www.cs.tu-berlin.de/"))
; (and (not (eq emacs-type 'xemacs))
; (my-append 'load-path "/usr/local/share/emacs/site-lisp/w3"))
(setq w3-default-homepage "http://www/"))
;; auf Linux:
(if (string-match "linux" system-configuration)
(my-append 'load-path "/usr/share/emacs/site-lisp/w3")
)
(setq w3-be-asynchronous t)
(setq w3-confirmation-func 'y-or-n-p)
(if (not (fboundp 'w3))
(progn
(autoload 'w3-preview-this-buffer "w3" "WWW Previewer" t)
(autoload 'w3-follow-url-at-point "w3" "Find document at pt" t)
(autoload 'w3 "w3" "WWW Browser" t)
(autoload 'w3-open-local "w3" "Open local file for WWW browsing" t)
(autoload 'w3-fetch "w3" "Open remote file for WWW browsing" t)
(autoload 'w3-use-hotlist "w3" "Use shortcuts to view WWW docs" t)
(autoload 'w3-follow-link "w3" "Follow a hypertext link.")
))
;;;------------------------------------------------------------------
;;; Template toolkit
;;; XXX maybe better use mmm-mode here!
;;(my-append 'auto-mode-alist
;; '("\\.tpl\\.html\\'" . tt-mode) t)
;;;------------------------------------------------------------------
;;; YAML
(condition-case ()
(progn
(add-to-list 'load-path "~/work2/yaml-mode/")
(load-library "yaml-mode")
(add-hook 'yaml-mode-hook
(function (lambda ()
(setq indent-tabs-mode nil)
;(set-buffer-file-coding-system 'utf-8)
)))
(my-append 'auto-mode-alist
'("\\.[yY][aA]?[mM][lL]$" . yaml-mode) t))
(error nil))
;;;------------------------------------------------------------------
;;; XML/XSL
;; load-path wird von 20er-Emacsen automatisch für alle Unterverzeichnisse
;; gemacht
(condition-case ()
(progn
(add-to-list 'load-path "~/emacs/nxml-mode/")
(load-library "rng-auto")
(my-append 'auto-mode-alist
'("\\.\\([xX][mM][lL]\\|wsdl\\|[xX][sS][lL]\\|rng\\|xhtml\\|xsd\\|xslt\\|menu\\)" . nxml-mode) t)
)
(error nil))
(if (and (not (fboundp 'nxml-mode))
(or (file-exists-p "/usr/local/share/emacs/site-lisp/psgml.elc")
(file-exists-p "/usr/local/share/emacs/site-lisp/psgml/psgml.el")))
(progn
(if (boundp 'sgml-mode-map)
()
(setq sgml-mode-map (make-sparse-keymap))
(define-key sgml-mode-map "\C-c\C-f" (make-sparse-keymap))
)
(setq sgml-catalog-files '("/usr/doc/share/sgml/catalog" "/usr/local/share/sgml/catalog" "catalog" "/usr/local/lib/sgml/catalog"))
(autoload 'sgml-mode "psgml" "SGML-Mode" t)
(autoload 'xml-mode "psgml" "XML-Mode" t)
(my-append 'auto-mode-alist '("\\.[xX][MmSs][lL]$" . xml-mode) t)
(setq sgml-indent-data t)
(setq sgml-set-face t)
(my-append 'auto-mode-alist '("\\.[xX][MmSs][lL]$" . sgml-mode) t)
)
)
(condition-case nil
(progn
(load-library "rnc-mode")
(setq auto-mode-alist
(cons '("\\.\\(rnc\\)\\'" . rnc-mode)
auto-mode-alist)))
(error nil))
;;;------------------------------------------------------------------
;;; HTML
(if (not (fboundp 'html-mode))
(progn
(if (or (eq window-system 'x)
(eq window-system 'w32)
(eq window-system 'win32))
(autoload 'html-mode "hilit-html" "HTML mode" t)
(autoload 'html-mode "html-mode" "HTML mode" t))
(my-append 'auto-mode-alist '("\\.html?$" . html-mode) t)
;;;(add-hook 'html-mode-hook text-mode-hook)
(add-hook 'html-mode-hook (function (lambda ()
(auto-fill-mode 0)
(and is-ispell-installed
(ispell-minor-mode 0))
(and is-flyspell-installed
(flyspell-mode 0)))))
))
(defun tt2-comment-region ()
(interactive)
(save-excursion
(goto-char (region-end))
(insert " %]")
(goto-char (region-beginning))
(insert "[%# ")
))
(if (boundp 'html-mode-map)
(define-key html-mode-map "\C-c\C-c\C-c" 'tt2-comment-region))
;;;------------------------------------------------------------------
;;; Makefile
(my-append 'auto-insert-alist '("Imakefile" . "imakefile.inc"))
(my-append 'auto-mode-alist '("[mM]akefile" . makefile-mode) t)
(my-append 'auto-insert-alist '("[mM]akefile" . "makefile.inc"))
(add-hook 'makefile-mode-hook
(function (lambda () (define-key makefile-mode-map
"$" 'self-insert-command))))
;;;------------------------------------------------------------------
;;; tab-mode
(my-append 'auto-mode-alist '("\\.tab$" . tab-mode) t)
;;;------------------------------------------------------------------
;;; Modula-2
(my-append 'auto-mode-alist '("\\.\\(mod\\|def\\)$" . modula-2-mode) t)
;;;------------------------------------------------------------------
;;; Shell
(autoload 'sh-mode "sh-script" "Shell mode" t)
(autoload 'sh-or-other-mode "sh-script" "Shell mode" t)
(setq sh-here-document-word "EOF")
(setq sh-indentation 8)
;;;-----------------------------------------------------------------
;;; Allgemein
(defun general-mode-c9-command ()
(interactive)
(cond
((string-match "\\.dcjs$" (buffer-file-name))
(hyperwave-switch-to-hmi))
((string-match "\\.hmi$" (buffer-file-name))
(hyperwave-switch-to-dcjs))
(t (my-checkin-macro))
))
(defun general-mode-c11-command ()
(interactive)
(cond
((string-match "\\(\\.dcjs\\|\\.hmi\\)$" (buffer-file-name))
(hyperwave-upload))
((or (eq major-mode 'perl-mode)
(eq major-mode 'cperl-mode))
(run-perl-example))
((eq major-mode 'html-mode)
(java-mode))
((eq major-mode 'java-mode)
(html-mode))
((eq major-mode 'nxml-mode)
(cperl-mode))
(t (error "No action for C-F11 in this mode"))
))
(defun general-mode-c12-command (&optional prefix)
(interactive "P")
(cond
((string-match "\\(\\.dcjs\\|\\.hmi\\)$" (buffer-file-name))
(hyperwave-dcjs-insert-debug))
((or (eq major-mode 'perl-mode)
(eq major-mode 'cperl-mode)
)
;(if prefix (perl-insert-obj-scanner)
(perl-insert-any prefix))
;)
((or (eq major-mode 'html-mode)
(eq major-mode 'java-mode))
(tt-insert-data-dumper))
((or (eq major-mode 'c++-mode)
(eq major-mode 'c-mode))
(c-toggle-source-header-file))
(t (error "No action for C-F12 in this mode"))
))
(defun general-mode-m12-command (&optional prefix)
(interactive "P")
(cond
((or (eq major-mode 'perl-mode)
(eq major-mode 'cperl-mode))
(perl-insert-any prefix))
(t (error "No action for M-F12 in this mode"))
))
(defun insert-tab-command ()
(interactive)
(insert "\t"))
;;; not extensively tested...
(defun unindent ()
(interactive)
(save-excursion
(beginning-of-line)
(let ((begin-line (point)))
(condition-case ()
(progn
(search-forward-regexp "[^ \t]" nil t) ;;; (1- (end-of-line))
(message (format "%d %d" begin-line (1- (point))))
(delete-region begin-line (1- (point))))
(error nil)))))
;;;-----------------------------------------------------------------
;;; emacs18-Kompatibilitaet
(if (< emacs-subtype 1900)
(setq ctl-arrow t))
(or (fboundp 'set-default-font)
(fset 'set-default-font 'x-set-font))
(or (fboundp 'set-cursor-color)
(fset 'set-cursor-color 'x-set-cursor-color))
(or (fboundp 'set-mouse-color)
(fset 'set-mouse-color 'x-set-mouse-color))
(or (fboundp 'x-display-color-p)
(fset 'x-display-color-p 'x-color-p))
(or (fboundp 'add-hook)
(defun add-hook (hook function &optional append)
(or (boundp hook) (set hook nil))
(let ((old (symbol-value hook)))
(if (or (not (listp old)) (eq (car old) 'lambda))
(set hook (list old))))
(or (if (consp function)
(let ((tail (assoc (cdr function) (symbol-value hook))))
(equal function tail))
(memq function (symbol-value hook)))
(set hook
(if append
(nconc (symbol-value hook) (list function))
(cons function (symbol-value hook)))))))
;;;------------------------------------------------------------------
;;; meine Makros
(fset 'my-checkin-macro
[?\C-x ?v ?= ?\C-x ?o ?\C-x ?\C-q ?\C-x ?o ?\C-x ?b return ?\C-x ?o])
;;;------------------------------------------------------------------
;;; Keyboards
(define-key global-map "\C-s" 'isearch-forward-regexp)
(define-key global-map "\C-r" 'isearch-backward-regexp)
(define-key global-map "\M-\C-s" 'search-forward-regexp)
(define-key global-map "\M-\C-r" 'search-backward-regexp)
(define-key global-map "\C-c\t" 'indent-region)
(if (< emacs-subtype 1900)
(load "sun-keymap" t nil)
(if (not (string-match "freebsd" system-configuration))
(progn
(define-key global-map [f13] 'query-replace)
(define-key global-map [f22] "\C-a\C-k")
(if (not (eq emacs-type 'xemacs))
(progn
(define-key global-map [S-left] 'beginning-of-line)
(define-key global-map [S-right] 'end-of-line)
(define-key global-map [C-left] 'backward-word)
(define-key global-map [C-right] 'forward-word)
(define-key global-map [C-down] 'end-of-buffer)
(define-key global-map [C-up] 'beginning-of-buffer)
))))
(if (not (eq emacs-type 'xemacs))
(progn
(define-key global-map [S-down] 'scroll-up-1)
(define-key global-map [S-up] 'scroll-down-1)
(define-key global-map [M-delete] 'delete-region)
(define-key global-map [C-f3] 'recursive-grep)
(define-key global-map [C-f4] 'find-name-dired)
(define-key global-map [C-f9] 'general-mode-c9-command)
(define-key global-map [S-f9] 'revert-buffer-noconfirm)
(define-key global-map [C-f10] 'repository-insert)
(define-key global-map [C-f11] 'general-mode-c11-command)
(define-key global-map [C-f12] 'general-mode-c12-command)
;;; C-f12 does not work on Solaris/CDE?!
(define-key global-map [S-f12] 'general-mode-c12-command)
(define-key global-map [M-f12] 'general-mode-m12-command)
(define-key global-map [S-iso-lefttab] 'insert-tab-command)
;;; Variant seen under MSWin32:
(define-key global-map [S-tab] 'insert-tab-command)
(define-key global-map [C-tab] 'unindent)
(global-set-key [M-up] 'pull-line-up)
(global-set-key [M-down] 'pull-line-down)
)
(define-key global-map [(shift down)] 'scroll-up-1)
(define-key global-map [(shift up)] 'scroll-down-1)
(define-key global-map [(meta delete)] 'delete-region)
(define-key global-map [(control f9)] 'general-mode-c9-command)
(define-key global-map [(shift f9)] 'revert-buffer-noconfirm)
(define-key global-map [(control f10)] 'repository-insert)
(define-key global-map [(control f11)] 'general-mode-c11-command)
(define-key global-map [(control f12)] 'general-mode-c12-command)
(define-key global-map [(meta f12)] 'general-mode-m12-command)
)
(define-key global-map [f2] 'compile)
(define-key global-map [f3] 'grep)
(define-key global-map [f4] 'gdb)
(autoload 'vip-paren-match "vip" "" t)
(define-key global-map [f5] 'vip-paren-match)
(define-key global-map [f6] 'goto-line)
(define-key global-map [f7] 'switch-to-buffer)
(define-key global-map [f8] 'other-window)
(define-key global-map [f9] 'bury-buffer)
;; XXX habe ich noch nie verwendet:
; (if (or (or (eq window-system 'x)
; (eq window-system 'w32)
; (eq window-system 'win32))
; (and (eq emacs-type 'gnu)
; (< emacs-subtype 1930)))
; (define-key global-map [f10] "\C-x\e\e\n")) ;; repeat complex command
(define-key global-map [f10] 'my-checkin-macro)
(define-key global-map [f11] 'undo)
(define-key global-map [f12] 'call-last-kbd-macro)
;; (if (>= emacs-major-version 21)
;; (setq mouse-wheel-mode t)
;; )
(define-key global-map [mouse-4] 'scroll-down)
(define-key global-map [mouse-5] 'scroll-up)
(define-key global-map [C-mouse-4] 'scroll-right)
(define-key global-map [C-mouse-5] 'scroll-left)
;; englische Tastatur :-(
(if english-styled-keyboard
(define-key global-map "\C-z" nil))
(if (or (eq emacs-type 'xemacs)
(>= emacs-major-version 21))
(progn
(define-key global-map [home] 'beginning-of-buffer)
(define-key global-map [end] 'end-of-buffer)))
(defadvice scroll-down (around srt-scroll-down first act)
"Scroll down or go to the begin of buffer"
(interactive)
(condition-case ()
ad-do-it
(error
(goto-char (point-min)))))
(defadvice scroll-up (around srt-scroll-up first act)
"Scroll up or go to the end of buffer"
(interactive)
(condition-case ()
ad-do-it
(error
(goto-char (point-max)))))
)
;; by Florian Ebeling
(defun pull-line-up ()
"Drags a line up by one, and moves point accordingly."
(interactive)
(transpose-lines 1)
(forward-line -2))
(defun pull-line-down ()
"Drags a line down by one, and moves point accordingly."
(interactive)
(forward-line 1)
(transpose-lines 1)
(forward-line -1))
(defun scroll-up-1 ()
(interactive)
(scroll-up 1))
(defun scroll-down-1 ()
(interactive)
(scroll-down 1))
;;; XXX oder soll ich:
;(setq scroll-step 1)
;;; benutzen?
(defun revert-buffer-noconfirm ()
(interactive)
(let ((revert-without-query '(".*")))
(revert-buffer)))
;;;------------------------------------------------------------------
;;; language specific settings (charsets etc.)
(setq latin1-language-selection '(latin1-German))
(setq latin2-language-selection '(latin2-Croatian latin2-German))
(if english-styled-keyboard
(or (assq 'iso-accents-minor-mode minor-mode-alist)
(setq minor-mode-alist
(append minor-mode-alist
'((iso-accents-minor-mode " ISO-Acc"))))))
(defun iso-accents-german (&optional arg)
(interactive)
(if (>= emacs-major-version 21)
(progn
(iso-accents-mode arg)
(iso-accents-customize "german")
)
(setq iso-accents-list
'(((?\" ?A) ?\304) ;; ((?A ?e) ?\304)
((?\" ?O) ?\326) ;; ((?O ?e) ?\326)
((?\" ?U) ?\334) ;; ((?U ?e) ?\334)
((?\" ?a) ?\344) ;; ((?a ?e) ?\344)
((?\" ?o) ?\366) ;; ((?o ?e) ?\366)
((?\" ?s) ?\337) ;; ((?u ?e) ?\337)
((?\" ?u) ?\374) ;; ((?s ?z) ?\374)
((?> ?>) ?\273)
((?< ?<) ?\253)
((?\\ ?S) ?\247)
((?^ ?o) ?\260)
((?^ ?0) ?\260)
((?^ ?1) ?\271)
((?^ ?2) ?\262)
((?^ ?3) ?\263)
((?^ ?x) ?\327)
((?^ ?/) ?\367)
((?+ ?-) ?\261)
((?' ?e) ?\351) ;; haeufig vorkommende franzoesische Sonderzeichen
((?` ?a) ?\340)
))
;;; in der neuen Version hoffentlich nicht mehr notwendig
;; (setq iso-accents-enable '(?\" ?\< ?\\ ?\> ?+ ?^ ?' ?`))
(iso-accents-mode arg)
;;; in der neuen Version hoffentlich nicht mehr notwendig
;; (define-key key-translation-map "<" 'iso-accents-accent-key)
;; (define-key key-translation-map ">" 'iso-accents-accent-key)
;; (define-key key-translation-map "\\" 'iso-accents-accent-key)
;; (define-key key-translation-map "^" 'iso-accents-accent-key)
;; (define-key key-translation-map "+" 'iso-accents-accent-key)
(let (res)
(while minor-mode-alist
(if (eq (car (car minor-mode-alist)) 'iso-accents-minor-mode)
(setq res (append res '((iso-accents-minor-mode " ISO-Acc German"))))
(setq res (append res (list (car minor-mode-alist)))))
(setq minor-mode-alist (cdr minor-mode-alist)))
(setq minor-mode-alist res)))
)
(defun common-set-lang (font acc syn dict)
(let ((all-faces nil))
(if (not (listp font))
(setq font (list font)))
(while font
(condition-case ()
(progn
(if all-faces
(mapcar (lambda (f) (set-face-font f (car font)))
(face-list))
(set-default-font (car font)))
(setq font nil))
(error (setq font (cdr font)))))
(if acc
(funcall acc t))
(if dict
(ispell-change-dictionary dict))
(condition-case ()
(load-library syn)
(error nil))
;; für den aktuellen Buffer einstellen
(set-case-table (standard-case-table))))
(defun croatian ()
(interactive)
(common-set-lang '("latin2"
"-etl-fixed-medium-r-normal--14-140-72-72-c-70-iso8859-2"
"*-iso8859-2")
'iso2-accents-croatian "iso02-syn" nil))
; (common-set-lang "latin2" 'iso2-accents-croatian "iso02-syn" nil))
(defun german ()
(interactive)
(common-set-lang '("-*-lucidatypewriter-bold-r-normal-sans-14-*-75-75-*"
"9x15bold"
"fixed")
(if english-styled-keyboard
'iso-accents-german
nil)
"iso-syntax"
"ndeutsch8"))
(defalias 'deutsch 'german)
(defun english ()
(interactive)
(common-set-lang "-*-lucidatypewriter-bold-r-normal-sans-14-*-75-75-*"
nil "iso-syntax"
(if (string-match "debian" system-configuration)
"british"
"english")))
(if (>= emacs-subtype 1900)
; (setenv "X_LC_CTYPE" "iso_8859_2")) ; duerfte im deutschen Raum
; ; kaum stoeren...
(setenv "X_LC_CTYPE" "iso_8859_1")) ; schließlich doch aufgegeben ...
(setenv "LC_TIME" "C") ; damit dired korrekt arbeitet
(setq sentence-end-double-space nil) ; Im Deutschen nicht üblich
;;; Warum auf Linux???
(if (or (string-match "linux" system-configuration)
is-windowsnt)
(standard-display-european 1))
;;; XXX weitermachen...
;(if (not (fboundp 'defgroup))
; (defun defgroup ()))
;(if (not (fboundp 'defcustom))
; (defun defcustom ()))
(if (>= emacs-subtype 1900)
(condition-case ()
(load "ispell" t)
(setq ispell-dictionary-alist
(append ispell-dictionary-alist
'(("ndeutsch8"
"[a-zA-Z\304\326\334\344\366\337\374]"
"[^a-zA-Z\304\326\334\344\366\337\374]"
"[']" t ("-C" "-d" "ndeutsch") "~latin1" iso-8859-1))))
(if (and (fboundp 'flyspell-mode)
is-flyspell-installed)
(add-hook 'text-mode-hook 'flyspell-mode)
(if (>= emacs-subtype 2000)
(load "~/devel/emacs/ispell" t)
(load "~/devel/emacs/ispell-19.34" t))
(add-hook 'mail-mode-hook
(function (lambda ()
(setq font-lock-defaults nil))))
(add-hook 'message-mode-hook
(function (lambda ()
(setq font-lock-defaults nil))))
(setq ispell-highlight-errors t)
(make-face 'ispell-false)
(set-face-underline-p 'ispell-false t)
(set-face-foreground 'ispell-false "red")
(setq ispell-error-face 'ispell-false)
(if (and (fboundp 'ispell-minor-mode)
is-ispell-installed)
(add-hook 'text-mode-hook 'ispell-minor-mode)))
(error nil))
)
;(setq ispell-dictionary "ndeutsch8")
;(setq ispell-dictionary (if (string-match "debian" system-configuration)
; "british"
; "english"))
;;; may fail if ndeutsch8 is not installed
(condition-case ()
(deutsch)
(error nil))
(if (fboundp 'modify-syntax-entry)
(progn
(modify-syntax-entry ?« ")»" text-mode-syntax-table) ; german quotes
(modify-syntax-entry ?» "(«" text-mode-syntax-table)))
;;;------------------------------------------------------------------
;;; C, C++
(and (fboundp 'tags-mouse-search)
(not (eq emacs-type 'xemacs))
(>= emacs-subtype 1900)
(< emacs-subtype 1930)
(define-key c-mode-map [down-double-mouse-1] 'tags-mouse-search))
(my-append 'auto-insert-alist `("\\.\\([ch]\\|cc\\|cpp\\)$"
. ,(cond
(t "c.c"))))
;; for Windows-C++:
(setq completion-ignored-extensions
(my-append-list
'completion-ignored-extensions '(".aps" ".bsc" ".clw" ".obj"
".pdb" ".sbr" ".tgt" ".vcw"
".wpj" ".wsp")))
;; for Carbide
(setq completion-ignored-extensions
(my-append-list
'completion-ignored-extensions '(".ARMV5.lst" ".WINSCW.lst")))
(setq parens-require-spaces nil)
(require 'cc-mode)
(setq c-default-style "stroustrup")
(c-set-offset 'arglist-close 0)
(defun c-toggle-source-header-file ()
(interactive)
(let* ((dirup (function
(lambda (path)
(if (string-match "^\\(.*\\)/[^/]+/[^/]+$" path)
(substring path (match-beginning 1) (match-end 1))))))
(basename (function
(lambda (path)
(if (string-match "/\\([^/]+\\)$" path)
(substring path (match-beginning 1) (match-end 1))))))
(new-file-name
(if (string-match "\\.h$" buffer-file-name)
(let* ((testfile (replace-regexp-in-string "\\.h$" ".cpp" buffer-file-name))
(testfile-in-src (concat (funcall dirup testfile) "/src/" (funcall basename testfile)))
(testfile-c (replace-regexp-in-string "\\.h$" ".c" buffer-file-name))
(testfile-c-in-src (concat (funcall dirup testfile-c) "/src/" (funcall basename testfile-c))))
(cond
((file-exists-p testfile) testfile)
((file-exists-p testfile-in-src) testfile-in-src)
((file-exists-p testfile-c) testfile-c)
((file-exists-p testfile-c-in-src) testfile-c-in-src)
(t testfile)))
(let* ((testfile (replace-regexp-in-string "\\.\\(cpp\\|c\\)$" ".h" buffer-file-name))
(testfile-in-inc (concat (funcall dirup testfile) "/inc/" (funcall basename testfile)))
(testfile-in-include (concat (funcall dirup testfile) "/include/" (funcall basename testfile)))
)
(cond
((file-exists-p testfile) testfile)
((file-exists-p testfile-in-inc) testfile-in-inc)
((file-exists-p testfile-in-include) testfile-in-include)
(t testfile))))))
(find-file new-file-name)))
;;;------------------------------------------------------------------
;;; send-pr to freefall
(autoload 'send-pr "send-pr" "Submit a Problem Report." t)
;;;------------------------------------------------------------------
;;; GNUS
(setq gnus-version nil) ;; verhindert das Laden von gnus2 im CS-Netz
;;;------------------------------------------------------------------
;;; Mail (Emacs-RMAIL/MAIL)
(if (>= emacs-subtype 1900)
(progn
(defadvice mail (after sendmail-extras first act)
(or (featurep 'sendmail-extras)
(load "sendmail-extras" t)))
(defadvice rmail (after rmail-extras first act)
(or (featurep 'rmail-extras)
(load "rmail-extras" t)))
))
(if (and (>= emacs-subtype 2000)
(< emacs-subtype 2003))
(progn
(add-hook 'mail-setup-hook (lambda ()
(setq enable-multibyte-characters nil)))
(setq rmail-enable-mime nil)
(setq mail-user-agent 'sendmail-user-agent)))
(if (>= emacs-subtype 2100)
(progn
(setq mail-user-agent 'message-user-agent)))
(add-hook 'mail-mode-hook 'mail-sigbanner)
(add-hook 'message-mode-hook 'mail-sigbanner)
(and (not (eq emacs-type 'xemacs))
(add-hook 'mail-setup-hook 'mail-abbrevs-setup))
(add-hook 'mail-setup-hook 'mail-insert-mailer-header)
(add-hook 'message-setup-hook 'mail-insert-mailer-header)
(if (< emacs-subtype 2100)
(progn
(add-hook 'mail-setup-hook 'mail-insert-mime-header)
(add-hook 'message-setup-hook 'mail-insert-mime-header)))
(if (not (boundp 'user-login-name)) ; anscheinend nicht in XEmacs definiert
(setq user-login-name (user-login-name)))
(defun mail-private-mail (&optional mail-address)
(interactive)
(save-excursion
(let (sep
(case-fold-search t)
(mail-signature-file (cond
(t "~/.signature")))
)
(if (not mail-address)
(setq mail-address my-private-mail-address))
; BCC und Reply-To löschen
(goto-char (point-min))
(setq sep (search-forward mail-header-separator))
(goto-char (point-min))
(if (re-search-forward "^Reply-To:.*" sep t)
(progn
(delete-region (progn (beginning-of-line) (point))
(progn (end-of-line) (1+ (point))))
))
(goto-char (point-min))
(setq sep (search-forward mail-header-separator))
(goto-char (point-min))
(if (re-search-forward "^BCC:.*" sep t)
(progn
(delete-region (progn (beginning-of-line) (point))
(progn (end-of-line) (1+ (point))))
))
(goto-char (point-min))
(setq sep (search-forward mail-header-separator))
(goto-char sep)
(beginning-of-line)
(insert (concat "Reply-To: " mail-address "\n"))
(insert (concat "BCC: " mail-address "\n"))
(goto-char (point-max))
(if (re-search-backward "^-- $"sep t)
(delete-region (point) (point-max)))
(mail-signature nil)
)))
(defun todo (&optional receiver)
(interactive)
(let ((mail-signature nil)
(mail-default-headers nil)
)
(mail nil receiver "todo: " nil nil)
(goto-char (point-min))
(search-forward "todo: ")
))
(defun show-todo ()
(interactive)
(gnus-summary-read-group "nnml+private:todo"))
(defun mail-fix-cc ()) ;;; XXX buggy
; (save-excursion
; (let (sep
; (my-mails '("eserte@cs.tu-berlin.de"
; "slaven@rezic.de")))
; (goto-char (point-min))
; (setq sep (search-forward mail-header-separator))
; (goto-char (point-min))
; (while my-mails
; (if (re-search-forward (concat "^Cc: " (car my-mails)) sep t)
; (progn
; (delete-region (progn (beginning-of-line) (point))
; (progn (end-of-line) (1+ (point))))
; )
; (setq my-mails (cdr my-mails)))))))
;; RMAIL/Mail and MIME
(condition-case ()
(progn
; (require 'mime)
;; mime and mime-compose do not work very well together?
;; mime seems to be buggy, use mime-compose instead...
(require 'mime-compose)
(require 'mime-compose-bugfix)
(setq mime-use-selective-display nil) ; macht sonst Probs
(setq mime-default-charset "ISO-8859-1")
:; (add-hook 'mail-setup-hook 'mime-mode)
)
(error nil))
(if (string-match "spiff" host-name)
(progn
(set-language-environment "Latin-9")
(setq message-default-charset 'iso-8859-15)))
(defun mail-was-header ()
(interactive)
(goto-char (point-min))
(if (search-forward-regexp "^Subject: *")
(let ((mark (point)))
(insert " (was: ")
(end-of-line)
(insert ")")
(goto-char mark))))
(defun mail-insert-mailer-header ()
(interactive)
(save-excursion
(goto-char (point-min))
(search-forward mail-header-separator)
(beginning-of-line)
(insert mail-mailer-header)
(mail-fix-cc)
))
(defun mail-insert-mime-header ()
(interactive)
(save-excursion
(goto-char (point-min))
(search-forward mail-header-separator)
(beginning-of-line)
(insert mail-my-mime-header)))
(defun mail-delete-mime-header ()
(interactive)
(save-excursion
(goto-char (point-min))
(delete-matching-lines "^mime-version:.*")
(delete-matching-lines "^content-type:.*")
(delete-matching-lines "^content-transfer-encoding:.*")
))
(setq mail-charset (let ((char-class (getenv "X_LC_CTYPE")))
(if char-class
(cond
((string= char-class "iso_8859_1")
"ISO-8859-1")
((string= char-class "iso_8859_2")
"ISO-8859-2")
(t "US-ASCII"))
"")))
(setq mail-my-mime-header (concat
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset="
mail-charset "\n"
(if (string= mail-charset "US-ASCII")
"" "Content-Transfer-Encoding: 8bit\n")
))
(setq mail-mailer-header (concat
"X-Mailer: GNU Emacs/sendmail"
(and (boundp 'mail-use-mime-mode)
mail-use-mime-mode
"+mime")
" [version "
emacs-version
"]\n"))
(setq mail-yank-prefix "> ")
(setq mail-yank-ignored-headers "^[^:]*:") ; ignore all headers at yank
(setq mail-aliases t)
(setq rmail-display-summary t)
(setq rmail-ignored-headers
(concat rmail-ignored-headers
(and rmail-ignored-headers
(not (string= rmail-ignored-headers ""))
"\\|")
"^x-mime-autoconverted:\\|^x-uidl:\\|^x-loop:"))
;;; (setq mail-archive-file-name rmail-file-name)
(and (eq emacs-type 'xemacs)
(string-match "freebsd" system-configuration)
(setq rmail-spool-directory "/var/mail/"))
(and (eq emacs-type 'xemacs)
(add-menu-button '("Apps")
["Read Mail (RMAIL)..." rmail t] "Send mail..."))
(setq message-send-mail-partially-limit 10000000)
;;; für rpost
(setq message-post-method '(rpost ""))
(setq message-default-headers
(let ((mail-default-reply-to (or mail-default-reply-to
(getenv "REPLYTO"))))
(if mail-default-reply-to
(concat "Reply-to: " mail-default-reply-to "\n")
"")))
(if (and (boundp 'my-local-mail-address)
(stringp my-local-mail-address))
(setq message-default-mail-headers
(concat "BCC: " my-bcc-address
"\nFrom: " my-real-user-name " <" my-real-mail-address ">\n")))
(setq message-default-news-headers (concat "FCC: ~/Mail/postings\n"))
(condition-case ()
(progn
(load "mailcrypt")
(setq mc-default-scheme 'mc-scheme-gpg)
)
(error nil))
;;;------------------------------------------------------------------
;;; Mail (VM)
(if (and (boundp 'my-real-mail-address)
(stringp my-real-mail-address))
(setq user-mail-address my-real-mail-address))
(autoload 'vm "vm" "Start VM on your primary inbox." t)
(autoload 'vm-other-frame "vm" "Like `vm' but starts in another frame." t)
(autoload 'vm-visit-folder "vm" "Start VM on an arbitrary folder." t)
(autoload 'vm-visit-virtual-folder "vm" "Visit a VM virtual folder." t)
(autoload 'vm-mode "vm" "Run VM major mode on a buffer" t)
(autoload 'vm-mail "vm" "Send a mail message using VM." t)
(autoload 'vm-submit-bug-report "vm" "Send a bug report about VM." t)
(setq vm-url-browser 'vm-mouse-send-url-to-netscape)
;;;------------------------------------------------------------------
;;; Mail (MH)
(setq mh-summary-height 10)
;;;------------------------------------------------------------------
;;; FAX
(setq sendfax-package "mgetty")
(autoload 'sendfax-buffer "sendfax"
"Pass the current buffer to the fax sub-system." t)
(autoload 'sendfax-region "sendfax"
"Send the contents of region to the fax sub-system." t)
(autoload 'fax-read-resource-file "faxutil"
"Read a fax resource file." t)
(autoload 'fax-define-fax-alias "faxutil"
"Define a fax alias." t)
(setq phone-number-international-prefix "00"
phone-number-long-distance-prefix "0"
phone-number-country-code "49"
phone-number-area-code "30")
;;;------------------------------------------------------------------
;;; VC - Version Control (RCS, cvs, svn)
(setq vc-follow-symlinks t)
(setq vc-consult-headers nil)
(setq vc-mistrust-permissions t) ;; kann z.B. bei gmake backup passieren
(if nil
(progn
(if (and (>= emacs-subtype 2100)
)
(add-to-list 'vc-handled-backends 'SVN))
(autoload 'svn-status "psvn" t)
))
;;; Subversion
(autoload 'svn-examine "psvn" "SVN" t)
;;; svk
;;; with emacs 22 the patched psvn should be used
(if (not (>= emacs-subtype 2200))
(condition-case ()
(load "vc-svk2.el")
(error nil)))
;;;------------------------------------------------------------------
;;; Dired
(if (and (>= emacs-subtype 2000)
(<= emacs-subtype 2002))
(setq dired-move-to-filename-regexp
" \\([A-Za-z\xa0-\xff][A-Za-z\xa0-\xff][A-Za-z\xa0-\xff] [0-3 ][0-9]\
\\|[0-3 ][0-9] [A-Za-z\xa0-\xff][A-Za-z\xa0-\xff][A-Za-z\xa0-\xff]\\)\
[ 0-9][0-9][:0-9][0-9][ 0-9] "))
(defun dired-mouse-find-file (event)
"In dired, visit the file or directory name you click on in this window."
(interactive "e")
(let (file)
(save-excursion
(set-buffer (window-buffer (posn-window (event-end event))))
(save-excursion
(goto-char (posn-point (event-end event)))
(setq file (dired-get-filename))))
(select-window (posn-window (event-end event)))
(find-file (file-name-sans-versions file t))))
(add-hook 'dired-load-hook
(function (lambda ()
(define-key dired-mode-map [mouse-2] 'dired-mouse-find-file)
)))
(setq dired-dwim-target t)
;;;------------------------------------------------------------------
;;; Speedbar
(setq speedbar-show-unknown-files t)
(setq speedbar-use-images nil)
(setq speedbar-tag-split-minimum-length 20000) ;; never use groups
;;;------------------------------------------------------------------
;;; Speichern
(defun chmod-after-save ()
(or (and (or (and (or (eq major-mode 'perl-mode)
(eq major-mode 'cperl-mode))
(not (string-match "\\.pm$" (buffer-file-name))))
(eq major-mode 'sh-mode)
(eq major-mode 'tcl-mode)
(eq major-mode 'python-mode)
(string-match "\\.js$" (buffer-file-name))
)
(eq (logand (file-modes (buffer-file-name)) ?\100) 0)
(call-process "chmod" nil 0 nil "ugo+rx" (buffer-file-name)))
(and (or (eq major-mode 'perl-mode)
(eq major-mode 'cperl-mode))
(string-match "\\.pm$" (buffer-file-name))
(call-process "chmod" nil 0 nil "ugo+r" (buffer-file-name)))
(and (or (string-match "\\.\\(bdes\\|cry\\|pgp\\)$" (buffer-file-name))
(and (string-match "/eserte/private/" (buffer-file-name))
(not (string-match "/eserte/private/firma/"
(buffer-file-name)))))
(call-process "chmod" nil 0 nil "go-rwx" (buffer-file-name)))
(and (string-match "/eserte/lv/"
(buffer-file-name))
(call-process "chmod" nil 0 nil "g+r" (buffer-file-name)))
(and (or (eq major-mode 'lisp-interaction-mode)
(eq major-mode 'html-mode)
(string-match "\\.css$" (buffer-file-name))
(string-match "\\.dcjs" (buffer-file-name)))
(call-process "chmod" nil 0 nil "ugo+r" (buffer-file-name)))
(and (string-match "\\(\\.emacs\\|\\.t?cshrc\\|\\.login\\|\\.logout\\|\\.xinitrc\\)"
(buffer-file-name))
(call-process "chmod" nil 0 nil "go+r" (buffer-file-name)))))
(if (not is-windowsnt)
(add-hook 'after-save-hook 'chmod-after-save))
;;;------------------------------------------------------------------
;;; Misc
(if (not (string-match "freebsd" system-configuration))
(progn
(autoload 'run-prolog "swi-prolog" "Run an inferior prolog process" t)
(autoload 'prolog-mode "swi-prolog" "SWI-Prolog mode" t)
(autoload 'getris "getris" "Famous russian game." t)
(autoload 'calc "calc" "GNU calculator." t)
(autoload 'mkdir-interactive "mkd" "Makes a new directory." t)
(autoload 'rmdir-interactive "mkd" "Removes a directory." t)
(autoload 'latin1-mode "latin1-mode" "" t)
(autoload 'tar-mode "tar++" t)
(autoload 'gopher "gopher" "Gopher mode" t)
(setq gopher-root-node (vector ?1 "root" "" "ftp.cs.tu-berlin.de" 70))
(autoload 'unshar-file "unshar" "unpack shell archives" t)
(autoload 'unshar-buffer "unshar" "unpack shell archives" t)
))
(autoload 'dict "dict" "Dictionary englisch->deutsch" t)
(setq search-slow-speed 2400)
(setq inhibit-startup-message t)
(setq visible-bell t)
(setq next-line-add-newlines nil)
(setq display-time-24hr-format t)
(if (not (string-match "dec" system-configuration))
(setq transient-mark-mode t))
;;; Drucken auf den Laserdrucker bzw. NEC P6
(if (not (string-match "freebsd" system-configuration))
(setq lpr-command "pslpr")
(setq lpr-page-header-switches '("-F")))
(setq ps-print-header nil)
;;; 8 bit input on syscons terminal
(setq terminal-is-freebsd-console
(and (string-match "freebsd" system-configuration)
(not window-system)
(getenv "TERM")
(string-match "^cons" (getenv "TERM"))))
;;; this is checked only on rxvt:
(setq terminal-is-xterm
(and (not window-system)
(getenv "TERM")
(string-match "^xterm" (getenv "TERM"))))
(if (or terminal-is-freebsd-console
terminal-is-xterm)
(progn
(if terminal-is-freebsd-console
(progn
;; Translate `C-h' to DEL.
(keyboard-translate ?\C-h ?\C-?)
;; Translate DEL to `C-h'.
(keyboard-translate ?\C-? ?\C-d)
))
(global-set-key "\M-d" 'my-insert-ae)
(global-set-key "\M-D" 'my-insert-Ae)
(global-set-key "\M-v" 'my-insert-oe)
(global-set-key "\M-V" 'my-insert-Oe)
(global-set-key "\M-|" 'my-insert-ue)
(global-set-key "\M-\\" 'my-insert-Ue)
(global-set-key "\M-_" 'my-insert-ss)
(defun my-insert-ae () (interactive) (insert "ä"))
(defun my-insert-Ae () (interactive) (insert "Ä"))
(defun my-insert-oe () (interactive) (insert "ö"))
(defun my-insert-Oe () (interactive) (insert "Ö"))
(defun my-insert-ue () (interactive) (insert "ü"))
(defun my-insert-Ue () (interactive) (insert "Ü"))
(defun my-insert-ss () (interactive) (insert "\337"))
))
(setq line-number-mode t)
(setq column-number-mode t)
;(which-func-mode t) ;; hmm, takes too much space in footer
(setq indicate-empty-lines t)
(if (fboundp 'blink-cursor-mode)
(blink-cursor-mode 0))
(if (fboundp 'tool-bar-mode)
(tool-bar-mode 0))
(if (and (>= emacs-major-version 21)
(< gc-cons-threshold 1000000))
(setq gc-cons-threshold 1000000))
(and (eq emacs-type 'xemacs)
;; überprüft Dateien auf Gleichheit bei Softlinks
(setq find-file-compare-truenames t)
;; Einfügen geschieht an der Stelle des _Maus_-Cursors XXX geht nicht!!!
;; (define-key global-map 'button2 'x-insert-selection)
;; der Iconname ist immer XEmacs
(setq frame-icon-title-format "XEmacs")
)
(setq diff-switches "-up")
(setq-default ediff-ignore-similar-regions t)
(setq grep-command (if (not is-windowsnt)
(concat (if (string-match "csh" (getenv "SHELL"))
"" "2>/dev/null ")
"grep -ins ")
"grep -ni "))
; add ":" to prompt pattern
(setq shell-prompt-pattern "^[^#$%>\n]*[#$%>:] *")
(setq uniquify-buffer-name-style 'post-forward-angle-brackets)
(if (fboundp 'iswitchb-mode)
(iswitchb-mode 1))
(condition-case ()
(progn
(require 'uniquify)
(uniquify-rationalize-file-buffer-names))
(error nil))
(defun recursive-grep ()
(interactive)
(let ((grep-command (concat (if (not is-windowsnt)
"2>/dev/null" "")
"grep -ins `find . -type f` -e ")))
(call-interactively 'grep)
))
(setq dabbrev-case-replace nil)
(defun sort-buffer (buffer)
"Sort contents of BUFFER alphabetically."
(interactive "B")
(save-excursion
(set-buffer buffer)
(sort-lines nil 1 (buffer-size))))
(if (fboundp 'show-paren-mode)
(show-paren-mode 1))
(condition-case ()
(progn
;;(add-to-list 'load-path "~/emacs/tramp/lisp/")
;;(add-to-list 'load-path "~/emacs/tramp/contrib/")
(require 'tramp) ; now assume it's normally installed. See ftp://ftp.gnu.org/gnu/tramp/
;;(setq tramp-default-method "scp")
(add-to-list 'tramp-default-method-alist '("localhost" "root" "sudo"))
)
(error nil))
;;; ------------------------------------------------------------------
;;; calendar and diary
(add-hook 'list-diary-entries-hook 'include-other-diary-files)
(add-hook 'diary-display-hook 'fancy-diary-display)
(setq diary-file "~/private/diary")
;;; Koordinaten von Berlin
(setq calendar-latitude 52.5)
(setq calendar-longitude 13.4)
;;; deutsches Kalenderformat
(setq calendar-week-start-day 1)
(setq m