;--------------------------------------------------------------------------------------- ;;Emacs Startup file for GNU Emacs, Windows NT ;;Author: Stefan Reichoer, stefan@xsteve.at ;--------------------------------------------------------------------------------------- (setq emacs-load-start-time (current-time)) (defconst win32p (eq system-type 'windows-nt) "Are we running on a WinTel system?") (defconst cygwinp (eq system-type 'cygwin) "Are we running on a WinTel cygwin system?") (defconst linuxp (or (eq system-type 'gnu/linux) (eq system-type 'linux)) "Are we running on a GNU/Linux system?") (defconst unixp (or linuxp (eq system-type 'usg-unix-v) (eq system-type 'berkeley-unix)) "Are we running unix") (defconst linux-x-p (and window-system linuxp) "Are we running under X on a GNU/Linux system?") (defconst xemacsp (featurep 'xemacs) "Are we running XEmacs?") (defconst emacs>=21p (and (not xemacsp) (or (>= emacs-major-version 21))) "Are we running GNU Emacs 21 or above?") (defvar emacs-debug-loading nil) ;;you can override some definitions in .emacs_pre ;;;path to ghostview ;(setq ghostview-executable "e:\\prg\\ghostgum\\gsview\\gsview32.exe") ;(setq gs-executable "e:\\prg\\gs\\gs6.50\\bin\\gswin32c.exe") ;;set window position and size ;(setq initial-frame-alist (x-parse-geometry "90x40+0+0")) ;cols x rows (character) +x+y (pixel) ;(modify-frame-parameters (selected-frame) initial-frame-alist) (defvar emacs-site-lisp-directory (concat (getenv "EMACS_DIR") "/site-lisp/")) (if unixp ;;path to ghostview on unix (progn (defvar ghostview-executable "gv") (defvar gs-executable "gs")) (defvar ghostview-executable "e:\\prg\\ghostgum\\gsview\\gsview32.exe") (defvar gs-executable "e:\\prg\\gs\\gs6.50\\bin\\gswin32c.exe")) (defmacro add-site-lisp-load-path (path) `(setq load-path (append (list (concat emacs-site-lisp-directory ,path)) load-path))) (defmacro add-load-path (path) `(setq load-path (append (list ,path) load-path))) (when emacs-debug-loading (defadvice load (before debug-log activate) (message "(Tip from Kai G): Now loading: %s" (ad-get-arg 0)))) ;; try to find the site-lisp directory in /opt/site-lisp (condition-case nil (find-library-name "xsteve-functions") (error (when (file-exists-p "/opt/site-lisp/xsteve/xsteve-functions.el") (setq emacs-site-lisp-directory "/opt/site-lisp/") (add-load-path emacs-site-lisp-directory)))) (defvar xsteve-emacs-feature-list nil) ;; possible features are: ;;(defvar xsteve-emacs-feature-list '(no-ipython)) (when (file-exists-p "~/.emacs_pre") (load (expand-file-name "~/.emacs_pre"))) (add-site-lisp-load-path "xsteve/") ;;; Stuff I need very often ;;look in lisp\cua-base.el for the mega cool features of this package!!! (if (fboundp 'cua-mode) (cua-mode t) ; very recent emacs (load "cua") (CUA-mode t) (setq CUA-mode-inhibit-method 'twice)) (setq cua-paste-pop-rotate-temporarily t) (setq x-select-enable-clipboard t) (setq set-mark-command-repeat-pop t) ; C-u C-SPC C-SPC ... cycles through the buffer local mark ring ;;; Hippie Expand ;; 22.02.2008: symbol-completion-try-complete seems also nice, e.g. for python (global-set-key [(super f5)] (make-hippie-expand-function '(xsteve-try-complete-with-calc-result try-expand-dabbrev-visible try-expand-dabbrev try-expand-dabbrev-all-buffers) t)) (global-set-key [(control f5)] (make-hippie-expand-function '(try-expand-line try-expand-line-all-buffers try-complete-file-name try-complete-lisp-symbol try-expand-dabbrev try-expand-dabbrev-all-buffers ) t)) (global-set-key [(control f6)] (make-hippie-expand-function '(senator-try-expand-semantic try-expand-whole-kill try-expand-dabbrev-from-kill) t)) ;;; Dabbrev (global-set-key [(f5)] 'dabbrev-expand) (setq dabbrev-case-fold-search nil) (setq dabbrev-case-replace nil) ;;;ido (when (require 'ido "ido" t) (ido-mode 'buffer) ;;(ido-mode) (setq ido-enable-flex-matching t) (setq ido-use-virtual-buffers t) (define-key ctl-x-map "\C-v" 'ido-find-file)) ;;;dired (setq dired-dwim-target t) (load "dired-x") ;; Don't copy files to open dired buffers via drag&drop (setq dired-dnd-protocol-alist nil) (setq dired-guess-shell-alist-user (list ;;(list "\\.fig" "c:\\utils\\4\\4nt /c fig2eps" "xfig") (list "\\.ps" "gv") (list "\\.doc" "oowriter") (list "\\.odt" "oowriter") (list "\\.ppt" "ooimpress") (list "\\.pps" "ooimpress") (list "\\.xls" "oocalc") (list "\\.sxc" "oocalc") (list "\\.\\(jpg\\|png\\)" "gimp" "xzgv") )) ;; (list "\\.pdf" "acroread"))) (add-to-list 'dired-guess-shell-alist-user '("\\.mpe?g$\\|\\.avi$" "avidemux" "mplayer")) (load "sorter" t t) ; sort dired listing (key s) ;rename regexp: from: \(.+\)\.cgi to: \1.el ;add marked files to archive: ! rar a -idp f1.rar * ;rename with wildcards ;For example, to rename tw1.dat and tw2.dat to dat.1tw and dat.2tw, you ;would give a rename mask of 'tw*.*' and a rename-to mask of '#2.#1tw'. ;(autoload 'dired-ren-command "dired-rename-commands" "simpler regexp rename" t) ;(autoload 'dired-cop-command "dired-rename-commands" "simpler regexp copy" t) ;(define-key dired-mode-map "\C-cR" 'dired-ren-command) ;(define-key dired-mode-map "\C-cC" 'dired-cop-command) (define-key dired-mode-map [(control shift r)] 'dired-rar-add-files) (when (require 'wdired nil t) (define-key dired-mode-map "r" 'wdired-change-to-wdired-mode)) ;use the lisp ls implementation (using this sort by extension works) (load "ls-lisp" t t) (setq ls-lisp-dirs-first t) (setq ls-lisp-use-insert-directory-program nil) ; needed on unix ;;(setq eshell-ls-use-in-dired t) (setq auto-mode-alist (cons '("[^/]\\.dired$" . dired-virtual-mode) auto-mode-alist)) ;(setq load-path (append ; (list (concat emacs-site-lisp-directory "dired-dd-0.9.1.19/")) ; load-path)) ; ;(setq dired-dd-no-fancy-stuff t) ;(when (require 'dired-dd "dired-dd" t) ; (define-key dired-dd-mode-map [S-down-mouse-1] 'dired-dd-drag-drop)) ;;for emacs 21.3: dired-view-command-alist (if xemacsp ;;;xemacs (progn (setq load-path (cons emacs-site-lisp-directory load-path))) ;;;gnu emacs (server-start) ;;Generic mode for batch files etc. (require 'generic-x) ;;recentf (require 'recentf) (recentf-mode 1) (setq recentf-max-saved-items 500) (setq recentf-max-menu-items 60) (setq recentf-exclude (append recentf-exclude '(".ftp:.*" ".sudo:.*"))) (setq recentf-keep '(file-remote-p file-readable-p)) ;;Use electric help (require 'ehelp) (define-key global-map "\C-h" 'ehelp-command) ;;Autorevertmode (global-auto-revert-mode)) ;;(defadvice revert-buffer (before yes activate) ;; "Always revert buffers visiting *.log files (without querying)." ;; (if (and buffer-file-name (string-match "\\.log\\'" buffer-file-name)) ;; (setq unread-command-events '(?y ?e ?s ?\r)))) ;--------------------------------------------------------------------------------------- ;;; common initialization ;--------------------------------------------------------------------------------------- (unless xemacsp (set-language-environment 'Latin-1)) ;(set-keyboard-coding-system 'iso-8859-1) ?? ;;; Default Settings (setq next-line-add-newlines nil) (setq track-eol nil) (setq make-backup-files nil) (line-number-mode 1) ; line-numbers (column-number-mode 1) (setq visible-bell t) ; no beeping (when (fboundp 'blink-cursor-mode) (blink-cursor-mode -1)) ; no blinking cursor (setq default-tab-width 4) (setq-default indent-tabs-mode nil) (setq imenu-max-items 40) (setq message-log-max 3000) ;(setq echo-keystrokes 0.1) (setq history-length 100) (setq line-number-display-limit 10000000) (setq sentence-end-double-space nil) (setq read-quoted-char-radix 10) ; accept decimal input when using ^q, e.g.: ^q 13 [RET] -> ^M ;;(setq yank-excluded-properties t) ; do not paste any properties (setq confirm-nonexistent-file-or-buffer t) ;;(setq directory-sep-char ?\\) (setq completion-ignored-extensions (remove ".pdf" completion-ignored-extensions)) (setq completion-ignored-extensions (remove ".dvi" completion-ignored-extensions)) (setq max-specpdl-size 32000) (setq max-lisp-eval-depth 32000) (setq apropos-sort-by-scores t) (setq-default case-fold-search t) ;; Allow to use C-l when isearch is active (setq isearch-allow-scroll t) ;(setq text-mode-hook 'turn-on-auto-fill) ;not always a good idea (put 'eval-expression 'disabled nil) (put 'narrow-to-region 'disabled nil) (setq confirm-kill-emacs 'y-or-n-p) ;; replace y-e-s by y (fset 'yes-or-no-p 'y-or-n-p) ;; Set the text for titlebar and icons, %f=filename, %b=buffername (setq frame-title-format (list "GNU Emacs " emacs-version "@" system-name " - " '(buffer-file-name "%f" "%b"))) (setq icon-title-format frame-title-format) (when emacs>=21p (setq-default cursor-in-non-selected-windows nil) (tool-bar-mode -1) (setq default-indicate-empty-lines t) ;(setq-default show-trailing-whitespace t) (setq dired-recursive-copies 'top) (setq dired-recursive-deletes 'top)) (require 'uniquify) (setq uniquify-non-file-buffer-names t) (setq uniquify-after-kill-buffer-p t) (setq uniquify-buffer-name-style 'post-forward-angle-brackets) (setq uniquify-ignore-buffers-re "\\`\\*") ;(toggle-uniquify-buffer-names) ;;;elib ;+(add-site-lisp-load-path "elib-1.0/") ;;;pcl-cvs (setq vc-dired-terse-display nil) ;; Set this to t if you do not want to have some ~ified cvs source files in your ;; working copy (setq vc-cvs-stay-local nil) (autoload 'cvs-annotate "cvs-annotate" "Annotate a cvs controlled file" t) (add-hook 'pcl-cvs-load-hook '(lambda () (define-key cvs-minor-mode-map [f6] 'cvs-mode-diff-other-window) (define-key cvs-mode-map [f6] 'cvs-mode-diff-other-window) (define-key cvs-minor-mode-map [(shift f6)] 'cvs-mode-pop-to-cvs-buffer) (define-key cvs-mode-map [(shift f6)] 'cvs-mode-commit) (define-key cvs-mode-map [(control shift ?u)] 'cvs-mode-file-dos2unix))) (add-hook 'log-edit-mode-hook '(lambda () (define-key log-edit-mode-map [f6] 'cvs-mode-diff-other-window) (define-key log-edit-mode-map [(shift f6)] 'cvs-mode-pop-to-cvs-buffer))) ;;; psvn (setq svn-status-prefix-key '[(hyper s)]) (require 'psvn) (define-key svn-log-edit-mode-map [f6] 'svn-log-edit-svn-diff) (defun xsteve-svn-log-edit-setup () (setq ispell-local-dictionary "english") (auto-fill-mode 1)) (add-hook 'svn-log-edit-mode-hook 'xsteve-svn-log-edit-setup) ;;; DVC (add-site-lisp-load-path "dvc/lisp") (defvar dvc-prefix-key '[(super t)]) ;; (setq dvc-completing-read-function 'ido-completing-read) (require 'dvc-autoloads nil t) ;;(setq vc-follow-symlinks nil) ;;;diff-mode (require 'diff-mode "diff-mode" t) (setq diff-switches "-u") ; Use -u for plain diff also (setq diff-default-read-only t) ;;; my precompiled functions (require 'xsteve-functions) ;;; Window System specific code (cond (window-system ;; use some nicer colors for font-lock mode ;=(set-face-foreground 'font-lock-comment-face "gray50") ;=(set-face-foreground 'font-lock-string-face "green4") (unless xemacsp (global-font-lock-mode t)) (setq font-lock-maximum-decoration t) (setq lazy-lock-defer-on-scrolling t) (if emacs>=21p (progn (setq font-lock-support-mode 'jit-lock-mode) ;; (setq jit-lock-stealth-time 16) ;; (setq jit-lock-stealth-nice 0.5) (setq font-lock-multiline t)) (setq font-lock-support-mode 'lazy-lock-mode)) ;(setq lazy-lock-defer-contextually t) ;(setq lazy-lock-defer-time 0) ;(font-lock-add-keywords 'c-mode '("\\") ) ;(defun highlight-my-keyword () ; "Highlight code documentation keyword." ; (setq font-lock-keywords ; (append font-lock-keywords ; '(("\\bFIXME\\\|\\bHACK\\\|\\bTODO" ; (0 'font-lock-warning-face t)))))) ;(set-background-color "old lace") ;(set-background-color "white") ;select a font interactive: ;(insert (concat "\n(set-default-font " (prin1-to-string (w32-select-font)) ")\n")) ;; the current selected font ;(insert (concat "\n(set-default-font " (prin1-to-string (cdr (assoc 'font (frame-parameters)))) ")\n")) ;; (set-default-font "-misc-fixed-medium-r-normal--14-*-*-*-*-*-fontset-startup") ;; Function Menu ;;(load "func-menu") ; load function menu ;;(define-key global-map [S-down-mouse-3] 'function-menu) (autoload 'color-theme-select "color-theme" "" t) ;; match Parantheses ;(require 'paren) (require 'stig-paren) ;better than paren for lisp code ;(show-paren-mode) ;(setq show-paren-style 'expression) ;highlighting during i-search (setq search-highlight t) ;highlight during query ;;(setq query-replace-highlight t) ;;(setq query-replace-lazy-highlight t) ; use a bar cursor (add-to-list 'default-frame-alist '(cursor-type . bar)) (add-to-list 'default-frame-alist '(cursor-type bar . 3)) (require 'mouse-copy) (global-set-key [M-down-mouse-1] 'mouse-drag-secondary-pasting) (global-set-key [M-S-down-mouse-1] 'mouse-drag-secondary-moving) ;; a better Mouse-Buffer-Menu - GNU Emacs (unless xemacsp (require 'msb)) ;; Buffers in an extra Frame ; (setq special-display-buffer-names ; '("*compilation*" "*grep*" "*tex-shell*")) ;(setq special-display-buffer-names ;'("*Occur*" "*LEO dictionary*")) )) ;;; Shadow out file name parts, that are no longer used when entering a file name (when (fboundp 'file-name-shadow-mode) (file-name-shadow-mode 1)) ;;;Printing (require 'printing nil t) (setq pr-gv-command ghostview-executable) (setq pr-faces-p t) ;print some faces in bold or italic, available faces are: ;font-lock-comment-face, font-lock-attribute-face, font-lock-value-face, ;font-lock-type-face, font-lock-keyword-face, font-lock-function-name-face, ;font-lock-string-face, font-lock-doc-string-face (setq ps-italic-faces '(font-lock-comment-face)) (setq ps-bold-faces '(font-lock-keyword-face font-lock-function-name-face)) ;(setq-default ps-underlined-faces nil) (setq ps-print-use-faces t) ; always print using faces (setq ps-print-color-p nil) ; don't use colors for printing (setq ps-paper-type 'a4 ) ; the type of paper ; page margins (setq ps-left-margin (/ (* 72 1.5) 2.54)) ; 1.5 cm (setq ps-right-margin (/ (* 72 0.7) 2.54)) ; 0.7 cm (setq ps-inter-column (/ (* 72 1.0) 2.54)) ; 1 cm ;(setq ps-bottom-margin (/ (* 72 0.5) 2.54)) ; 0.5 cm (setq ps-bottom-margin (/ (* 72 0.9) 2.54)) ; 0.9 cm (setq ps-top-margin (/ (* 72 0.8) 2.54)) ; 0.8 cm (setq ps-header-offset (/ (* 72 0.3) 2.54)) ; 0.3 cm (setq ps-header-line-pad 0.15) (setq ps-n-up-margin (/ (* 72 0.5) 2.54)) ; 0.5 cm ;print 2 columns (setq ps-n-up-printing 2) ;(ps-line-lengths) ;(setq ps-font-size '(7 . 8.5)) ;(setq ps-font-size '(5 . 6.5)) ;(setq ps-font-size '(14 . 6.5)) ;(setq ps-font-size 14) (setq ps-font-size 7) ;(setq ps-header-font-size '(10 . 12)) ;(setq ps-header-title-font-size '(12 . 14)) ;; If you have a duplex-capable printer (one that prints both sides of ;; the paper), set ps-spool-duplex to t. Ps-print will insert blank ;; pages to make sure each buffer starts on the correct side of the ;; paper. (setq ps-spool-duplex t) ;(setq ps-spool-tumble nil) ; binding on left or right of page (setq ps-spool-tumble t) ; binding on top or bottom of page ;//hostname/printer ;(setq ps-printer-name "//DILBERT/LJ4000r_ps") (setq ps-printer-name "//Homer/lj4050r_ps") ;(setq ps-printer-name "c:/temp/emacs_print.ps") (defun always-scroll-to-bottom (window display-start) (if (and window (window-live-p window)) (save-selected-window (select-window window) (save-restriction (widen) (save-excursion (if (eobp) (recenter -1))))))) ;seeems a little bit dangerous in emacs 20.4 ;(add-hook 'window-scroll-functions 'always-scroll-to-bottom) ;;;hide-show (require 'hideshow) (setq hs-minor-mode-hook nil) ; I do not like hs-hide-initial-comment-block (define-key hs-minor-mode-map [(S-down-mouse-2)] 'hs-mouse-toggle-hiding) ;;;hide-lines ; hide-lines, show-all-invisible (autoload 'hide-lines "hide-lines" "Hide lines based on a regexp" t) ;;; screen-lines (require 'screen-lines "screen-lines" t) ;(screen-lines-mode t) (global-set-key [(shift ? )] 'screen-lines-mode) (when (require 'etags-table nil t) ;; Setting etags-table-search-up-depth allows to automatically find a TAGS file for the given source file (setq etags-table-search-up-depth 10) ;; Note: etags-table-alist allows to specify a list of TAG files for a given source file ;;(setq etags-table-alist nil) ) ;; tags-files: M-x tags-files-grep is nice (autoload 'tags-files-grep "tags-files" "Grep the files in the current tags table for REGEXP." t) (autoload 'tags-files-list "tags-files" "List all files present in the current tags table." t) (autoload 'goto-last-change "goto-last-change" "Set point to the position of the last change." t) ;;; Global Key Definitions ;that is cool - now I have many more keys in emacs!!! yeah!!! ;you can use: shift,ctrl/control, alt, meta, super, hyper, or nothing at all ;(setq w32-lwindow-modifier 'hyper) ; lwindow acts as hyper ;(setq w32-rwindow-modifier t) ; rwindow is ignored ;(setq w32-apps-modifier nil) ; can now bind [apps] et al (setq w32-pass-lwindow-to-system nil w32-pass-rwindow-to-system nil) (setq w32-lwindow-modifier 'super) ; lwindow acts as super (setq w32-rwindow-modifier 'hyper) ; rwindow acts as hyper (setq xsteve-global-extra-key-map (make-keymap)) (global-set-key [(super z)] xsteve-global-extra-key-map) (define-key xsteve-global-extra-key-map "b" 'bbdb) (define-key xsteve-global-extra-key-map "m" 'bbdb-and-mail-with-default-mailer) ;often used super definitions ;(global-set-key [(super k)] '[?\C-x ?k return]) ;kill current buffer (global-set-key [(super k)] 'kill-this-buffer) (global-set-key [(hyper k)] 'bury-buffer) ;bury current buffer (global-set-key [(super w)] 'xsteve-copy-line) ;copy current line to copy buffer (global-set-key [(super control w)] '(lambda() (interactive) (xsteve-copy-line t))) ;append current line to copy buffer (global-set-key [(super q)] 'xsteve-copy-symbol-at-point) (global-set-key [(super control q)] 'xsteve-copy-buffer-file-name-as-kill) (global-set-key [(super n)] 'normal-mode) (global-set-key [(super f)] 'find-function) (global-set-key [(super control ? )] 'xsteve-remove-trailing-spaces) (global-set-key [(super control i)] 'increment-number-at-point) (global-set-key [(super ? )] 'whitespace-mode) (global-set-key [8388831] 'xsteve-exchange-slash-and-backslash) ;[(super ß)] (global-set-key [(super return)] 'auto-fill-mode) (global-set-key [(shift super return)] 'refill-mode) (global-set-key [(control super return)] 'xsteve-remove-control-M) (global-set-key [(control super u)] 'xsteve-untabify-buffer) ;;(global-set-key [(super g)] 'gnus) (global-set-key [(control super s)] 'xsteve-tags-search) (global-set-key [(control super ?5)] 'xsteve-tags-query-replace) (global-set-key [(super ?.)] 'xsteve-find-next-tag) (global-set-key [(super ?+)] 'pop-tag-mark) (global-set-key [(control super t)] 'select-tags-table) (global-set-key [(super v)] 'viper-mode) (global-set-key [(control super v)] 'viper-go-away) (defadvice viper-go-away (after viper-go-away-use-fundamental-mode activate) (setq-default major-mode 'fundamental-mode)) (global-set-key [(super s)] '(lambda() (interactive) (switch-to-buffer "*scratch*"))) (global-set-key [(control f10)] 'xsteve-switch-to-app-window) ;(global-set-key [(super h)] 'hscroll-mode) (global-set-key [(super h)] (if emacs>=21p 'toggle-truncate-lines 'hscroll-mode)) (global-set-key [(control super h)] 'highline-local-mode) (global-set-key [(super ?0)] 'setnu-mode) (global-set-key [(super c)] 'calendar) (global-set-key [(super l)] 'xdict-query) (global-set-key [(super control l)] 'xdict-query-with-word-at-point) (global-set-key [(control super ?c)] 'ediff-buffers) (global-set-key [(super ?1)] 'eshell-toggle-cd) (global-set-key [(control meta ?1)] 'eshell-toggle-cd) ;for unix ;(global-set-key [(super control ?1)] 'eshell) (global-set-key [(super control ?1)] 'toggle-shell-file-name) (global-set-key [(super ?2)] 'xsteve-split-window) (global-set-key [(control meta ?2)] 'xsteve-split-window) (global-set-key [(super ?3)] 'xsteve-flip-windows) (global-set-key [(control meta ?3)] 'xsteve-flip-windows) (global-set-key [(super meta f)] 'flyspell-mode) (global-set-key [(super ?7)] 'mouse-embrace-mode) ;(global-set-key [(super t)] 'todoo) (global-set-key [(super y)] 'browse-kill-ring) (global-set-key [(super i)] 'indent-region) ;;comment region && uncomment region (global-set-key [(super ?u)] 'comment-region) (global-set-key [(super ?U)] '(lambda(beg end) (interactive "r") (comment-region beg end '(1)))) (global-set-key [(super a)] 'progr-align) (global-set-key [(super control e)] 'xsteve-show-euro-as-ats) ;; some bindings for unix without super, hyper (global-set-key [(control A)] 'progr-align) (global-set-key [(control C)] 'calendar) (global-set-key [(control J)] 'webjump-w3m) ;(global-set-key [(control T)] 'todoo) (global-set-key [(control ?/)] 'mouse-embrace-mode) (global-set-key [(control shift ?l)] 'goto-last-change) (global-set-key [(control shift ?s)] 'w3m-search) ;less used super definitions (global-set-key [(super b)] 'bbdb) (global-set-key [(super shift d)] 'toggle-ispell-local-dictionary) (global-set-key [(control shift d)] 'toggle-ispell-local-dictionary) ;; for unix (global-set-key [(super shift t)] 'tmmofl-mode) ;(global-set-key [(super p)] 'xsteve-ps-print-buffer) ;(global-set-key [(super shift p)] 'xsteve-a2ps-print-buffer) ;(global-set-key [(super control p)] 'xsteve-ps-print-buffer-view) ;(global-set-key [(super meta p)] 'ps-print-toggle-landscape-mode) ;lets use the hyper key also: (global-set-key [(hyper p)] 'py-shell) ;;(global-set-key [(hyper h)] 'hs-hide-all) ;;(global-set-key [(hyper s)] 'hs-show-all) ;;(global-set-key [(hyper ?-)] 'hs-toggle-hiding) ;;(global-set-key [(hyper l)] 'goto-last-change) (global-set-key [(hyper n)] 'xsteve-toggle-narrow) (xsteve-define-alternatives 'ps-landscape-mode '(nil t)) (when win32p (w32-register-hot-key [snapshot]) (w32-register-hot-key [(control snapshot)]) (w32-register-hot-key [(shift snapshot)]) (define-key global-map [snapshot] 'xsteve-ps-print-buffer) (define-key global-map [(control snapshot)] 'xsteve-a2ps-print-buffer)) (when linuxp (define-key global-map [print] 'xsteve-ps-print-buffer) (define-key global-map [(control print)] 'toggle-ps-landscape-mode) ) ;;;global key bindings ;(global-set-key [delete] 'delete-char) ;(global-set-key [home] 'beginning-of-line) (global-set-key [home] 'xsteve-smart-home) (when (boundp 'cua-movement-commands) (add-to-list 'cua-movement-commands 'xsteve-smart-home)) (put 'xsteve-smart-home 'CUA 'move) (global-set-key [end] 'end-of-line) (global-set-key [(control end)] 'end-of-line) (global-set-key [(control home)] 'beginning-of-line) (global-set-key [(control prior)] 'beginning-of-buffer) (global-set-key [(control next)] 'end-of-buffer) (global-set-key [(meta up)] '(lambda() (interactive) (scroll-other-window -1))) (global-set-key [(meta down)] '(lambda() (interactive) (scroll-other-window 1))) (global-set-key [(meta right)] 'xsteve-scroll-right) (global-set-key [(meta left)] 'xsteve-scroll-left) (global-set-key [(meta kp-subtract)] '(lambda() (interactive) (shrink-window 1))) (global-set-key [(meta kp-add)] '(lambda() (interactive) (shrink-window -1))) (global-set-key [(control backspace)] 'join-line) (global-set-key [(control x) (control ?1)] 'xsteve-apply-initial-frame-alist) (global-set-key [(control x) (control ?2)] 'xsteve-ecb-toggle) (global-set-key [(control f1)] 'delete-other-windows) (global-set-key [(control f2)] 'delete-window) (global-set-key [(control ?<)] 'xsteve-resize-other-window) (global-set-key [f2] 'save-buffer) (global-set-key [(super f2)] 'ido-find-file) (global-set-key [f3] '(lambda() (interactive) (other-window -1))) (global-set-key [f4] '(lambda() (interactive) (other-window 1))) (global-set-key [(super f10)] 'xsteve-save-current-directory) (global-set-key [(super f6)] 'xsteve-generate-documentation) (global-set-key [(control super f6)] 'xsteve-recreate-tags) (global-set-key [f7] 'next-error) (global-set-key [(shift f7)] 'previous-error) ;some nice help stuff (global-set-key (kbd "\C-hK") 'find-function-on-key) (autoload 'flyspell-auto-correct-word "flyspell") (global-set-key [(control ?\;)] 'flyspell-auto-correct-word) ;override some seldom used emacs bindings (global-set-key [(control ?,)] 'ispell-word) ;(global-set-key [(control f)] 'ispell-word) ;(global-set-key [(control b)] 'bookmark-bmenu-list) ;override backward-char (global-set-key [(control meta t)] 'xsteve-insert-date) (global-set-key [(meta z)] 'zap-up-to-char) (global-set-key [(meta m)] 'xsteve-show-message-buffer) ;(load "echistory") (global-set-key [f10] 'electric-command-history) ;(global-set-key [f11] [?\C-u f12 down return]) ;(global-set-key [f11] [?\C-x ?b return]) (global-set-key [(shift f12)] 'electric-buffer-list) (global-set-key [(f12)] 'ibuffer) (global-set-key [(control f12)] 'xsteve-ido-choose-from-recentf) (global-set-key [(hyper f12)] 'recentf-open-files) (global-set-key [(meta f12)] 'xsteve-open-wiki-page) (global-set-key [(hyper ?b)] 'switch-to-buffer) (define-key ctl-x-map "%" 'toggle-read-only) (global-set-key [(control x) ?F] 'ff-get-other-file) (global-set-key [(control f8)] 'xsteve-occur-identifier) (global-set-key [(meta f8)] 'xsteve-find-in-files) ;(global-set-key [(super f8)] 'igrep-find) (global-set-key [(super f8)] 'xsteve-find-in-files-and-subdirs) (global-set-key [(hyper f8)] 'xsteve-tags-files-grep) (global-set-key [(control f4)] 'xsteve-replace-identifier) ;; integrate my occur and replace bindings in isearch (define-key isearch-mode-map [(control f8)] 'xsteve-occur-identifier) (define-key isearch-mode-map [(control f4)] 'xsteve-replace-identifier) ;; Since C-y now runs isearch-yank-kill, put isearch-yank-line on C-M-y (define-key isearch-mode-map [(control meta y)] 'isearch-yank-line) (global-set-key [(super f7)] 'xsteve-w3m-dwim) (global-set-key [(control super ?3)] 'w3m-bookmark-view) ;; (global-set-key [apps] 'grabbox-mode) ;; (global-set-key [(control meta ?g)] 'grabbox-mode) ;for unix ;;;Global mouse bindings (define-key global-map [mouse-3] 'imenu) (global-set-key [(super mouse-2)] 'browse-url-at-mouse) ;(global-set-key [C-down-mouse-2] 'bookmark-menu-jump) (define-key global-map [C-down-mouse-3] 'bookmark-menu-jump) (define-key global-map [(meta mouse-3)] 'bookmark-set) ;; setup cygwin on windows, if it is available (defvar cygwin-install-path "c:/cygwin") (when win32p (let ((cygwin-bin-path (concat cygwin-install-path "/bin"))) (when (file-exists-p cygwin-bin-path) ;; (setenv "PATH" (concat cygwin-bin-path ";" (getenv "PATH"))) (setenv "PATH" (concat (getenv "PATH") ";" cygwin-bin-path)) ;(add-to-list 'exec-path cygwin-bin-path nil) (add-to-list 'exec-path cygwin-bin-path t) (when (require 'cygwin-mount nil t) (cygwin-mount-activate))))) ;;I do not need/use the mule menu (global-unset-key [menu-bar mule]) (add-site-lisp-load-path "auctex/") (require 'tex-site nil t) ;;; Major Modes ;;; LaTeX-mode ;; TeX / Latex Modes ;; (defvar no-doc ;; "This function is part of AUC TeX, but has not yet been loaded. ;; Full documentation will be available after autoloading the function." ;; "Documentation for autoload functions.") ;; (defvar TeX-lisp-directory (concat emacs-site-lisp-directory "auctex/")) ;; (add-load-path TeX-lisp-directory) ;; ; use M-x TeX-auto-generate-global to parse all latex style files ;; (defvar TeX-macro-global ;; '("c:/texmf/tex/" "c:/localtexmf/tex/") ;; "*Directories containing the sites TeX macro files and style files.") ;;; make the paper format customizable via the format string %paperformat (eval-after-load 'tex '(progn (setq-default TeX-paper-format "a4") (make-variable-buffer-local 'TeX-paper-format) (add-to-list 'TeX-expand-list (list "%(paperformat)" 'TeX-paper-format)) (add-to-list 'TeX-expand-list (list "%(xdvipaperformat)" 'TeX-xdvi-paper-format)) (defvar TeX-paper-format "a4") (add-to-list 'TeX-command-list (list "dviPS" "dvips %d -Ppdf -G0 -j0 -t %(paperformat) -o %f" 'TeX-run-command nil t)) (add-to-list 'TeX-command-list (list "PS2pdf" "ps2pdf %s.ps" 'TeX-run-compile nil t :help "Convert ps to pdf")))) (defun TeX-paper-format () (cond ((string= TeX-paper-format "a4r") "landscape") (t TeX-paper-format))) (defun TeX-xdvi-paper-format () (cond ((string= TeX-paper-format "landscape") "a4r") (t TeX-paper-format))) ;; This hook will store bibitems when you save a BibTeX buffer. (add-hook 'bibtex-mode-hook 'BibTeX-auto-store) ;(autoload 'BibTeX-auto-store "latex" no-doc t) ;; (autoload 'tex-mode "tex" no-doc t) ;; (autoload 'plain-tex-mode "tex" no-doc t) ;; (autoload 'ams-tex-mode "tex" no-doc t) ;; (autoload 'TeX-auto-generate "tex" no-doc t) ;; (autoload 'TeX-auto-generate-global "tex" no-doc t) ;; (autoload 'TeX-insert-quote "tex" no-doc t) ;; (autoload 'TeX-submit-bug-report "tex" no-doc t) ;; (autoload 'japanese-plain-tex-mode "tex-jp" no-doc t) ;; (autoload 'japanese-latex-mode "tex-jp" no-doc t) ;; (autoload 'japanese-slitex-mode "tex-jp" no-doc t) ;; (autoload 'texinfo-mode "tex-info" no-doc t) ;; (autoload 'latex-mode "latex" no-doc t) ;; (provide 'tex-site) ;taken from tex-site.el - reftex needs this ;; ;; 01.06.2004 fix this eventually... ;; (setq TeX-auto-global "") ;; ;; 08.09.2005 fix again... ;; (setq AUCTeX-version "11.80") ;; (setq AUCTeX-date "11.80") ;; (setq TeX-data-directory TeX-lisp-directory) ;(when (and emacs>=21p (require 'tex-font nil t)) ; (tex-font-setup)) (require 'font-latex "font-latex" t) ;better fontification ;;add subdir doc to Info-default-directory-list ;; (setq Info-default-directory-list ;; (cons (concat (file-name-as-directory TeX-lisp-directory) "doc") ;; Info-default-directory-list)) ;(TeX-command "dviPS landscape" 'TeX-master-file) ;;RefTex (setq reftex-plug-into-AUCTeX t) (require 'reftex "reftex" t) (defun tex-build-command-function (cmd &optional recenter-output-buffer save-buffer override-confirm) "Build a TeX-command function." (` (lambda() (interactive) (when (, save-buffer) (save-buffer)) (when (, recenter-output-buffer) (TeX-recenter-output-buffer nil)) (TeX-command (, cmd) 'TeX-master-file (if (, override-confirm) 1 -1))))) (define-skeleton tex-insert-dollar "Inserts $$" nil "$" _ "$") ; (define-skeleton tex-insert-sig ; "Inserts \\sig{}" nil "\\sig{" _ "}") ; (define-skeleton skeleton-scrartcl "Inserts a Latex article skeleton into current buffer. This only makes sense for empty buffers." nil "\\documentclass[a4paper]{scrartcl}\n" "\\usepackage{ngerman}\n" "\\usepackage[latin1]{inputenc}\n" "\\begin{document}\n" _ "\n" "\\end{document}") (define-skeleton latex-description-textbf "Insert a latex description in bold face" nil "[\\textbf{" _ ":}] ") (setq LaTeX-extra-key-map (make-keymap)) (add-hook 'LaTeX-mode-hook 'xsteve-latex-mode-init) (defun xsteve-latex-mode-init() (interactive) (define-key LaTeX-mode-map [f6] (tex-build-command-function "LaTeX" nil t)) (define-key LaTeX-mode-map [(shift f6)] (tex-build-command-function "PdfLaTeX" t t)) (define-key LaTeX-mode-map [(super f6)] (tex-build-command-function "dviPS" t)) (when unixp (define-key LaTeX-mode-map [(meta f6)] (tex-build-command-function "dviPS" t))) (define-key LaTeX-mode-map [(super control f6)] (tex-build-command-function "dviPS landscape" t)) (define-key LaTeX-mode-map [(super meta f6)] (tex-build-command-function "PS2pdf" t)) (define-key LaTeX-mode-map [f7] 'TeX-next-error) (define-key LaTeX-mode-map [(shift f8)] (tex-build-command-function (if win32p "YAP" "View") nil)) (define-key LaTeX-mode-map [(super f8)] (tex-build-command-function "Ghostview" nil)) (define-key LaTeX-mode-map [(super meta f8)] (tex-build-command-function "View PDF" nil)) (define-key LaTeX-mode-map [f9] (lambda () (interactive) (save-buffer) (start-process-shell-command "scons-preview" nil "scons -u preview=1"))) (define-key LaTeX-mode-map [(control ?j)] 'reftex-toc) (define-key LaTeX-mode-map [(control tab)] 'TeX-complete-symbol) (define-key LaTeX-mode-map [(return)] 'newline-and-indent) (make-local-variable 'skeleton-end-hook) (setq skeleton-end-hook nil) (define-key LaTeX-mode-map [(super x)] LaTeX-extra-key-map) (define-key LaTeX-mode-map [(control ?X)] LaTeX-extra-key-map) (define-key LaTeX-extra-key-map "u" 'latex-insert-unit-command) (define-key LaTeX-extra-key-map "t" 'latex-description-textbf) ;;(define-key LaTeX-mode-map [(super ?4)] (tex-build-embrace-function "$" "$")) ;;(define-key LaTeX-mode-map [(meta s)] (tex-build-embrace-function "\\sig{" "}")) ;;(define-key LaTeX-mode-map [(super ?4)] 'tex-insert-dollar) ;;(define-key LaTeX-mode-map [(meta s)] 'tex-insert-sig) ;;(define-key LaTeX-mode-map [(meta k)] 'tex-insert-kw) (auto-fill-mode 1) (setq fill-column 90) (setq TeX-open-quote "\"\`") (setq TeX-close-quote "\"\'") ;;(setq TeX-open-quote "\"") ;;(setq TeX-close-quote "\"") (imenu-add-to-menubar "Structure") (turn-on-reftex) ; use reftex ;;some auctex stuff (setq TeX-macro-global (append '("f:/localtexmf/tex/latex/") TeX-macro-global)) (setq TeX-auto-save t) (setq TeX-parse-self t) (setq-default TeX-master nil)) ;;;TeX-Mode (add-hook 'TeX-mode-hook '(lambda () (setq TeX-open-quote "\"") (setq TeX-close-quote "\""))) ;;; bibtex (add-hook 'bibtex-mode-hook '(lambda () (define-key bibtex-mode-map (quote [246]) "{\\\"o}");ö (define-key bibtex-mode-map (quote [228]) "{\\\"a}");ä (define-key bibtex-mode-map (quote [252]) "{\\\"u}");ü )) ;;; latex-doc - get help for latex commands, environments, packages (add-site-lisp-load-path "latex-doc/") (when (require 'latex-doc nil t) (latex-doc-initialize)) (load "xsteve-latex" t) ;;;html mode (setq html-helper-mode-uses-visual-basic nil) (setq html-script-toggle-key (kbd "C-x ")) ;; don't override my F4 binding... (autoload 'html-helper-mode "html-helper-mode" "Yay HTML" t) (setq auto-mode-alist (cons '("\\.html?$" . html-helper-mode) auto-mode-alist)) (add-hook 'html-helper-mode-hook 'xsteve-html-helper-mode-init) (defun xsteve-html-helper-mode-init () (interactive) (when (require 'filladapt "filladapt" t) (set (make-local-variable 'filladapt-token-table) '( ;; this must be first ("^" beginning-of-line) ;; Hanging lists; see filladapt.el ("<\\([Ll][HhIi]\\|[Dd][DdTt]\\|[Tt][HhDd]\\)\\>[^>]*>" bullet) ;; don't touch ("[ \t]+" space) ("$" end-of-line)))) (setq indent-line-function 'indent-relative) (setq fill-column 90) (define-key html-helper-mode-map [(meta ?<)] 'sgml-close-tag) (define-key html-helper-mode-map [f6] 'xsteve-html-dwim) (define-key html-helper-mode-map [(meta f6)] 'xsteve-html-redisplay) (define-key html-helper-mode-map [(shift f6)] 'w3m-open-this-buffer)) (autoload 'htmlize-buffer "htmlize" "Convert buffer to HTML" t nil) ;;; cheetah (define-derived-mode cheetah-mode html-helper-mode "Cheetah" (make-face 'cheetah-variable-face) (font-lock-add-keywords nil '( ("\\(#\\(from\\|else\\|include\\|set\\|import\\|for\\|if\\|end\\)+\\)\\>" 1 font-lock-type-face) ("\\(#\\(from\\|for\\|end\\)\\).*\\<\\(for\\|import\\|if\\|in\\)\\>" 3 font-lock-type-face) ("\\(##.*\\)\n" 1 font-lock-comment-face) ("\\(\\$\\(?:\\sw\\|}\\|{\\|\\s_\\)+\\)" 1 font-lock-variable-name-face)) ) (font-lock-mode 1) ) (setq auto-mode-alist (cons '( "\\.tmpl\\'" . cheetah-mode ) auto-mode-alist )) ;;; megacool website updater wup (autoload 'wup "wup" "Recursive website update" t nil) ;;; table - edit tables with emacs, convert them to LaTeX, html (autoload 'table-insert "table" "Insert a table" t nil) (autoload 'table-recognize "table" "Recognize a table" t nil) (setq table-time-before-update 0) ;;; else mode (autoload 'else-mode "else-mode" "Emacs else mode" t nil) (setq else-set-lineno t) (eval-after-load "else-mode" '(progn (global-set-key [kp-add] '(lambda () (interactive) (if else-mode (else-expand-placeholder) (insert "+")))) (global-set-key [kp-subtract] '(lambda () (interactive) (if else-mode (else-kill-placeholder) (insert "-")))) (global-set-key [(control kp-add)] 'else-next-placeholder) (global-set-key [(control kp-subtract)] 'else-previous-placeholder))) ;;;perl mode (defun perl-run () (interactive) (start-process-shell-command "perl" "*perl-run*" "perl" (buffer-file-name))) (add-hook 'cperl-mode-hook '(lambda () (cperl-set-style "PerlStyle") (imenu-add-to-menubar "Functions") (define-key cperl-mode-map [return] 'newline-and-indent) (define-key cperl-mode-map [f6] 'perl-run))) ;(setq auto-mode-alist (append '(("\\.pl$" . cperl-mode)) auto-mode-alist)) (defalias 'perl-mode 'cperl-mode) ;;; c-mode (defun xsteve-c-mode-common-init() (interactive) (hs-minor-mode t) (setq fill-column 85) ;used for comments (setq c-basic-offset '2) ;;(setq c-comment-only-line-offset -1000) ;do not indent comment lines!!! (define-key c-mode-base-map "\C-M" 'reindent-then-newline-and-indent) (define-key c-mode-base-map [f6] 'recompile) (define-key c-mode-base-map [(meta right)] 'c-forward-into-nomenclature) (define-key c-mode-base-map [(meta left)] 'c-backward-into-nomenclature) (define-key c-mode-base-map [(meta ?A)] 'c-beginning-of-defun) (define-key c-mode-base-map [(meta ?E)] 'c-end-of-defun) (define-key c-mode-base-map [(control up)] 'senator-previous-token) (define-key c-mode-base-map [(control down)] 'senator-next-token) (define-key c-mode-base-map [(control ?j)] 'eassist-list-methods) (define-key c++-mode-map [(control c) ?e] 'c++-convert-to-method-body) ;;(define-key c++-mode-map [tab] 'xsteve-c-indent-command) (setq c-extra-key-map (make-keymap)) (define-key c-mode-base-map [(super x)] c-extra-key-map) (define-skeleton c-insert-LOG "Inserts LOG" nil "LOG(\"" _ "\");") (define-key c-extra-key-map "l" 'c-insert-LOG) ;;(when (require 'doxygen "doxygen" t) ;; (define-key c-mode-base-map [(super ?F)] 'doxygen-insert-function-comment)) (when (and (require 'url "url" t) (require 'doxymacs "doxymacs" t)) (setq doxymacs-doxygen-style "Qt") ;;(setq doxymacs-doxygen-tags "e:/projects/LewisProgrammer/Lewis.tag") ;;(setq doxymacs-doxygen-root "e:/projects/LewisProgrammer/doc/html") (define-key c-mode-base-map [(super ?F)] 'doxymacs-insert-function-comment) (define-key c-mode-base-map [(super ?S)] 'doxymacs-insert-blank-singleline-comment) (defun my-doxymacs-font-lock-hook () (if (or (eq major-mode 'c-mode) (eq major-mode 'c++-mode)) (doxymacs-font-lock))) ;;(add-hook 'font-lock-mode-hook 'my-doxymacs-font-lock-hook) ) ;;(when (require 'else-mode "else-mode" t) ;;(define-key c++-mode-map [(meta ?e)] 'else-expand-placeholder) ;;(define-key c++-mode-map [(meta ?k)] 'else-kill-placeholder) ;;(define-key c++-mode-map [(meta ?n)] 'else-next-placeholder) ;;(define-key c++-mode-map [(meta ?p)] 'else-previous-placeholder) ;;(define-key c++-mode-map [f1] (lookup-key else-mode-key-map [(control c) ?/]))) ;; For Java (deals with Javadoc comments) - and hopefully with doxygen, doc++: (when (require 'filladapt "filladapt" t) (set (make-local-variable 'paragraph-separate) "^\f\\|$\\|\\s-*\\(/\\*\\*?\\|\\*/?\\)\\s-*$") (set (make-local-variable 'paragraph-start) (concat paragraph-separate "\\|\\s-*\\(\\*\\s-*\\)?" "\\(@\\sw\\|<\\sw)")) (set (make-local-variable 'fill-column) 80) (set (make-local-variable 'filladapt-token-table) '( ;; this must be first ("^" beginning-of-line) ;; javadoc tags - @param, @see, etc. ;;("@\\(exception\\|throws\\|param\\|see\\)" bullet) ("\\\\\\(exception\\|throws\\|param\\|see\\)" bullet) ;;("@\\(exception\\|throws\\|param\\|see\\)\\s-+\\S-+" bullet) ("@\\(author\\|exception\\|param\\|return\\|see\\|version\\|deprecated\\)" bullet) ;; javadoc HTML ("<\\([Ll][HhIi]\\|[Dd][DdTt]\\|[Tt][HhDd]\\)\\>[^>]*>" bullet) ;; block comments ("/\\*\\*" javadoc-comment) ("/?\\*" c++-comment) ;;("/?\\*\\*?" space) ;; ordinary comments ("//+" c++-comment) ;; don't touch ("[ \t]+" space) ("$" end-of-line) )) (set (make-local-variable 'fill-paragraph-function) nil) (set (make-local-variable 'filladapt-token-conversion-table) (cons '(javadoc-comment . spaces) (default-value 'filladapt-token-conversion-table)))) (add-to-list 'c-hanging-semi&comma-criteria 'c-semi&comma-no-newlines-before-nonblanks) ;;make DEL take all previous whitespace with it (c-toggle-hungry-state 1) ;;(c-toggle-auto-state 1) (setq c-hanging-braces-alist'((brace-list-open) (brace-entry-open) (block-open after) (defun-block-intro after) (substatement-open after) (block-close . c-snug-do-while) (extern-lang-open after) (inexpr-class-open after) (inexpr-class-close before))) ;;make open-braces after a case: statement indent to 0 (default was '+) ;;(c-set-offset 'statement-case-open 0) ;;(c-set-offset 'statement-case-open '+) (c-set-offset 'case-label '+) ;;make a #define be left-aligned (setq c-electric-pound-behavior (quote (alignleft))) (make-variable-buffer-local 'c++-project) ;(imenu-add-to-menubar "Functions") ; does not work with semantic at the moment (setq c-font-lock-extra-types '("FILE" "UCHAR" "USHORT" "ULONG" "BOOL" "BOOLEAN" "LPCTSTR" "C[A-Z]\\sw+" "\\sw+_t")) (setq c++-font-lock-extra-types c-font-lock-extra-types) ;;(font-lock-add-keywords 'c-mode '("\\")) (setq compilation-read-command 'nil) (modify-syntax-entry ?_ "w") ;;(tmmofl-mode 1) (when (fboundp 'doxymacs-mode) (doxymacs-mode 1)) (setq ispell-local-dictionary "english")) (add-hook 'c-mode-common-hook 'xsteve-c-mode-common-init) (when (require 'cwarn "cwarn" t) (setq cwarn-configuration '((c-mode (not reference)) (c++-mode (not reference)))) (global-cwarn-mode 1)) ;;; nice parser for c/c++ to find identifiers (autoload 'gid "id-utils" "Interface to ID Utils" t) (setq gid-command "sh c:/cygwin/usr/local/bin/gid") ;;;VHDL-Mode ; this variable is buffer local, you can set it for every vhdl-file ; seperately by putting the following as first line in the vhdl-file: ; -- -*- mode: vhdl; vhdl-compiler-options: \"-93 -work ../work -quiet\" -*- (defvar vhdl-compiler-options "-work work") ;settings that cannot changed in vhdl-mode-hook (setq vhdl-highlight-special-words t) (setq vhdl-font-lock-type-face font-lock-type-face) ;;(setq vhdl-special-syntax-alist (quote (("type" "T_\\w+" "ForestGreen" "ForestGreen") ;; ("constant" "C_\\w+" "DarkGoldenrod" "DarkGoldenrod")))) (defvar vhdl-intelligent-tab nil) (defvar vhdl-standard '(93 nil)) ;(defvar vhdl-actual-port-name '(".*" . "\\&_i")) ;default (defvar vhdl-actual-port-name '(".*" . "\\&")); do not change ;(defvar vhdl-testbench-entity-name '(".*" . "\\&_tb") ;default (defvar vhdl-testbench-entity-name '(".*" . "test_\\&")) (defvar vhdl-clock-name "Clk") (defvar vhdl-reset-name "nReset") (defvar vhdl-file-header "\ ------------------------------------------------------------------------------- -- Title : -- Project : <project> ------------------------------------------------------------------------------- -- File : <filename> -- Author : <author> -- Company : <company> -- Created : <date> -- Last update: <date> -- Platform : <platform> <projectdesc>------------------------------------------------------------------------------- -- Description: <cursor> <copyright>------------------------------------------------------------------------------- -- Revisions : -- Date Version Author Description -- <date> 1.0 <login> Created ------------------------------------------------------------------------------- ") (defvar vhdl-file-footer "\ ------------------------------------------------------------------------------- -- Emacs Local Variables -- Local Variables: -- mode: vhdl -- vhdl-project: \"IrDA\" -- vhdl-compiler-options: \"-93 -work ../sim/work -quiet\" -- vhdl-modelsim-cmd: \"sim_irda_test1; run 8000\" -- End: ") (require 'vsim-nav nil t) (add-hook 'vhdl-mode-hook 'xsteve-vhdl-mode-init) (defun xsteve-vhdl-mode-init () (interactive) (hs-minor-mode t) ;;key definitions (unless (boundp 'vhdl-extra-key-map) (setq vhdl-extra-key-map (make-keymap))) (define-key vhdl-mode-map [(super x)] vhdl-extra-key-map) ;;(define-key vhdl-extra-key-map "u" 'vhdl...) (define-key vhdl-mode-map [return] 'xsteve-vhdl-electric-return) ;;(define-key vhdl-mode-map [(control ?m)] 'xsteve-vhdl-electric-return) (define-key vhdl-mode-map [f6] 'vhdl-save-and-compile) ;;(define-key vhdl-mode-map [tab] 'indent-according-to-mode) (define-key vhdl-mode-map [(hyper ?0)] "'0'") ;;(define-key vhdl-mode-map [(super ?1)] " = '1' ") ;;(define-key vhdl-mode-map [(super ?0)] " = '0' ") (define-key vhdl-mode-map [(meta ?s)] '(lambda() (interactive) (switch-to-buffer "startup.do"))) (define-key vhdl-mode-map [(super ?n)] 'vhdl-activate-new-font-lock-settings) (define-key vhdl-mode-map [(super ?b)] 'vhdl-beautify-this-block) (define-key vhdl-mode-map [(control ?B)] 'vhdl-beautify-this-block) ;on unix (define-key vhdl-mode-map "\C-c]" 'vhdl-finish-statement) (define-key vhdl-mode-map [(control c) (control p) ?p] 'vhdl-set-actual-port-name-postfix) (define-key vhdl-mode-map [(control c) (control p) ?s] 'vhdl-port-paste-signal-names) ;; template key bindings (define-key vhdl-mode-map [f1] vhdl-template-map) ;; ;;(define-key vhdl-mode-map [(control f8)] '(lambda() (interactive) (xsteve-sww "ModelSim") (xsteve-sww "xsteve"))) (define-key vhdl-mode-map [f8] 'vhdl-modelsim-server-send-fast-command) (define-key vhdl-mode-map [(super meta c)] 'vhdl-modelsim-server-connect) (define-key vhdl-mode-map [(super meta d)] 'vhdl-modelsim-server-disconnect) (make-variable-buffer-local 'vhdl-modelsim-cmd) ;;abbrevs ;;(define-abbrev vhdl-mode-abbrev-table "iff" "" 'vhdl-template-if-then) (easy-menu-change '("VHDL") "Modelsim" '(["Connect" (vhdl-modelsim-server-connect) t] ["Disconnect" (vhdl-modelsim-server-disconnect) t])) ;;settings (setq vhdl-testbench-create-files 'None) (setq vhdl-stutter-mode t) (setq vhdl-electric-mode nil) (setq vhdl-index-menu t) ;perhaps alter variable vhdl-imenu-generic-expression (setq vhdl-hideshow-menu t) (setq vhdl-source-file-menu t) (setq vhdl-self-insert-comments nil) (setq vhdl-end-comment-column 89) (setq vhdl-print-two-column nil) (setq paragraph-start "^----+\\( -- .+\\)+ ----+") (setq paragraph-separate paragraph-start) ;;modelsim error message regexp ;;(setq compilation-error-regexp-alist ;; '(("\\(** \\)?\\(ERROR\\|WARNING\\)[^:]*: \\(.+\\)(\\([0-9]+\\)):" 3 4))) (modify-syntax-entry ?_ "w") ;; important for vhdl-nav! (setq comment-padding 1) (setq vhdl-sourcefile-menu t) (when (file-exists-p "vhdl-project.el") (load (expand-file-name "vhdl-project.el")) (vhdl-font-lock-init) (vhdl-fontify-buffer))) (setq vhdl-compile-use-local-error-regexp nil) (require 'compile) (when (boundp 'compilation-error-regexp-alist-alist) (add-to-list 'compilation-error-regexp-alist-alist '(modelsim "\\(** \\)?\\(Error\\|Warning\\)[^:]*: \\(.+\\)(\\([0-9]+\\)):" 3 4)) (add-to-list 'compilation-error-regexp-alist 'modelsim)) (defadvice vhdl-ps-print-settings (after vhdl-print-no-underline activate) (message "no underline") (setq ps-underlined-faces nil)) ;; Activate the vhdl mode for modelsim *.vho files (setq auto-mode-alist (append '(("\\.vho$" . vhdl-mode)) auto-mode-alist)) ;;; Verilog-Mode (setq auto-mode-alist (append '(("\\.v$" . verilog-mode)) auto-mode-alist)) (autoload 'verilog-mode "verilog-mode" "Verilog mode" t ) ;;;synopsys dcshell mode: (autoload 'dcsh-mode "dcsh-mode" "Dcsh Mode" t) (setq auto-mode-alist (append (list (cons "\\.scr$" 'dcsh-mode) (cons "\\.dc$" 'dcsh-mode) (cons "\\.dcsh$" 'dcsh-mode) (cons "\\.setup$" 'dcsh-mode)) auto-mode-alist)) ;;; Spice mode (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t) (setq auto-mode-alist (cons '("\\.cir\\'" . spice-mode) auto-mode-alist)) ;;; graphwiz mode (autoload 'graphviz-dot-mode "graphviz-dot-mode" "graphviz-dot Editing Mode" t) (add-to-list 'auto-mode-alist '("\\.dot\\'" . graphviz-dot-mode)) ;;; Lua mode (autoload 'lua-mode "lua-mode" "Lua Editing Mode" t) (add-hook 'lua-mode-hook 'xsteve-lua-mode-init) (defun xsteve-lua-mode-init() (interactive) (imenu-add-to-menubar "Functions") (define-key lua-mode-map [return] 'reindent-then-newline-and-indent) (define-key lua-mode-map [f6] 'lua-send-buffer)) ;;; Python mode (add-site-lisp-load-path "python/") (require 'python-mode nil t) ;; prefer python-mode.el over python.el (require 'xsteve-python nil t) ;; (when win32p ;; (setq ipython-command "C:/Python25/Scripts/ipython.bat")) (unless (or win32p (member 'no-ipython xsteve-emacs-feature-list)) ;;(unless (member 'no-ipython xsteve-emacs-feature-list) (setq py-python-command-args nil) ;; we don't need the -i switch for ipython (require 'ipython nil t)) ;; use ipython (autoload 'py-shell "python-mode" "Start python shell" t) (setq auto-mode-alist (cons '("\\.py\\'" . python-mode) auto-mode-alist)) (setq py-imenu-show-method-args-p t) (add-hook 'python-mode-hook 'xsteve-python-mode-init) (defun xsteve-python-mode-init() (interactive) (define-abbrev python-mode-abbrev-table "def" "" 'python-insert-def) (define-skeleton python-insert-def "Inserts 'def :'" nil "def " _ ":") (imenu-add-to-menubar "Functions") (define-key py-mode-map [(control return)] 'py-execute-region) (define-key py-mode-map [f6] 'xsteve-py-execute-buffer) (define-key py-mode-map [(meta f6)] 'pylint) (define-key py-mode-map [(shift meta f6)] 'pylint-filter-local-ignores) (define-key py-mode-map [(f1)] 'di-browser-lookup) (define-key py-mode-map [(super f1)] 'xsteve-python-dwim-help) (define-key py-mode-map [(shift f1)] 'xsteve-python-dwim-help-set-prefix) (define-key py-mode-map [(control shift f1)] 'xsteve-python-help) (define-key py-mode-map [(control ?j)] 'eassist-list-methods) (define-key py-mode-map [(control ?c) ?d] 'xsteve-python-insert-debug-print-statement) (define-key py-mode-map [(meta s)] "self.") ;;(modify-syntax-entry ?' ".") ;; not always a good idea... ) (eval-after-load "python-mode" '(progn ;;python shell (define-key py-shell-map [(control a)] 'comint-bol-or-process-mark) (define-key py-shell-map [up] 'xsteve-py-up-arrow) (define-key py-shell-map [down] 'xsteve-py-down-arrow) (define-key py-shell-map [f6] 'xsteve-py-pop-to-source-buffer) (define-key py-shell-map "\C-c\C-k" 'comint-kill-subjob))) (require 'pydoc "pydoc" t) ;; load my python-exception-walker (when (require 'python-exception-walker nil t) (global-set-key [(super home)] 'python-exception-walker-beginning-of-traceback) (global-set-key [(super end)] 'python-exception-walker-locate-most-recent-error) (global-set-key [(super prior)] 'python-exception-walker-up) (global-set-key [(super next)] 'python-exception-walker-down) (global-set-key [(super insert)] 'python-exception-walker-analyze-getcaller-from-clipboard) ) ;;pymacs (unless (fboundp 'pymacs-eval) (autoload 'pymacs-eval "pymacs" nil t) (autoload 'pymacs-load "pymacs" nil t) (unless (fboundp 'puthash) (defalias 'puthash 'cl-puthash)) (setq pymacs-load-path (list (concat emacs-site-lisp-directory "python/")))) ;; doc-index-browser: ;;(when (require 'doc-index-browser nil t) ;; (setq di-browser-db-file "~/.doc-index-browser.db")) ;;; TCL-Mode (setq auto-mode-alist (append '(("\\.do$" . tcl-mode)) auto-mode-alist)) ; modelsim do files (defvar tcl-notify-modelsim-on-save nil "notify modelsim on save of buffer.") (defun xsteve-tcl-mode-init () (imenu-add-to-menubar "Functions") (define-key tcl-mode-map [f6] 'tcl-send-buffer) (define-key tcl-mode-map [f16] 'tcl-send-region) (define-key tcl-mode-map [f3] '( lambda() (interactive) (vhdl-modelsim-server-activate-and-send vhdl-modelsim-cmd))) (make-variable-buffer-local 'tcl-notify-modelsim-on-save) (add-hook 'after-save-hook 'xsteve-vhdl-tcl-after-save-function) (define-key tcl-mode-map [(super meta c)] 'vhdl-modelsim-server-connect) (define-key tcl-mode-map [(super meta d)] 'vhdl-modelsim-server-disconnect) ;;(setq tcl-default-application "c:/programme/tcl/bin/wish80") (modify-syntax-entry ?$ ".") (modify-syntax-entry ?_ "w")) (add-hook 'tcl-mode-hook 'xsteve-tcl-mode-init) (defvar xsteve-vhdl-tcl-after-save-send-command "do startup.do") (defun xsteve-vhdl-tcl-after-save-function () (interactive) (when tcl-notify-modelsim-on-save (vhdl-modelsim-server-send xsteve-vhdl-tcl-after-save-send-command)) nil) ;;; Emacs-Lisp-Mode (defun xsteve-emacs-lisp-mode-init () (interactive) (imenu-add-to-menubar "Functions") (define-key emacs-lisp-mode-map [f6] 'eval-buffer) (define-key emacs-lisp-mode-map [(meta f6)] 'emacs-lisp-byte-compile-and-load) (define-key emacs-lisp-mode-map [return] 'newline-and-indent) (define-key emacs-lisp-mode-map [?\C-c?t] 'xsteve-trace-function) (modify-syntax-entry ?- "w") (hs-minor-mode t) (turn-on-eldoc-mode)) (add-hook 'emacs-lisp-mode-hook 'xsteve-emacs-lisp-mode-init) ;;; Lisp Interaction-Mode ;;(add-hook 'lisp-interaction-mode-hook ;; '(lambda () ;; (define-key lisp-interaction-mode-map "" 'eval-print-last-sexp) ;; )) (add-to-list 'Info-default-directory-list (concat emacs-site-lisp-directory "info")) (autoload 'info-apropos "info-apropos" nil t) ;;; woman (setq woman-use-own-frame nil) (setq woman-fill-column 90) ;;; comint mode (setq comint-input-ignoredups t) (setq comint-input-ring-size 64) (add-hook 'comint-mode-hook '(lambda () (setq comint-scroll-show-maximum-output t))) (setq compilation-scroll-output t) (add-hook 'compilation-mode-hook (lambda () (define-key compilation-mode-map "R" 'global-replace-lines))) ;; if the modeline shows a wrong "Compiling" entry execute the following: ;; (setq compilation-in-progress nil) ;;; Other Packages ;;;nc (autoload 'nc "nc" "Emulate MS-DOG file shell" t) ;;;Emacs shell - eshell: more infos on: http://www.emacswiki.org/cgi-bin/wiki/CategoryEshell (require 'esh-toggle nil t) (setq eshell-scroll-to-bottom-on-output t) (setq eshell-scroll-to-bottom-on-input nil) (setq eshell-save-history-on-exit nil) (setq eshell-output-filter-functions '(eshell-handle-control-codes eshell-watch-for-password-prompt eshell-postoutput-scroll-to-bottom)) ;;(setq eshell-windows-shell-file "c:/utils/4/4NT.EXE") (when (load "esh-module" t) (setq eshell-modules-list (append eshell-modules-list '(eshell-xtra eshell-rebind eshell-smart))) (setq eshell-rebind-keys-alist '(([(control ?a)] . eshell-bol) ([home] . eshell-bol) ([backspace] . eshell-delete-backward-char) ([(control ?u)] . eshell-kill-input)))) ;; now you can use sb to switch to an existing buffer in the eshell (from kai großjohann) (defun eshell/sb (&rest args) "Switch to given buffer." (funcall 'switch-to-buffer (apply 'eshell-flatten-and-stringify args))) (defun pcomplete/sb () "Completion for sb (switch-to-buffer)." (while (pcomplete-here (mapcar 'buffer-name (buffer-list))))) (defun eshell/op (file) "Invoke (w32-shell-execute \"Open\" FILE) and substitute slashes for backslashes" (w32-shell-execute "Open" (substitute ?\\ ?/ (expand-file-name file)))) (defun eshell/less (&rest args) "Invoke `view-file' on the file. \"less +42 foo\" also goes to line 42 in the buffer." (while args (if (string-match "\\`\\+\\([0-9]+\\)\\'" (car args)) (let* ((line (string-to-number (match-string 1 (pop args)))) (file (pop args))) (view-file file) (goto-line line)) (view-file (pop args))))) ;;some eshell examples: ;for i in *.pm { rm $i; cvs remove $i } ;(setq eshell-cmpl-compare-entry-function ; (function ; (lambda (left right) ; (let ((exts completion-ignored-extensions) found) ; (while exts ; (if (string-match (concat "\\" (car exts) "$") right) ; (setq found t exts nil)) ; (setq exts (cdr exts))) ; (if found ; nil ; (file-newer-than-file-p left right)))))) ;use a unix shell (find works only with a unix shell) ;(setq shell-file-name "c:/bin/sh.exe") ;(xsteve-define-alternatives 'shell-file-name ; '("C:/emacs-20.4/bin/cmdproxy.exe" "c:/bin/sh.exe")) (xsteve-define-alternatives 'shell-file-name (list shell-file-name "c:/bin/sh.exe")) (autoload 'edit-env "edit-env" "Edit environment variables" t) ;;;calc package ;(add-site-lisp-load-path "calc/") (autoload 'quick-calc "calc" "Emacs Calculator" t nil) (autoload 'calc-dispatch "calc" "Emacs Calculator" t nil) (autoload 'calc-eval "calc" "Emacs Calculator" t nil) (global-set-key [(meta ?#)] 'calc-dispatch) (global-set-key [(super ?#)] 'xsteve-quick-calc) (global-set-key [(control ?')] 'xsteve-quick-calc) ;; for unix: Control Shift # (setq calc-settings-file "~/.emacs-calc") (load calc-settings-file t) (defun xsteve-quick-calc () (interactive) (when (symbol-plist 'calc-define) (load "calc") (calc-create-buffer) (kill-buffer "*Calculator*")) (quick-calc)) ;fix a bug in calc-do-quick-calc, if calc-define is set in .emacs-calc ;(defadvice calc-do-quick-calc (before calc-do-quick-calc-create-calc-buffer activate compile) ; (calc-create-buffer)) ;(defadvice calc-do-quick-calc (before calc-do-quick-calc-create-calc-buffer disable compile) ; (calc-create-buffer)) ;;some quick keys: ;m a ... enter algebraic mode ;N ... compute numeric value ;d 2 ... display binary ;a nice example ;(progn ; (calc-eval "3x=9y" 'push) ; (calc-solve-for "x") ; (calc-eval 1 'top)) ; => x = 3 y ;(progn ; (calc-eval "3x^2+x+1=9" 'push) ; (calc-poly-roots "x") ; (calc-eval 1 'top)) ; => [1.47480963363, -1.80814296697] (autoload 'calculator "calculator" "Run the Emacs calculator." t) (global-set-key [(hyper ?#)] 'calculator) ;;; sawfish (autoload 'sawfish-mode "sawfish" "sawfish-mode" t) (setq auto-mode-alist (append '(("\\.jl$" . sawfish-mode)) auto-mode-alist)) ;;; yacas mode (autoload 'yacas "yacas" "Start a yacas process" t nil) ;;;calendar (setq solar-holidays nil) (setq hebrew-holidays nil) (setq islamic-holidays nil) (setq oriental-holidays nil) (setq christian-holidays nil) (require 'calendar) ;(require 'astronomy "astronomy" t) (when (file-readable-p diary-file) (add-hook 'diary-display-hook 'fancy-diary-display) (add-hook 'list-diary-entries-hook 'sort-diary-entries t) (add-hook 'initial-calendar-window-hook 'mark-diary-entries)) (european-calendar) (font-lock-add-keywords 'fancy-diary-display-mode '(("^[0-9]+:[0-9]+ ?- ?[0-9]+:[0-9]+" . 'font-lock-variable-name-face))) (setq calendar-time-display-form '(24-hours ":" minutes (if time-zone " (") time-zone (if time-zone ")"))) ;; Display ISO week, available since 27.06.2008 (setq calendar-intermonth-header (propertize "WK" 'font-lock-face 'font-lock-function-name-face)) (setq calendar-intermonth-text '(propertize (format "%2d" (car (calendar-iso-from-absolute (calendar-absolute-from-gregorian (list month day year))))) 'font-lock-face 'font-lock-function-name-face)) (setq calendar-location-name "Linz, Austria") (setq calendar-latitude 48.32) (setq calendar-longitude 14.30) (setq calendar-daylight-savings-starts '(calendar-nth-named-day -1 0 3 year)) (setq calendar-daylight-savings-ends '(calendar-nth-named-day -1 0 9 year)) (setq calendar-week-start-day 1) (setq mark-holidays-in-calendar t) ;;(setq calendar-month-name-array [ "Januar" "Februar" "März" "April" "Mai" "Juni" "Juli" "August" ;; "September" "Oktober" "November" "Dezember" ]) ;;(setq calendar-day-name-array [ "Sonntag" "Montag" "Dienstag" "Mittwoch" "Donnerstag" "Freitag" ;; "Samstag" ]) (defun xsteve-holiday-easter-etc () "List of dates related to Easter, as visible in calendar window." ;algorithm taken from holiday.el ; but show only the holidays I want to see. (let* ((century (1+ (/ displayed-year 100))) (shifted-epact ;; Age of moon for April 5... (% (+ 14 (* 11 (% displayed-year 19));; ...by Nicaean rule (- ;; ...corrected for the Gregorian century rule (/ (* 3 century) 4)) (/ ;; ...corrected for Metonic cycle inaccuracy. (+ 5 (* 8 century)) 25) (* 30 century));; Keeps value positive. 30)) (adjusted-epact ;; Adjust for 29.5 day month. (if (or (= shifted-epact 0) (and (= shifted-epact 1) (< 10 (% displayed-year 19)))) (1+ shifted-epact) shifted-epact)) (paschal-moon ;; Day after the full moon on or after March 21. (- (calendar-absolute-from-gregorian (list 4 19 displayed-year)) adjusted-epact)) (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7))) (mandatory (list (list (calendar-gregorian-from-absolute abs-easter) "Ostersonntag") (list (calendar-gregorian-from-absolute (+ abs-easter 1)) "Ostermontag") (list (calendar-gregorian-from-absolute (+ abs-easter 39)) "Christi Himmelfahrt") (list (calendar-gregorian-from-absolute (+ abs-easter 49)) "Pfingstsonntag") (list (calendar-gregorian-from-absolute (+ abs-easter 50)) "Pfingstmontag") (list (calendar-gregorian-from-absolute (+ abs-easter 60)) "Fronleichnam") )) (output-list (filter-visible-calendar-holidays mandatory))) output-list)) (setq calendar-holidays '((holiday-fixed 1 1 "Neu Jahr") (holiday-fixed 1 6 "Hl. Drei Könige") (xsteve-holiday-easter-etc) (holiday-fixed 5 1 "Staatsfeiertag") (holiday-float 5 0 2 "Muttertag") (holiday-fixed 8 15 "Mariä Himmelfahrt") (holiday-fixed 10 26 "Nationalfeiertag") (holiday-fixed 11 1 "Allerheiligen") (holiday-fixed 12 8 "Mariä Empfängnis") (holiday-fixed 12 25 "Weihnachtstag") (holiday-fixed 12 26 "Stefanstag"))) (defadvice cal-tex-preamble (after xsteve-cal-tex-preamble activate compile) "Use LaTeX2e" (save-excursion (goto-char (point-min)) (search-forward "documentstyle" nil t) (replace-match "documentclass" nil t) (end-of-line) (insert "\n\\usepackage[latin1]{inputenc}\n"))) (defun xsteve-make-monthly-calendar () (interactive) (cal-tex-cursor-month-landscape) (write-file "c:/temp/calendar.tex" nil) (TeX-command "LaTeX" 'TeX-master-file) (sit-for 1) (TeX-command "dviPS" 'TeX-master-file)) (defun calendar-display-kw () (interactive) (message "%s is in KW%d" (calendar-date-string (calendar-cursor-to-date t)) (calendar-week-number (calendar-cursor-to-date t)))) (define-key calendar-mode-map "w" 'calendar-display-kw) (define-key calendar-mode-map "tt" 'xsteve-make-monthly-calendar) ; with t M you can get a texed calendar ; change month size from Huge to Large because I use A4 not the assumed letter format (setq cal-tex-cal-one-month "\\def\\calmonth#1#2% {\\begin{center}% \\Large\\bf\\uppercase{#1} #2 \\\\[1cm]% \\end{center}}% \\vspace*{-1.5cm}% % ") (setq cal-tex-daily-string '(let* ((year (extract-calendar-year date)) (day (calendar-day-number date)) (days-remaining (- (calendar-day-number (list 12 31 year)) day)) (kw (calendar-week-number date)) (is-monday (= 1 (calendar-day-of-week date))) (kw-str (if is-monday (format "KW%d: " kw) ""))) (format "%s%d/%d" kw-str day days-remaining))) ;; Locations for M-x display-time-world (setq display-time-world-list '(("America/Los_Angeles" "Seattle") ("America/New_York" "New York") ("Europe/London" "London") ("Europe/Paris" "Paris") ("Europe/Vienna" "Vienna") ("Asia/Calcutta" "Bangalore") ("Asia/Tokyo" "Tokyo"))) ;;; appt (setq appt-message-warning-time 17) (require 'appt) ;;(appt-activate 1) ;;;esheet (setq load-path (append (list (concat emacs-site-lisp-directory "esheet/")) load-path)) (autoload 'esheet-mode "esheet" t) (setq auto-mode-alist (append '(("\\.esh$" . esheet-mode)) auto-mode-alist)) ;;;dismal ;;(load (concat emacs-site-lisp-directory "dismal-1.4/dismal-mode-defaults.el") t) ;;; ses (autoload 'ses-mode "ses.el" "ses Spreadsheet mode" t) (add-to-list 'auto-mode-alist '("\\.ses$" . ses-mode)) ;;; find-library (on C-x L) (require 'find-library nil t) ;;;Power macros ;;(cond ((not xemacsp) ;; (require 'power-macros) ;; (power-macros-mode) ;; (pm-load))) ;;; escreen (when (load "escreen" t) (escreen-install) (add-hook 'escreen-goto-screen-hook 'escreen-enable-number-mode-if-more-than-one-screen) (escreen-number-mode -1) (global-set-key [(super ?+)] 'escreen-prefix) (define-key escreen-map [(super ?+)] 'escreen-goto-last-screen)) ;;;Speedbar (add-site-lisp-load-path "cedet/speedbar/") (add-site-lisp-load-path "cedet/common/") ;; ezimage: needed for speedbar (require 'speedbar) ;;(require 'sb-info "sb-info" t) ;speedbar support for info files (require 'sb-html nil t) (require 'sb-rmail "sb-rmail" t) (setq dframe-update-speed 30) (global-set-key [(f9)] 'speedbar-get-focus) (let ((vmap (make-sparse-keymap))) (define-key vmap "p" 'ede-speedbar) (define-key vmap "l" 'ede-load-project-file) ;; bind our submap into speedbar-key-map (define-key speedbar-key-map "v" vmap)) (define-key speedbar-key-map "#" (lambda () (interactive) (speedbar-change-initial-expansion-list "quick buffers"))) (define-key speedbar-key-map "-" (lambda () (interactive) (speedbar-change-initial-expansion-list "Project"))) (define-key speedbar-key-map "f" (lambda () (interactive) (speedbar-change-initial-expansion-list "files"))) (when (fboundp 'dframe-update-keymap) (dframe-update-keymap speedbar-key-map)) ;; Compatibility bug fix for speedbar and older packages: path -> directory (unless (boundp 'speedbar-ignored-path-expressions) (setq speedbar-ignored-path-expressions speedbar-ignored-directory-expressions) (defalias 'speedbar-line-path 'speedbar-line-directory)) (which-function-mode 1) (unless (member 'no-cedet xsteve-emacs-feature-list) ;; (setq semantic-load-turn-useful-things-on t) ;; (setq semantic-imenu-index-directory nil) (load-file (concat emacs-site-lisp-directory "cedet/common/cedet.el")) (load (concat emacs-site-lisp-directory "cedet/contrib/eassist.el") t) ;; (require 'semantic-ia nil t) ;; (require 'semantic-complete nil t) ; provides semantic-complete-jump, semantic-complete-jump-local ;; the following seems also useful, when emacs hangs on parsing! ;; (global-semantic-summary-mode -1) ; speeds things up ;;(semantic-load-enable-minimum-features) (semantic-load-enable-code-helpers) ;;(semantic-load-enable-excessive-code-helpers) ;;(semantic-load-enable-semantic-debugging-helpers) ;;(semantic-idle-scheduler-mode 1) (semantic-idle-scheduler-mode -1) ;;don't reparse the buffers (semantic-highlight-edits-mode -1) (semantic-show-unmatched-syntax-mode -1) (global-set-key [(super j)] 'xsteve-semantic-jump-to-function) ;;;eieio + ede ;;(add-site-lisp-load-path "cedet/eieio/") ;;(add-site-lisp-load-path "cedet/ede/") (require 'ede) (global-ede-mode t) (setq senator-step-at-token-ids '(function)) (setq senator-step-at-start-end-token-ids nil) (global-set-key [(s-down-mouse-3)] 'senator-completion-menu-popup) ;; (setq ecb-version-check nil) ;;; ecb (add-site-lisp-load-path "ecb/") ;; ;; (setq ecb-auto-activate nil) (when (require 'ecb nil t) (setq ecb-use-speedbar-for-directories t) (setq ecb-other-window-jump-behavior 'edit-and-compile) (setq ecb-auto-expand-tag-tree-collapse-other 'only-if-on-tag) (setq ecb-windows-width 0.25))) ; ;; (global-set-key [(meta ?e)] 'ecb-toggle-ecb-windows) ; (global-set-key (quote [67109116]) 'ecb-goto-window-history) ; control ü ; (global-set-key [(hyper j)] 'senator-jump) ; ;(setq ecb-show-sources-in-directories-buffer)...? ; (defvar ecb-increase-window-width 39) ; (setq ecb-frame-alist (copy-alist initial-frame-alist)) ; (setq ecb-toggle-layout-sequence '("left9" "left14")) ; ?? ; (setcdr (assoc 'width ecb-frame-alist) ; (+ (cdr (assoc 'width initial-frame-alist)) ecb-increase-window-width)) ; (add-hook 'ecb-activate-before-layout-draw-hook 'xsteve-apply-ecb-frame-alist) ; (add-hook 'ecb-deactivate-hook 'xsteve-apply-initial-frame-alist) ; ) ;; in conjunction with: (setq ecb-mode-line-display-window-number t) ;; (defun my-switch-to-window-number (number) ;; "Switch to the nth window" ;; (interactive "P") ;; (if (integerp number) ;; (select-window (nth number (window-list))))) ;; fix for using calendar and ecb ;;(add-hook 'initial-calendar-window-hook ;; (function (lambda () ;; (or (one-window-p t) ;; (/= (frame-width) (window-width)) ;; (and ecb-minor-mode (ecb-point-in-edit-window))) ;; (shrink-window (- (window-height) 9))))) (require 'wisent-python nil t) ;; use disable instead of activate to disable this advice ;; this advice is no longer needed since 08.03.2007 - Eric speeded up the parser significantly ;;(defadvice wisent-python-default-setup ;; (around xsteve-wisent-python-default-setup activate compile) ;; "Only activate the wisent python stuff for small buffers." ;; ;;(set (make-local-variable 'semantic-idle-scheduler-max-buffer-size) 10000) ;; (if (< (buffer-size) 50000) ;; ad-do-it ;; (message "Didn't activate wisent-python in %s" (buffer-name)))) ;;; ediff ;;(setq ediff-window-setup-function 'ediff-setup-windows-multiframe) ; standard setting (setq ediff-window-setup-function 'ediff-setup-windows-plain) (setq ediff-custom-diff-options "-u") ;(set-default 'ediff-ignore-similar-regions 't) ;;;Ibuffer (when (require 'ibuffer "ibuffer" t) (setq ibuffer-shrink-to-minimum-size t) ;;(setq ibuffer-always-show-last-buffer ':nomini) (setq ibuffer-always-show-last-buffer nil) (setq ibuffer-sorting-mode 'recency) (setq ibuffer-use-header-line t) (setq ibuffer-formats '((mark modified read-only " " (name 30 30) " " (size 6 -1) " " (mode 16 16) " " filename) (mark " " (name 30 -1) " " filename))) (define-key ibuffer-mode-map (kbd "#") 'ibuffer-switch-format)) ;;; irepeat: C-x b: irepeat-switch-to-buffer, C-c j irepeat-semantic-jump ;(require 'irepeat "irepeat" t) ; needs semantic ;;; bubble-buffer (when (require 'bubble-buffer nil t) (global-set-key [f11] 'bubble-buffer-next) (global-set-key [(shift f11)] 'bubble-buffer-previous)) (setq bubble-buffer-omit-regexp "\\(^ .+$\\|\\*Messages\\*\\|*compilation\\*\\|\\*.+output\\*$\\|\\*TeX Help\\*$\\|\\*vc-diff\\*\\|\\*Occur\\*\\|\\*grep\\*\\|\\*cvs-diff\\*\\|\\*modelsim\\*\\)") ;;; find-recursive is bound to C-x M-f (require 'find-recursive "find-recursive" t) (global-set-key [(meta ?L)] 'xsteve-locate) (define-key ctl-x-map [(super d)] 'xsteve-tramp) (define-key ctl-x-map [(super f)] 'xsteve-find-file-as-root) ;;; timeclock (when (require 'timeclock "timeclock" t) ;;(setq timeclock-workday (* 7.7 60 60)) (setq timeclock-workday (* 8 60 60)) (setq timeclock-relative t) (setq timeclock-use-display-time nil) ;(timeclock-modeline-display t) (define-key ctl-x-map "ti" 'timeclock-in) (define-key ctl-x-map "to" 'timeclock-out) (define-key ctl-x-map "tc" 'timeclock-change) (define-key ctl-x-map "tr" 'timeclock-reread-log) (define-key ctl-x-map "tu" 'timeclock-update-modeline) (define-key ctl-x-map "tw" '(lambda () (interactive) (message (timeclock-when-to-leave-string nil t)))) (define-key ctl-x-map "ts" 'timeclock-status-string) (define-key ctl-x-map "te" 'timeclock-visit-timelog) (define-key ctl-x-map "tl" 'timeclock-generate-report) (define-key ctl-x-map "tt" 'timeclock-modeline-display)) ; (defadvice timeclock-update-modeline (after xsteve-timeclock-modeline activate compile) ; "show nicer time" ; (let ((last-in (equal (car timeclock-last-event) "i"))) ; (setq timeclock-mode-string ; (format " %c%s%c" ; (if last-in ?< ?[) ; (timeclock-workday-remaining-string nil t) ; (if last-in ?> ?])))))) ;(timeclock-workday-remaining-string nil t) ;;; todoo (autoload 'todoo "todoo" "TODO Mode" t) (autoload 'todoo-mode "todoo" "TODO Mode" t) ;;; boxquote (when (require 'boxquote "boxquote" t) (global-set-key (kbd "C-c b y") 'boxquote-yank) (global-set-key (kbd "C-c b r") 'boxquote-region) (global-set-key (kbd "C-c b u") 'boxquote-unbox-region) (global-set-key (kbd "C-c b t") 'boxquote-title) (global-set-key (kbd "C-c b i") 'boxquote-insert-file) (global-set-key (kbd "C-c b k") 'boxquote-kill) (global-set-key (kbd "C-c b s") 'boxquote-shell-command) (global-set-key (kbd "C-c b b") 'boxquote-buffer) (global-set-key (kbd "C-c b p") 'boxquote-paragraph) (global-set-key (kbd "C-c b n") 'boxquote-narrow-to-boxquote) (global-set-key (kbd "C-c b w") 'boxquote-where-is) (global-set-key (kbd "C-c b d f") 'boxquote-describe-function) (global-set-key (kbd "C-c b d k") 'boxquote-describe-key) (global-set-key (kbd "C-c b d v") 'boxquote-describe-variable)) ;;;bbdb (add-site-lisp-load-path "bbdb/lisp/") (when (require 'bbdb "bbdb" t) (require 'bbdb-print) (require 'bbdb-query nil t) ; nice functions: bbdb-append, bbdb-keep, bbdb-flush ;; (setq bbdb-complete-name t) ?? (bbdb-initialize 'gnus 'w3 'sendmail) (add-hook 'mail-setup-hook 'mail-abbrevs-setup) (add-hook 'mail-setup-hook 'bbdb-define-all-aliases) (add-hook 'mail-setup-hook 'bbdb-insinuate-sendmail) (when (require 'message nil t) (bbdb-insinuate-message)) (setq bbdb-no-duplicates-p nil) ; must be set to nil to edit a list of email addresses (setq bbdb-hashtable-size 200003) (setq bbdb-north-american-phone-numbers-p nil) (setq bbdb-pop-up-elided-display-fields '(net)) ;(setq bbdb-file-coding-system 'iso-2022-7bit) (setq bbdb-file-coding-system 'emacs-mule) ;(add-to-list 'auto-coding-alist '("\\.bbdb\\'" . utf-8)) ?? ;(setq bbdb-send-mail-style 'message) (setq bbdb-send-mail-style 'compose-mail) (setq bbdb-dwim-net-address-allow-redundancy t) (setq bbdb-complete-name-allow-cycling t) (setq bbdb-completion-type 'primary-or-name) (setq bbdb-define-all-aliases-mode 'all) (setq bbdb-default-country nil) (setq bbdb-default-phones-label "Telefon") ;?? not yet? (setq bbdb-print-file-name (if win32p "c:/temp/bbdb.tex" "~/work/emacs/bbdb/bbdb.tex")) (setq bbdb-print-elide '(tex-name aka mail-alias timestamp creation-date)) (setq bbdb-print-prolog (concat bbdb-print-prolog "\\input texnansi\n\n")) (setq bbdb-print-require t) (define-key bbdb-mode-map "w" 'xsteve-bbdb-copy-mail-address) (define-key bbdb-mode-map "M" 'bbdb-mail-with-default-mailer) (define-key bbdb-mode-map [(meta ?c)] 'bbdb-category)) ;;; emacs-wiki ;; no longer maintained, will be superseded by emacs-muse... (add-site-lisp-load-path "emacs-wiki/") (load "emacs-wiki" t) (setq emacs-wiki-browse-url-function 'w3m-browse-url) ;;; emacs-muse (add-site-lisp-load-path "emacs-muse/lisp/") (require 'muse-mode nil t) (require 'muse-wiki nil t) (require 'muse-html nil t) (require 'muse-latex nil t) (define-skeleton xsteve-muse-examplify "Insert a muse example region." nil "<example>\n" _ "</example>\n") (defun xsteve-muse-mode-init () (interactive) (define-key muse-mode-map [(control c) ?e] 'xsteve-muse-examplify)) (add-hook 'muse-mode-hook 'xsteve-muse-mode-init) ;;; planner ;(add-site-lisp-load-path "planner/") (add-site-lisp-load-path "planner-muse/") (when (require 'planner nil t) (require 'planner-bbdb) (require 'planner-id) (require 'planner-multi) (require 'planner-gnus) (when (featurep 'xtla) (require 'planner-xtla)) (require 'planner-accomplishments) ; M-x planner-accomplishments-show after M-x plan (require 'planner-tasks-overview) ; M-x planner-tasks-overview ;;(setq planner-renumber-tasks-automatically t) (setq planner-task-dates-favor-future-p t) (setq planner-carry-tasks-forward 7) (global-set-key [(super ?p)] 'plan) (global-set-key [(control super ?p)] 'planner-create-task-from-buffer) (global-set-key [(meta super p)] 'planner-annotation-as-kill) (planner-calendar-insinuate) ; n and N show the planner page from the calendar buffer (when (file-readable-p diary-file) (require 'planner-diary) (setq planner-diary-number-of-days 5) ;;(setq planner-day-page-template "* Tasks\n\n\n* Schedule\n\n\n* Notes\n\n\n") (setq planner-day-page-template "* Tasks\n\n\n* Diary\n\n<lisp>(planner-diary-entries-here)</lisp>\n\n* Notes\n\n\n")) ;; alternate 2nd method to insert the diary contents in the file instead of calling planner-diary-entries-here ;;(setq planner-day-page-template "* Tasks\n\n\n* Diary\n\n\n* Notes\n\n\n") ;;(setq planner-diary-use-diary t) ;;(planner-diary-insinuate) (define-key planner-mode-map [(shift return)] 'planner-edit-task-description) (define-key planner-mode-map [f2] 'xsteve-planner-save) (defun xsteve-planner-save () (interactive) (planner-fix-tasks) (planner-save-buffers)) ) ;; org mode (add-to-list 'auto-mode-alist '("\\.org$" . org-mode)) (define-key global-map "\C-cl" 'org-store-link) (define-key global-map "\C-ca" 'org-agenda) (setq org-log-done t) (setq org-odd-levels-only t) (setq org-hide-leading-stars t) (setq org-CUA-compatible t) (setq org-return-follows-link t) ;;;tiny tools ;(setq load-path (append ; (list (concat emacs-site-lisp-directory "/tiny-2000-11-18/lisp/")) ; load-path)) ;(autoload 'tinylisp-mode "tinylisp" t t) ;(autoload 'turn-on-tinylisp-mode "tinylisp" t t) ;(add-hook 'lisp-mode-hook 'turn-on-tinylisp-mode) ;(add-hook 'emacs-lisp-mode-hook 'turn-on-tinylisp-mode) ;(add-hook 'lisp-interaction-mode-hook 'turn-on-tinylisp-mode) ; press $! or $# to find the error position in an emacs-lisp-buffer ;;; ISpell / ASpell (setq ispell-silently-savep t) ;save new words in pdict without questioning (setq ispell-help-in-bufferp 'electric) ;get a better help buffer (if win32p (setq ispell-program-name "c:/Programme/Aspell/bin/aspell") (setq ispell-program-name "aspell")) ;; See ispell-aspell-dictionary-alist for possible dictionaries ;;(xsteve-define-alternatives 'ispell-local-dictionary '("german8" "english")) (xsteve-define-alternatives 'ispell-local-dictionary '("de_AT-neu" "english")) ;; to use another dictionary in a file place the following 4 lines at the ;; end of the file (remove "-example-" from the lines) ;;-example- Local Variables: ;;-example- Local IspellDict: "english" ;;-example- Local IspellPersDict: "c:/Data/Ispell/_english.dic" ;;-example- End: ;;; execute commented out lisp expressions with C-x C-e in Emacs-Lisp mode (load "eval-sexp-in-comments.el" t t) (when (require 'newcomment nil t) ; (setq comment-padding 1) (setq comment-style 'indent) (global-set-key [(super ?,)] 'comment-dwim)) ;;; copy the line above to the current one (load "misc") (global-set-key [(control meta y)] 'copy-from-above-command) ;(defadvice copy-from-above-command ; (after xsteve-extend-copy-from-above-command activate compile) ; "insert a newline after copying" ; (open-line 1)) (defadvice copy-from-above-command (around xsteve-extend-copy-from-above-command activate compile) "insert a newline after copying" (let ((insert-new-line (not current-prefix-arg)) (col (current-column))) ad-do-it (save-excursion (back-to-indentation) (when (> col (current-column)) (setq insert-new-line nil))) (when insert-new-line (open-line 1)))) ;;; show a menu with toplevel entries (when (require 'generic-dl nil t) (global-set-key "\C-x\C-y" 'dl-popup)) ;;;help stuff (load "ilocate" t) ;;; browse-kill-ring (when (require 'browse-kill-ring "browse-kill-ring" t) (setq browse-kill-ring-highlight-current-entry) (setq browse-kill-ring-quit-action 'kill-and-delete-window) (define-key browse-kill-ring-mode-map [down] 'browse-kill-ring-forward) (define-key browse-kill-ring-mode-map [up] 'browse-kill-ring-previous) (defadvice yank-pop (around kill-ring-browse-maybe (arg)) "If last action was not a yank, run `browse-kill-ring' instead." (if (not (eq last-command 'yank)) (browse-kill-ring) ad-do-it)) (ad-activate 'yank-pop) ) ;;; Minibuffer stuff ;;Use icomplete mode in Minibuffers (when emacs>=21p (icomplete-mode)) ;better than icomplete-mode (when (not emacs>=21p) (require 'mcomplete) (require 'completing-help) (turn-on-mcomplete-mode) (turn-on-completing-help-mode)) ;;(resize-minibuffer-mode 1) ;sometimes nice - no longer needed for new emacsn (setq completion-styles '(basic emacs22)) ;;(setq completion-styles '(basic partial-completion emacs22)) ;; *** zsh-style tab completion cycling for the minibuffer! (when (load "minibuffer-complete-cycle" t) (setq minibuffer-complete-cycle t) (defadvice exit-minibuffer (after xsteve-after-exit-minibuffer activate compile) "bury the completions buffer" (bury-buffer "*Completions*") (message "*Completions*"))) ;; try this? ;;(partial-completion-mode t) (setq minibuffer-electric-default-mode t) ;;my own minibuffer stuff ; minibuffer-local-map is the base map for all minibuffer stuff ; minibuffer-local-completion-map is the map for minibuffers with completion (define-key minibuffer-local-completion-map [(super d)] 'minibuffer-insert-directory-name) (define-key minibuffer-local-completion-map [(control meta p)] 'previous-complete-history-element) (define-key minibuffer-local-completion-map [(control meta n)] 'next-complete-history-element) ;;;scroll-in-place ;(require 'scroll-in-place "scroll-in-place" t) (setq scroll-preserve-screen-position 'always) (setq scroll-conservatively most-positive-fixnum) (setq scroll-step 0) (setq hscroll-step 0) ; I use that seldom - let's try the standard movement commands now ;;(when (load "tuckey-holdcursor" t) ;; (global-set-key [(control n)] 'down-holdcursor) ;; (global-set-key [(control p)] 'up-holdcursor)) ;;;keep-buffers (when (require 'keep-buffers nil t) (keep-buffers-erase-on-kill nil) (keep-buffers-protect-buffer "*scratch*") (keep-buffers-protect-buffer "*Messages*") (keep-buffers-protect-buffer "*eshell*") (keep-buffers-protect-buffer "*LEO dictionary*") (keep-buffers-protect-buffer ".emacs") (keep-buffers-protect-buffer "xsteve-functions.el") (keep-buffers-protect-buffer ".gnus") (global-set-key [(control super k)] 'keep-buffers-protect-current-buffer) (global-set-key [(control meta super k)] 'keep-buffers-unprotect-current-buffer)) (when (require 'tempbuf nil t) (add-hook 'completion-list-mode-hook 'turn-on-tempbuf-mode)) ;;;igrep (condition-case nil (progn (require 'igrep) (load "findstr" t) ; use nt findstr instead of unix find (igrep-insinuate) ;;(defvar grep-null-device null-device) ) (error (message "Information: grep not available"))) ;;;edit all occurances in a buffer (autoload 'all "all" nil t) ;;;edit occurances from grep output (autoload 'global-replace-lines "globrep" "Put back grepped lines" t) ;(autoload 'global-replace "globrep" "query-replace across files" t) ;(autoload 'global-grep-and-replace "globrep" "grep and query-replace across files" t) ;;; Find files based on regexps, descend directories (load "findr" t) ;;; ireplace ;; New keybindings in isearch, regexp isearch: ;; C-Ret ... Replace the currently searched word ;; In regexp isearch, hit C-Ret again for a preview of the replacements (require 'ireplace nil t) ;;; find file at point (require 'ffap) (ffap-bindings) (setq ffap-url-fetcher 'w3m-browse-url) ;;(setq ffap-url-fetcher 'browse-url) (setq ffap-require-prefix t) ;(add-to-list 'ffap-c-path "/system/A/include") ;(add-to-list 'ffap-c-path "/system/specific/include") ;(setq 'ffap-c-path (parse-colon-path (getenv "INCLUDE"))) ;(dolist (x (split-string (getenv "INCLUDE") ";")) ; (add-to-list 'ffap-c-path x)) ;;; wcount (autoload 'wcount-mode "wcount" "Count words in a buffer" t) ;;;long-lines (when (load "longlines" t) (setq longlines-show-hard-newlines t) (add-to-list 'auto-mode-alist '("\\.ll\\'" . longlines-mode))) ;;;picture mode (global-set-key [(super control ?P)] 'picture-mode) (add-hook 'picture-mode-hook '(lambda () (define-key picture-mode-map [(super control ?P)] 'picture-mode-exit) (define-key picture-mode-map [(control down)] 'picture-movement-down) (define-key picture-mode-map [(control up)] 'picture-movement-up) (define-key picture-mode-map [(control left)] 'picture-movement-left) (define-key picture-mode-map [(control right)] 'picture-movement-right))) ;;;boxes ;;provides boxes-create, boxes-remove (when (require 'boxes nil t) (global-set-key [(control super b)] 'boxes-create)) ;;; align (when (require 'align nil t) (setq xsteve-c-align-rules-list `((c-comment-one-line (regexp . "[^- \t]\\(\\s-*\\)/\\*.*\\*/$") (group . 1) (repeat . nil)) (c-macro-definition (regexp . "^\\s-*#\\s-*define\\s-+\\S-+\\(\\s-+\\)")) (c-macro-line-continuation (regexp . "\\(\\s-*\\)\\\\$") (column . c-backslash-column)) (c-variable-declaration (regexp . ,(concat "[*&0-9A-Za-z_]>?[&*]*\\(\\s-+[*&]*\\)" "[A-Za-z_][0-9A-Za-z:_]*\\s-*\\(\\()\\|" "=[^=\n].*\\|(.*)\\|\\(\\[.*\\]\\)*\\)?" "\\s-*[;,]\\|)\\s-*$\\)")) (group . 1) (justify . t) (valid . ,(function (lambda () (not (or (save-excursion (goto-char (match-beginning 1)) (backward-word 1) (looking-at "\\(goto\\|return\\|new\\|delete\\|throw\\)")) (if (and (boundp 'font-lock-mode) font-lock-mode) (eq (cadr (memq 'face (text-properties-at (point)))) 'font-lock-comment-face) (eq (caar (c-guess-basic-syntax)) 'c)))))))) (c-assignment (regexp . ,(concat "[^-=!^&*+<>/| \t\n]\\(\\s-*[-=!^&*+<>/|]*\\)" "=\\(\\s-*\\)\\([^= \t\n]\\|$\\)")) (group . (1 2)) (justify . t) (tab-stop . nil)) (c-chain-logic (regexp . "\\(\\s-*\\)\\(&&\\|||\\|\\<and\\>\\|\\<or\\>\\)") (modes . align-c++-modes) (valid . ,(function (lambda () (save-excursion (goto-char (match-end 2)) (looking-at "\\s-*\\(/[*/]\\|$\\)")))))) )) (add-hook 'c-mode-hook (lambda () (setq align-mode-rules-list xsteve-c-align-rules-list)))) ;;;Occur - Kin Cho <kin@dynarc.com> (define-key occur-mode-map "F" (lambda (str) (interactive "sflush: ") (let ((buffer-read-only)) (save-excursion (beginning-of-buffer) (flush-lines str))))) (define-key occur-mode-map "K" (lambda (str) (interactive "skeep: ") (let ((buffer-read-only)) (save-excursion (beginning-of-buffer) (keep-lines str))))) ;;; Table of contents - toc (require 'toc "toc" t) ;; set this mode/file specifically (make-variable-buffer-local 'toc-regexp) ;(setq toc-regexp ";;\\*\\* *"); ;; that is ';;**' with optional spaces (define-key global-map "\C-c-" 'toc) (define-key occur-mode-map " " 'occur-mode-show-occurrence) ;;; Bookmarks (setq bookmark-save-flag 1) ;save every new bookmark (add-hook 'bookmark-load-hook '(lambda () (define-key bookmark-bmenu-mode-map [return] 'bookmark-bmenu-this-window) (define-key bookmark-bmenu-mode-map [(control t)] 'bookmark-toggle-file))) ;;; Clipper (require 'clipper "clipper" t) (global-set-key [(control super insert)] 'clipper-create) (global-set-key [(super insert)] 'clipper-insert) ;;(global-set-key [(super delete)] 'clipper-delete) ;;; default contents (when (require 'defaultcontent nil t) (setq dc-auto-insert-directory "~/.emacs.d/defaultcontent/") (setq dc-auto-insert-alist '(("\\.py$" . "python-template.py") ("\\.tex$" ("scrartcl-template.tex" "xsem-template.tex")) ("\\.vhdl$" (dc-fill-initial-content-of-file))))) ;;; Live mode (require 'live-mode "live-mode" t) ;;; Line numbers (autoload 'setnu-mode "setnu" "Minor mode to show line numbers on every line start") ;;; auto-refill (autoload 'refill-mode "refill" "Autorefill-mode") ;;; follow-mouse (autoload 'toggle-follow-mouse "follow-mouse" "Follow mouse mode") ;;;Save-history - not needed (is done via desktop) ;(require 'save-history) ;;; Save-Places (setq-default save-place t) ;;(define-key ctl-x-map "p" 'toggle-save-place) (load "saveplace") ;;;XSteves window-ring (require 'xwindow-ring) (global-set-key [(super up)] 'xwindow-ring-add) (global-set-key [(super right)] 'xwindow-ring-next) (global-set-key [(super left)] 'xwindow-ring-previous) (global-set-key [(super down)] 'xwindow-ring-remove) (global-set-key [(control meta up)] 'xwindow-ring-add) (global-set-key [(control meta right)] 'xwindow-ring-next) (global-set-key [(control meta left)] 'xwindow-ring-previous) (global-set-key [(control meta down)] 'xwindow-ring-remove) ;;;shortcuts for remembering some buffer positions (xsteve-define-quickmark-keys) ;;; Mouse embrace minor mode (when (require 'mouse-embrace "mouse-embrace" t) (define-key mouse-embrace-mode-map [(S-down-mouse-1)] 'mouse-embrace-choose-text)) ;;; Abbreviations (setq abbrev-file-name "~/.emacs-abbrevs") (when (file-exists-p abbrev-file-name) (quietly-read-abbrev-file)) (setq save-abbrevs 'silently) ;;; expand ;(expand-add-abbrevs c-mode-abbrev-table expand-c-sample-expand-list) ;(global-set-key [apps] 'expand-jump-to-next-slot) ;;;skeleton ;(setq skeleton-pair t) ;(global-set-key "(" 'skeleton-pair-insert-maybe) ;(global-set-key "[" 'skeleton-pair-insert-maybe) ;(global-set-key "\"" 'skeleton-pair-insert-maybe) ;(global-set-key "'" 'skeleton-pair-insert-maybe) ; (define-skeleton my-let-skel ; "skeleton example" ; nil ; \n > "(let ()" ; \n > _ \n > ; ")") ;;; Blank mode (autoload 'blank-mode "blank-mode" "Toggle blank visualization." t) (autoload 'highline-mode "highline" "Toggle global minor mode to highlight current line in buffer." t) (autoload 'highline-local-mode "highline" "Toggle local minor mode to highlight current line in buffer." t) ;;; tmmoffl (when (require 'tmmofl nil t) (setq tmmofl-C++-actions '((font-lock-comment-face (lambda() (progn (let((flyspell-issue-welcome-flag nil)) (auto-fill-mode 1) (abbrev-mode 1) (flyspell-mode 1)))) (lambda() (progn (auto-fill-mode 0) (abbrev-mode 0) (flyspell-mode 0)))))) (setq tmmofl-Python-actions '((font-lock-comment-face (lambda() (progn (auto-fill-mode 1))) (lambda() (progn (auto-fill-mode 0)))) (font-lock-string-face (lambda() (progn (auto-fill-mode 1))) (lambda() (progn (auto-fill-mode 0))))))) (add-site-lisp-load-path "mmm-mode/") (when (require 'mmm-auto nil t) (set-face-background 'mmm-default-submode-face "gray97") (setq mmm-global-mode 'maybe) ;;example use of the universal mmm mode ;;{%vhdl%} signal a : in bit; {%/vhdl%} (mmm-add-classes '((embedded-vhdl :submode vhdl-mode :front "begin{vhdlcode}.*$" :back "\\end{vhdlcode}") (embedded-python :submode python-mode :front "begin{pythoncode}.*$" :back "\\end{pythoncode}") (embedded-c :submode c-mode :front "begin{ccode}.*$" :back "\\end{ccode}"))) (mmm-add-mode-ext-class 'latex-mode "\.tex$" 'embedded-vhdl) (mmm-add-mode-ext-class 'latex-mode "\.tex$" 'embedded-python) ;;(mmm-add-mode-ext-class 'latex-mode "\.tex$" 'embedded-c) ;does not work well ;;mmm-mode example: ;;(set-face-background 'mmm-default-submode-face nil) ;;(mmm-add-classes ;; '((embedded-sql ;; :submode sql-mode ;; :front "EXEC SQL" ;; :back ";"))) ;;(setq-default mmm-global-mode t) ;;(mmm-add-mode-ext-class 'c-mode "\.pc$" 'embedded-sql) ;;(mmm-add-mode-ext-class 'c-mode "\.sqc$" 'embedded-sql) ;;(setq-default mmm-never-modes ;; (append '(ediff-mode) '(text-mode) mmm-never-modes)) ) ;;; tramp ;(add-site-lisp-load-path "tramp/") (require 'tramp "tramp" t) (when win32p (setq tramp-password-end-of-line "\r\n") ;;(setq tramp-sh-program "c:/cygwin/bin/sh.exe") ;;(setq tramp-default-method "smx") (setq tramp-default-method "plink") (setq tramp-verbose 10) (setq tramp-debug-buffer t) (setq tramp-auto-save-directory "c:/temp")) ;;example file name: /stefan@horsti:~/.emacs ;;; JKA-Compression - automatic gzip,... ;(require 'jka-compr) (auto-compression-mode 1) (when (require 'mkback nil t) (setq mkback-max-depth 6) (setq mkback-time-format "-%Y-%m-%d_%H_%M_%S") (mkback-install-for-eshell)) ;; make scripts executable if they contain the shebang (add-hook 'after-save-hook 'executable-make-buffer-file-executable-if-script-p) ;;; xref ;(add-site-lisp-load-path "xref/") ;(when (require 'xref-hks nil t) ; (setq-default xref-external-save t) ; (global-set-key [f8] 'xref-map)) ;W3 - emacs lisp www browser (if (not emacs>=21p) (add-site-lisp-load-path "w3-4.0pre.46/lisp") (add-site-lisp-load-path "w3/lisp") (add-site-lisp-load-path "url/lisp")) (require 'w3-auto "w3-auto" t) ;;(setq w3-do-incremental-display t) (setq url-automatic-caching t) (setq url-keep-history t) ;; Use w3m ;(setq browse-url-browser-function 'w3m-browse-url) ;; Use Opera ;(setq browse-url-browser-function 'browse-url-generic browse-url-generic-program "opera") ;; Use chromium ;; (setq browse-url-browser-function 'browse-url-generic browse-url-generic-program "chromium-browser") ;; browse hyperspec with w3m, everything else with browse-url-netscape ;; (setq browse-url-browser-function ;; '(("hyperspec" . w3m-browse-url) ;; ("." . browse-url-netscape))) ;(setq browse-url-new-window-flag nil) ;(setq browse-url-mozilla-new-window-is-tab nil) (setq browse-url-generic-program "chromium-browser") (xsteve-define-alternatives 'browse-url-browser-function (list (if win32p 'browse-url-default-windows-browser 'browse-url-generic) 'browse-url-firefox 'w3m-browse-url)) (defun xsteve-browse-url-function (URL &optional NEW-WINDOW) (if win32p (browse-url-default-windows-browser URL NEW-WINDOW))) ;this one uses gnus as standard mail browser - I still want to use eudora for this ;(setq browse-url-browser-function ; '(("^mailto:" . browse-url-mail) ; ("." . xsteve-browse-url-function))) (setq browse-url-new-window-p t) (add-hook 'browse-url-of-file-hook 'browse-url-generic-reload) ;;; w3m ;; More infos on: http://www.emacswiki.org/cgi-bin/wiki?WThreeM (unless (fboundp 'w3m) (add-site-lisp-load-path "w3m/") (autoload 'w3m "w3m" "Interface for w3m on Emacs." t) (autoload 'w3m-find-file "w3m" "w3m interface function for local file." t) (autoload 'w3m-browse-url "w3m" "Ask a WWW browser to show a URL." t) ;(autoload 'w3m-search "w3m-search" "Search QUERY using SEARCH-ENGINE." t) (autoload 'w3m-antenna "w3m-antenna" "Report change of WEB sites." t) (autoload 'w3m-bookmark-view "w3m-bookmark" "List w3m bookmarks" t)) (setq w3m-key-binding 'info) (setq w3m-search-default-engine "google") (setq w3m-fill-column 100) (setq w3m-use-cookies t) (setq w3m-goto-article-function 'browse-url) (setq w3m-command-arguments '("-F")) ;; use frames ;; Select a better coding system to display umlauts correctly (setq w3m-coding-system 'utf-8 w3m-file-coding-system 'utf-8 w3m-file-name-coding-system 'utf-8 w3m-input-coding-system 'utf-8 w3m-output-coding-system 'utf-8 w3m-terminal-coding-system 'utf-8) (add-hook 'w3m-mode-hook '(lambda() (define-key w3m-mode-map "g" 'xsteve-w3m-goto-url) (define-key w3m-mode-map [?w] 'w3m-copy-link) (define-key w3m-mode-map [(meta ?c)] 'w3m-print-current-url))) ;(setq w3m-async-exec nil) (defun xsteve-w3m-view-url-with-external-browser-via-mouse-click (click) "Position the mouse at the current click position and run `w3m-view-url-with-external-browser'." (interactive "e") (mouse-set-point click) (w3m-view-url-with-external-browser)) (defun xsteve-w3m-goto-url () (interactive) (let ((w3m-current-url "")) (call-interactively 'w3m-goto-url))) (eval-after-load "w3m" '(progn (unless w3m-icon-directory (setq w3m-icon-directory (concat emacs-site-lisp-directory "w3m/icons"))) ;; w3m-minor-mode-map is active when showing html articles in gnus ;; w3m-minor-mode-map is not active, when mm-inline-text-html-with-w3m-keymap is nil (define-key w3m-minor-mode-map "\C-m" 'w3m-view-url-with-external-browser) (define-key w3m-minor-mode-map [mouse-2] 'xsteve-w3m-view-url-with-external-browser-via-mouse-click) (require 'planner-w3m nil t) (require 'w3m-search) (add-to-list 'w3m-search-engine-alist '("emacs-wiki" "http://www.emacswiki.org/cgi-bin/wiki.pl?search=%s")) (add-to-list 'w3m-search-engine-alist '("leo" "http://dict.leo.org/?search=%s")) ;; Make the previous search engine the default for the next search. (defadvice w3m-search (after change-default activate) (let ((engine (nth 1 minibuffer-history))) (when (assoc engine w3m-search-engine-alist) (setq w3m-search-default-engine engine)))))) (eval-after-load "w3m-symbol" '(when w3m-mule-unicode-symbol (setcar (nthcdr 32 w3m-mule-unicode-symbol) "*") (setcar (nthcdr 33 w3m-mule-unicode-symbol) "+") (setcar (nthcdr 34 w3m-mule-unicode-symbol) "-"))) ;;(setcar (nthcdr 35 w3m-mule-unicode-symbol) "4") ;;(setcar (nthcdr 36 w3m-mule-unicode-symbol) "5") ;;(setcar (nthcdr 37 w3m-mule-unicode-symbol) "6") ;;(setcar (nthcdr 38 w3m-mule-unicode-symbol) "7") ;;(setcar (nthcdr 39 w3m-mule-unicode-symbol) "8") ;;(setcar (nthcdr 40 w3m-mule-unicode-symbol) "9"))) ;; needed by shimbun (add-site-lisp-load-path "apel/") (add-site-lisp-load-path "flim/") (add-site-lisp-load-path "w3m/shimbun/") (autoload 'gnus-group-make-shimbun-group "nnshimbun" nil t) ;;;webjump (require 'webjump) ;;(global-set-key [(super j)] 'webjump) (global-set-key [(super meta j)] 'webjump) (global-set-key [(super control j)] 'webjump-w3m) (setq webjump-sites '( ("google" . [simple-query "www.google.com" "www.google.com/search?q=" ""]) ("Google Groups" . [simple-query "groups.google.com" "groups.google.com/groups?q=" ""]) ("brightgate" . [simple-query "www.brightgate.com" "www.brightgate.com/cgi-bin/search/fast/meta?q=" ""]) ("Roget's Internet Thesaurus" . [simple-query "www.thesaurus.com" "www.thesaurus.com/cgi-bin/htsearch?config=roget&words=" ""]) ("Debian GNU/Linux" . [simple-query "www.debian.org" "search.debian.org/?q=" ""]) ("Python Documentation" . [simple-query "starship.python.net" "http://starship.python.net/crew/theller/pyhelp.cgi?keyword=" "&version=current"]) ("Dictionary.com" . [simple-query "www.dictionary.com" "www.dictionary.com/cgi-bin/dict.pl?term=" "&db=*"]) ("leo" . [simple-query "dict.leo.org" "dict.leo.org/?search=" ""]) ("linux apps" . "www.appwatch.com/Linux/") ("latex online help" . "http://www.giss.nasa.gov/latex/ltx-2.html") ("latex online index" . "http://www.weinelt.de/latex/index.html") ("mensa" . "http://www.cycamp.at/mensen/menuplan.php?location=ulm&week_add=") ("khg-mensa" . "http://madonna.khg-heim.uni-linz.ac.at/mensa/aktueller.menueplan.html") ("spiegel" . "www.spiegel.de") ("wetter" . "www.oon.at/wetter/oberoesterreich/prognose.asp") )) ;;; wget (add-site-lisp-load-path "wget/") (autoload 'wget "wget" "wget interface for Emacs." t) (autoload 'wget-web-page "wget" "wget interface to download whole web page." t) (load "w3m-wget" t) ;;The file is downloaded to the folder wget-download-directory (= ~/download) (defun wget-open-downloaded-file () (let* ((dir (cdr (assoc proc wget-process-dir-alist))) (file (or (cdr (assoc proc wget-process-saved-alist)) (wget-process-file-name proc))) (full-file-name (expand-file-name file dir))) (message "downloaded %s" full-file-name) (find-file full-file-name))) ;; Open the file after the download (add-hook 'wget-after-hook 'wget-open-downloaded-file) ;;;ell (autoload 'ell-packages "ell" "ell Packages" t) (setq ell-locate t) (setq ell-proxy-host "proxy.riic.uni-linz.ac.at") (setq ell-proxy-port 3128) (setq ell-async nil) ;;;Email ;(setq send-mail-function 'smtpmail-send-it) ; if you use `mail' ;(setq message-send-mail-function 'smtpmail-send-it) ; if you use `message' ;(setq smtpmail-default-smtp-server "postoffice.riic.at") ;(setq smtpmail-local-domain "riic.at") ;;(setq smtpmail-debug-info t) ; only to debug problems ;; To queue mail, set smtpmail-queue-mail to t and use ;; smtpmail-send-queued-mail to send. ;(define-key ctl-x-map "m" 'message-mail) (setq mail-user-agent 'gnus-user-agent) ;; vm mail reader ; (autoload 'vm "vm" "Start VM on your primary inbox." t) ; (add-site-lisp-load-path "vm-6.75/") ;;;use translation service from babelfish.altavista.com - needs w3 (require 'babel "babel" t) (setq babel-translation-history (cons "German" "English")) ;;; systran can treat german umlauts - babelfish can not (setq babel-backends '(("SysTran" . systran) ("Babelfish at Altavista" . fish) ("InterTrans" . intertrans) ("FreeTranslation" . free) ("WorldBlaze" . blaze) ("Leo Dictionary" . leo))) ;;; Thesaurus (defvar mthesaur-file "v:/data/thesaurus/mthesaur.txt") (autoload 'mthesaur-search-append "mthesaur" "Thesaurus lookup of a word or phrase." t) (global-set-key "\C-ct" 'mthesaur-search-append) (when (require 'diminish nil t) (diminish 'abbrev-mode "Abv") ;(diminish 'eldoc-mode) (when (fboundp 'doxymacs-mode) (diminish 'doxymacs-mode))) ; (diminish 'power-macros-mode) ; (diminish 'auto-fill-function " F") ; (diminish 'font-lock-mode "Fn") ; (diminish 'jiggle-mode)) ;;; Games :-) ;; (add-site-lisp-load-path "elite/") ;; (autoload 'elite "elite" "Elite for Emacs :-)" t) ;; (unless (fboundp 'chess) ;; (add-site-lisp-load-path "chess/") ;; (autoload 'chess "chess" "Chessboard for Emacs" t) ;; (setq chess-default-engine 'chess-crafty) ;; (when win32p ;; (setq chess-default-display 'chess-ics1) ;; (setq chess-crafty-path "c:/Bak/old_pc/E/ftp/chess/wcrafty-18.10.exe"))) ;;;use dictionary from http://www.dict.org/bin/Dict ;;(autoload 'dict "dict-web" "Lookup a word or phrase in the Online Dictionary Database." t) ;set window position and size ;(set-frame-position (selected-frame) 0 0) ;position in pixels ;(set-frame-height (selected-frame) 59) ;lines ;(set-frame-width (selected-frame) 100) ;columns ;create another frame ;(make-frame) ;create a new frame ;(set-frame-position (selected-frame) 0 684) ;position in pixels ;(set-frame-height (selected-frame) 10) ;lines ;(set-frame-width (selected-frame) 80) ;columns ;;; my own packages ;;; dictionary interface (require 'x-dict nil t) ;;; ppd mode (autoload 'ppd-mode "ppd-mode" "Eccos Probe Definition File mode" t) (setq auto-mode-alist (append '(("\\.ppd$" . ppd-mode)) auto-mode-alist)) ;;; Hpe_desk bcd mode (autoload 'bcd-mode "bcd-mode" "Hpe_desk board connection definition file mode" t) (setq auto-mode-alist (append '(("\\.bcd$" . bcd-mode)) auto-mode-alist)) ;;; pci-cmd mode (autoload 'pci-cmd-mode "pci-cmd-mode" "Pci cmd file mode" t) (setq auto-mode-alist (append '(("\\.cmd$" . pci-cmd-mode)) auto-mode-alist)) ;;; sdf-mode (autoload 'sdf-mode "sdf-mode" "sdf mode" t) (setq auto-mode-alist (append '(("\\.sdf$" . sdf-mode)) auto-mode-alist)) ;;; synopsys report (autoload 'synopsys-log-mode "synopsys-dcsh" "synopsys-log mode" t) (autoload 'dc-shell "synopsys-dcsh" "Run synopsys dcsh as emacs process" t) ;(setq auto-mode-alist (append '(("report.log$" . synopsys-log-mode)) auto-mode-alist)) (require 'quick-task nil t) ;;; iss mode (when win32p (autoload 'iss-mode "iss-mode" "Innosetup Script Mode" t) (setq auto-mode-alist (append '(("\\.iss$" . iss-mode)) auto-mode-alist)) ;;(setq iss-compiler-path "c:/Prg/Apps/InnoSetup/") (add-hook 'iss-mode-hook 'xsteve-iss-mode-init) (defun xsteve-iss-mode-init () (interactive) (define-key iss-mode-map [f6] 'iss-compile) (define-key iss-mode-map [(meta f6)] 'iss-run-installer))) ;;; sww (when win32p (require 'sww nil t)) ;;; remind mode (require 'remind-mode nil t) ;;; The password safe: M-x pwsafe (when (require 'pwsafe nil t) (setq pwsafe-keep-passwd 15)) ;;; grabbox stuff ;; (load "grabbox" t) ;;; progr-align package (require 'progr-align "progr-align" t) ;;; Provide files via the simple webserver woof (when (require 'woof nil t) (global-set-key [(hyper ?W)] 'woof-provide-dwim) (global-set-key [(hyper ?w)] 'woof-receive)) (setq custom-file "~/.emacs-customize") (when (file-exists-p custom-file) (load custom-file)) (require 'filecache) ;just load it in ;; needed to make gnus-dired-mode available for desktop (autoload 'gnus-dired-mode "gnus-dired") (autoload 'gnus-dired-attach "gnus-dired") ;;; Desktop ;(load "desktop") ;(unless emacs>=21p ;(require 'desktop-menu) ;;(setq desktop-enable t) (if (fboundp 'desktop-save-mode) (progn (setq desktop-save 'if-exists) (desktop-save-mode 1))) ;(desktop-load-default) ;(desktop-read) ;(setq desktop-files-not-to-save "\\(^/[^/:]*:\\|\\.bbdb\\|\\*Group\\*\\|\\*Compile-Log\\*\\)") ;(setq desktop-files-not-to-save "\\(^/[^/:]*:\\|\\.bbdb\\)") ;(setq desktop-modes-not-to-save '(Info-mode))) ;(when emacs>=21p ; (require 'desktop) ; (setq desktop-basefilename ".emacs21.desktop") ; (desktop-read)) ; (mapcar (lambda (symbol) ; (add-to-list 'desktop-globals-to-save symbol)) ; '(file-name-history extended-command-history minibuffer-history)) (setq desktop-globals-to-save (append '((extended-command-history . 30) (file-name-history . 30) (grep-history . 30) (compile-history . 30) (minibuffer-history . 50) (query-replace-history . 60) (read-expression-history . 60) (regexp-history . 60) (regexp-search-ring . 20) (search-ring . 20) (shell-command-history . 50) tags-file-name register-alist))) (add-to-list 'desktop-clear-preserve-buffers "\\*Group\\*") ;; Add proper semantic/ecb support for their minor modes (when (boundp 'desktop-minor-mode-table) (setq desktop-minor-mode-table (append desktop-minor-mode-table '((ecb-minor-mode nil) (semantic-show-unmatched-syntax-mode nil) (semantic-stickyfunc-mode nil) (senator-minor-mode nil) (semantic-idle-scheduler-mode nil))))) (when (file-exists-p "~/.emacs_post") (load (expand-file-name "~/.emacs_post"))) (when (require 'time-date nil t) (message "Emacs startup time: %d seconds." (time-to-seconds (time-since emacs-load-start-time)))) ;;;Some tips ;;replace <1> -> (1), <2> -> (2), <3> -> (3) usw. ;;query-replace-regexp <\(.\)> (\1) ;;$ gnudoit '(message "Hello from Cygwin")' ;;C:\>gnudoit "(message \"Hello from NT\")" ;;(setenv "X" "/[scp@user@host]") ;;C-x C-f $X/path/to/file RET. ;; Emacs Local Variables ;; Local Variables: ;; mode: emacs-lisp ;; a2ps-switches: "-l100" ;; toc-regexp: ";;; *" ;; outline-regexp: ";;; *" ;; End: ;; arch-tag: 3a240179-4a8a-4322-a3c9-978dca503fdc