;(require 'dbfrobs) ;(setq debug-on-error t) ; debugging for .emacs (defvar running-xemacs (string-match "XEmacs\\|Lucid" emacs-version)) (setq emacsx (or (not (fboundp 'device-type)) (equal (device-type) 'x))) (setq gc-cons-threshold 10000000 undo-limit 200000 undo-strong-limit 300000) (global-set-key [(meta escape) ?\\] 'indent-region) (add-hook 'java-mode-hook 'my-java-mode-hook) (defun my-java-mode-hook () (make-local-variable 'outline-regexp) (setq outline-regexp "^[^]} \t\n)]") (outline-minor-mode) (local-set-key "\C-m" 'newline-and-indent) (modify-syntax-entry ?_ "w") (local-set-key "\C-c\C-c" 'compile) ; (require 'andersl-java-font-lock) ; (turn-on-font-lock) ) ;(load "jde") ;(setq jde-web-browser "lynx") ;(setq jde-doc-dir "/usr/java/htmldoc") ;(jde-db-set-source-paths "/home/tjchol01/mljava/") ; these are already in the distribution (load-library "keymap") (define-key function-key-map [?\C-x ?@ ?k] 'synthesize-keysym) (load-library "packages") (load-library "find-func") (require 's-region) (s-region-bind) (s-region-bind-cua) ;(require 'disp-table) ;(standard-display-8bit 160 255) (standard-display-european t) (set-input-mode nil nil 0) (defun kpse-find-file (file) (interactive "sTeX file name: ") (let* ((out (shell-command-to-string (concat "kpsewhich --format=.tex " file))) (end (position ?\n out)) ) (if (not end) (message "File %s not found" file) (let* ((f (substring out 0 end)) (spc (position ? f))) (if spc (message "Space in `%s'. File %s not found" out file) (find-file f)) )))) (defun tjc-save-line () "Copy the current line and move to the beginning of the next line." (interactive) (beginning-of-line) (let ((beg (point))) (forward-line) (copy-region-as-kill beg (point))) (setq this-command 'kill-region)) (defun tjc-center-line () "Center the current line and move to the beginning of the next line." (interactive) (center-line) (forward-line)) (global-set-key [(meta K)] 'tjc-save-line) ;;; binding from text-mode (global-set-key [(meta s)] 'tjc-center-line) ;(setq-default ediff-use-faces t) (setq delete-key-deletes-forward t track-eol t indent-tabs-mode nil line-move-ignore-invisible t ) (defun register-jump-or-insert () (interactive) (let* ((register (event-key last-command-event)) (val (get-register register))) (cond ((or (consp val) (integerp val) (stringp val)) (insert-register register) (zmacs-deactivate-region)) (t (jump-to-register register))))) (mapc (lambda (c) (global-set-key `[(meta ,c)] 'register-jump-or-insert)) "1234567890") (setq sentence-end-double-space t) (setq sentence-end "[.?!][]\"')}]*\\($\\| $\\|\t\\| \\)[ \t\n]*") ;;;--------------------------------------------------------------- ;;; support for dumped (defun cond-require (fn) (condition-case () (require fn) (error nil))) ;;;(cond-require 'delbackspace) (cond-require 'reportmail) ;;; time of day in mode line stuff -- requires Xemacs itimer (setq display-time-mail-ring-bell t ;;; display-time-load t display-time-interval 30 display-time-24hr-format nil) ;; (setq display-time-day-and-date t) (display-time) (setq help-char ?\M-h) (global-set-key '(control h) 'backward-delete-char) ;(global-set-key 'backspace 'backward-delete-char) (add-hook 'change-log-mode-hook 'turn-off-filladapt-mode) (setq uniquify-buffer-name-style 'post-forward) (setq uniquify-after-kill-buffer-p t) (setq auto-insert-alist '( (latex-mode nil "\\documentclass{article} \\usepackage{palatino} \\title{" _ "} \\author{Tomasz Cholewo} \\date{} \\begin{document} \\maketitle " _ " \\end{document}") )) (toggle-auto-compression 1) ;(setq delete-key-deletes-forward t) (let ((x-dir (concat "~" init-file-user emacs-user-extension-dir))) (mapc (lambda (sym-file) (let ((sym (car sym-file)) (file (cdr sym-file))) (set sym (concat x-dir file)))) '((gnus-init-file . "gnus.el") (vm-init-file . "vm.el") (bookmark-file . "bookmarks") (diary-file . "diary") (auto-insert-directory . "autoinsert") (save-place-file . "places") (savehist-file . "history") (bbdb-file . "bbdb")) )) (require 'savehist) (savehist-load) (add-hook 'find-file-hooks 'auto-insert) (setq bookmark-save-flag 1) ;;; LOCAL ;??? what was it for ;(setq help-char -1) ;;; Mma (setq math-process-string "~/bin/math") ;;; edb "functions" (defun cds () (interactive) (db-find-file "~/src/edb/cds.dat")) (defun rides () (interactive) (db-find-file "~/src/edb/rides.dat")) ;;; w3 ;(setq browse-url-browser-function 'browse-url-lynx-emacs) (setq ; url-be-asynchronous t url-privacy-level '(email os lastloc cookie) ; url-privacy-level '(email os lastloc agent cookie) w3-confirmation-func 'y-or-n-p w3-default-homepage (expand-file-name "~/public_html/private/lynx.html") ;; w3-default-homepage "http://www.spd.louisville.edu" ; w3-emacs19-hack-faces-p nil ; w3-delimit-emphasis t ; w3-keep-old-buffers t ; w3-reuse-buffers nil ; w3-show-status nil ; url-show-status t ) (defun me-rotate (beg end) (interactive "r") (let ((case-fold-search nil)) (format-replace-strings '( ("@#nw" . "@#NE") ("@#sw" . "@#NW") ("@#se" . "@#SW") ("@#ne" . "@#SE") ("@#n" . "@#E") ("@#e" . "@#S") ("@#s" . "@#W") ("@#w" . "@#N") ("ulcorner" . "URCORNER") ("urcorner" . "LRCORNER") ("lrcorner" . "LLCORNER") ("llcorner" . "ULCORNER") ) nil beg end) (format-replace-strings '( ("@#NE" . "@#ne") ("@#NW" . "@#nw") ("@#SW" . "@#sw") ("@#SE" . "@#se") ("@#E" . "@#e") ("@#S" . "@#s") ("@#W" . "@#w") ("@#N" . "@#n") ("URCORNER" . "urcorner") ("LRCORNER" . "lrcorner") ("LLCORNER" . "llcorner") ("ULCORNER" . "ulcorner") ) nil beg end) )) (defun lagrep (s) (interactive "sSearch term: ") (grep (concat "grep -n " s " /usr/contrib/share/texmf/tex/latex/base/*.dtx /dev/null"))) ;; (grep (concat "cd /usr/contrib/share/texmf/tex/latex/; grep -n " s " base/*.dtx /dev/null"))) (add-hook 'postscript-mode-hook (lambda () (make-local-variable 'outline-regexp) (setq outline-regexp "^%%") (outline-minor-mode))) ;; elisp debugging utilities... (defun debug-on-error (&optional arg) "Toggles the value of `debug-on-error'. With prefix ARG 0/non-zero sets `debug-on-error' to nil/t" (interactive "P") (setq arg (car-safe arg)) (setq debug-on-error (cond ((null arg) (not debug-on-error)) ((zerop arg) nil) (t t))) (message "debug-on-error: %s" debug-on-error)) (defun debug-on-quit (&optional arg) "Toggles the value of `debug-on-quit'. With prefix ARG 0/non-zero sets `debug-on-quit' to nil/t" (interactive "P") (setq arg (car-safe arg)) (setq debug-on-quit (cond ((null arg) (not debug-on-quit)) ((zerop arg) nil) (t t))) (message "debug-on-quit: %s" debug-on-quit)) ;(set-device-baud-rate (frame-device) 1000000) ; for bmg ;(setq font-lock-keywords '(("^-.*$" . font-lock-comment-face))) (setq completion-ignored-extensions (append completion-ignored-extensions '( ".mpx" ".class" ".hi" ",v" ".prof"))) ;(setq gnuserv-frame (selected-frame)) ;(gnuserv-start) (add-hook 'gnuserv-visit-hook (lambda () (if (and (boundp 'xemacs-client-as-root) xemacs-client-as-root) (set-face-background 'modeline "red")))) ;;; root has red modelines (if (= (user-uid) 0) (set-face-background 'modeline "red")) (autoload 'winmgr-mode "winmgr-mode" "Mode for editing window manager config files") ;;(add-hook 'winmgr-mode-hook ;; '(lambda () ;; (font-lock-mode t) ;; (setq font-lock-keywords winmgr-font-lock-keywords) ;; (font-lock-fontify-buffer))) ;; ;;; supposedly for colors on a tty (if (eq 'tty (device-type)) (set-device-class nil 'color)) ;;; disable saveplace - could not quit emacs as root (if (/= (user-uid) 0) (progn (setq-default save-place t) (setq save-place-limit 100) (require 'saveplace)) (setq-default save-place nil) (remove-hook 'find-file-hooks 'save-place-find-file-hook) (remove-hook 'kill-emacs-hook 'save-place-kill-emacs-hook) (remove-hook 'kill-buffer-hook 'save-place-to-alist) ) ;;; frame titles: evaluate once at startup (setq frame-title-format `( ,(concat (user-real-login-name) "@" (if (string-match (regexp-quote ".") (system-name)) (substring (system-name) 0 (match-beginning 0)) (system-name)) ": " ) (buffer-file-name "%f" (dired-directory dired-directory "%b")))) (define-key isearch-mode-map "\C-t" 'isearch-toggle-regexp) (define-key isearch-mode-map "\C-^" 'isearch-edit-string) ;;; eldoc ;(autoload 'turn-on-eldoc-mode "eldoc" nil t) ;(add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode) ;(add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode) ;(add-hook 'ielm-mode-hook 'turn-on-eldoc-mode) (defun gindent () (interactive) (shell-command-on-region (point-min) (point-max) "indent" nil t)) (add-hook 'buffer-menu-mode-hook '(lambda () (setq truncate-lines nil))) (add-hook 'after-debugger-mode-hook '(lambda () (setq truncate-lines nil))) (put 'set-goal-column 'disabled nil) (put 'narrow-to-region 'disabled nil) ;(setq add-log-mailing-address "t.cholewo@ieee.org") (setq auto-mode-alist (append auto-mode-alist '(("\\.[hg]s$" . haskell-mode) ("\\.hi$" . haskell-mode) ("\\.l[hg]s$" . hugs-mode)))) ; ("\\.l[hg]s$" . haskell-mode)))) ; ("\\.l[hg]s$" . literate-haskell-mode)))) (autoload 'hugs-mode "hugs-mode" "Major mode for Hugs." t) ;(setq hugs-program "hugs") (setq hugs-script-file-path '("/usr/contrib/share/hugs/lib" ".")) (autoload 'haskell-mode "haskell" "Major mode for Haskell." t) (autoload 'literate-haskell-mode "haskell" "Major mode for literate Haskell." t) (add-hook 'hugs-mode-hook (lambda () (local-set-key [(control insert)] 'hugs-send-cell) (local-set-key [(control c) u] 'hugs-send-cell) (local-set-key [(alt insert)] 'hugs-load-cell) (local-set-key [(control c) U] 'hugs-load-cell) (local-set-key [(control c) c] 'hugs-create-cell) (local-set-key [(control c) s] 'hugs-show-process-buffer) (make-local-variable 'outline-regexp) (setq outline-regexp "\\\\begin{code}") (outline-minor-mode) (local-set-key [(control down)] 'tjc-outline-down) (local-set-key [(control up)] 'tjc-outline-up) (local-set-key "\C-c]" (lambda () (interactive) (progn (beginning-of-line) (insert "\\end{code}\n")))) (setq font-lock-keywords (append hugs-font-lock-keywords '(("^\\(\\\\begin{\\|\\\\end{\\)code}" . font-lock-comment-face)))) (make-variable-buffer-local 'compile-command) (setq compile-command (concat "runhugs " buffer-file-name)))) ;;; subsetted for speed-up (require 'compile) (setq compilation-error-regexp-alist '( ("\ \\([a-zA-Z]?:?[^:( \t\n]+\\)[:(][ \t]*\\([0-9]+\\)\\([) \t]\\|\ :\\([^0-9\n]\\|\\([0-9]+:\\)\\)\\)" 1 2 5) ("[a-zA-Z]?:?[^0-9 \n\t:]+:[ \t]*\\([^ \n\t:]+\\):\ \\([0-9]+\\):\\(\\([0-9]+\\)[: \t]\\)?" 1 2 4) ("[^0-9< \n\t:]+:[ \t]*\\([^ \n\t:]+\\):\ \\([0-9]+\\):\\(\\([0-9]+\\):\\)?[A-Za-z]:" 1 2 4) ("[^<\n]* \\([^ \n,\"]+\\), line \\([0-9]+\\):" 1 2) ("[^<\n]*: \\([^ \n,\"]+\\): \\([0-9]+\\):" 1 2) ;; Hugs ("ERROR \"\\([^\"]+\\)\" (line \\([0-9]+\\)):" 1 2) ;; GHC ("[ \t]*Defined at \\([^: \t\n]+\\):\\([0-9]+\\)" 1 2) ("\"\\([^\"]+\\)\", line \\([0-9]+\\):" 1 2 3) ("\"\\([^\"]+\\)\", line \\([0-9]+\\), column \\([0-9]+\\):" 1 2 3) ;; MetaPost ("l\\.\\([0-9]+\\))" 1 2) ;; texspell ("\\([0-9]+\\) \\([0-9]+\\) (\\([^)]+\\)):" 3 1 2) )) (defun d-b (keymap) (interactive "SKeymap: ") (let ((k (eval keymap))) (if k (progn (with-displaying-help-buffer (lambda () (set-buffer standard-output) (describe-bindings-internal k))))))) (require 'filladapt) (setq-default filladapt-mode t) (setq filladapt-mode-line-string " FA") (setq Info-enable-edit t) ;(setq Info-suffix-list '( (".info" . nil) ; (".info.gz"); . "gzip -dc %s") ;; (".info-z" . "gzip -dc %s") ;; (".info.Z" . "uncompress -c %s") ; (".gz"); . "gzip -dc %s") ;; (".Z" . "uncompress -c %s") ;)) (setq te-stty-string "stty -nl dec echo") (if (and running-xemacs emacsx) (let ((disp (getenv "DISPLAY"))) (cond ((and disp (string-match ":0.0" disp)) (load-default-sounds)) (t (setq bell-volume 40) (setq sound-alist (append sound-alist '((no-completion :pitch 500)))) )))) (condition-case () (progn (autoload 'resize-minibuffer-mode "rsz-minibuf" nil t) (resize-minibuffer-mode) (setq resize-minibuffer-window-exactly nil) (setq resize-minibuffer-window-max-height 10) ) (error nil)) (define-key emacs-lisp-mode-map "\C-xx" 'edebug-defun) ;;; auctex (setq TeX-parse-self t) ; Enable parse on load. ;(setq TeX-auto-save t) ; Enable parse on save. (autoload 'metafont-mode "meta-mode" "Metafont editing mode." t) (autoload 'metapost-mode "meta-mode" "MetaPost editing mode." t) (setq auto-mode-alist (append '(("\\.mf\\'" . metafont-mode) ("\\.mp\\'" . metapost-mode)) auto-mode-alist)) ;(add-hook 'meta-common-mode-hook 'turn-on-font-lock) ;;;(add-hook 'meta-common-mode-hook 'turn-on-lazy-lock) (global-set-key "\M-&" 'webster-www) (add-hook 'dired-mode-hook 'foo-dired-mode-setup) (defun foo-dired-mode-setup () (define-key dired-mode-map "r" 'dired-do-rename) (define-key dired-mode-map "c" 'dired-do-copy)) (setq dired-compression-method 'gzip) (setq game-lib-use-colors t) ;(setq-default sh-shell-file "/bin/sh") (setq interpreter-mode-alist (append '(("bash" . ksh-mode) ("csh" . ksh-mode) ("ksh" . ksh-mode) ("sh" . ksh-mode) ("tcsh" . ksh-mode)) interpreter-mode-alist)) (autoload 'perl-mode "cperl-mode" "Alternate mode for editing Perl programs" t) (setq cperl-hairy t cperl-indent-level 4) (setq signal-error-on-buffer-boundary nil) ;(setq tags-always-exact t) (setq make-tags-files-invisible t tags-auto-read-changed-tag-files t tags-build-completion-table t) (condition-case () (progn (require 'redo) (global-set-key [(control ^)] 'redo)) (error nil)) (global-set-key [(control c) (\;)] 'comment-region) ;(setq math-remote-shell "rsh" ; math-remote-host "talos") (setq directory-abbrev-alist (append '( ("\\`/T/" . "/usr/contrib/share/texmf/tex/") ("\\`/L/" . "/usr/contrib/share/xemacs/site-lisp/") ; ("\\`/X/" . "/usr/contrib/lib/xemacs-19.14/lisp/") ) directory-abbrev-alist)) (setq-default comment-column 48) (setq compilation-always-signal-completion nil) (setq compilation-ask-about-save nil) (setq compilation-window-height (if emacsx 20 8)) (setq mma-window-height compilation-window-height) ;(setq compilation-error-regexp-alist ; (append '( ; ;; ctangle ; ;; ! Input line too long. (l. 1056) ;;; ("\nctangle \\(-[a-z]+\\)? \\([^ \t\n]+\\)[^!]*\n![^.]+\\. (l\\. \\([0-9]+\\))" 2 3) ; ) ;compilation-error-regexp-alist)) (require 'whitespace) (cond-require 'scroll-in-place) (cond-require 'auto-show) ;(cond-require 'view-less) ;(add-hook 'find-file-hooks 'auto-view-mode) (defun describe-symbols (pattern) "Describe the Emacs Lisp symbols matching PATTERN. All symbols that have PATTERN in their name are described in the `*Help*' buffer." (interactive "sDescribe symbols matching: ") (let ((describe-func (function (lambda (s) ;; Print description of symbol. (if (fboundp s) ; It is a function. (princ (format "%s\t%s\n%s\n\n" s (if (commandp s) (let ((keys (where-is-internal s))) (if keys (concat "Keys: " (mapconcat 'key-description keys " ")) "Keys: none")) "Function") (or (documentation s) "not documented")))) (if (boundp s) ; It is a variable. (princ (format "%s\t%s\n%s\n\n" s (if (user-variable-p s) "Option " "Variable") (or (documentation-property s 'variable-documentation) "not documented"))))))) sym-list) ;; Build a list of symbols that match pattern. (mapatoms (function (lambda (sym) (if (string-match pattern (symbol-name sym)) (setq sym-list (cons sym sym-list)))))) ;; Display the data. (with-output-to-temp-buffer "*Help*" (mapcar describe-func (sort sym-list 'string<)) (print-help-return-message)))) (define-key help-map "\C-s" 'describe-symbols) (autoload 'latex-help "ltx-help") (define-key help-map "\C-l" 'latex-help) ;;; edb (setq db-sort-modifies-p t ; use-electric-help-p t ) (defun ordinary-truncation-function (max-width display-rep display-rep-length) (put-text-property max-width display-rep-length 'invisible t nil)) (defun tjc-db-setup () "Settings common for all 3 EDB modes." (local-set-key "\C-?" 'delete-char) (local-unset-key "\M-O") (local-set-key [down] "\C-n") (local-set-key [up] "\C-p") (local-set-key [next] "\M-n") (local-set-key [prior] "\M-p")) (add-hook 'db-view-mode-hooks 'tjc-db-setup) (add-hook 'db-edit-mode-hooks (lambda () (progn (abbrev-mode 1) (tjc-db-setup) (local-set-key [(shift tab)] 'db-previous-field) (local-set-key [(meta return)] 'db-add-record)))) (add-hook 'database-summary-mode-hooks (lambda () (progn (tjc-db-setup) (local-set-key [next] (lambda () (interactive) (db-next-record (- (window-height) 2)))) (local-set-key [previous] (lambda () (interactive) (db-previous-record 10))) (setq truncate-lines t) ))) ;;; delete (add-hook 'cperl-mode-hook (lambda () (progn ; (setq perl-font-lock-keywords ; (purecopy (append '("\\<\\(use\\|require\\|my\\)\\>" ("[$@%][A-Za-z_][A-Za-z0-9_]*" . font-lock-type-face)) perl-font-lock-keywords))) (setq comment-column 48) (local-set-key [f2] (lambda () (interactive) (progn (save-buffer) (shell-command (concat (buffer-name) "&"))))) (local-set-key "\C-h" 'backward-delete-char) (local-set-key "\M-\C-h" 'backward-kill-word)))) ;; mailcrypt (setq mc-encrypt-for-me t mc-pgp-always-sign t mc-passwd-timeout 60 mc-read-mode-string "" mc-write-mode-string "" mc-pgp-comment "" ) ;;; ps-print (setq lpr-command "lp" lpr-switches '("-s" "-dnab319ps")) (setq ps-print-color-p nil) (setq ps-print-header nil) ;(setq ps-font-size 10 ; ps-avg-char-width (if (fboundp 'float) 5.6 6) ; ps-space-width (if (fboundp 'float) 5.6 6) ; ps-line-height (if (fboundp 'float) 11.29 11)) (setq ps-font-size 7 ps-avg-char-width 3.6 ps-space-width 3.6 ps-line-height 8) ;(defun tjc-ps-despool (&optional filename) ; (require 'ps-print) ; (if (not filename) ; (setq filename '(4))) ; (interactive (list (ps-print-preprint (not current-prefix-arg)))) ; (ps-do-despool filename)) (global-set-key [print] 'ps-spool-buffer-with-faces) ; print-screen (global-set-key [sys_req] 'ps-spool-region-with-faces) (global-set-key [(control print)] 'ps-spool-region-with-faces) (global-set-key [(meta execute)] 'ps-despool) (global-set-key [(meta print)] 'ps-despool) ;;;---------------------------------------------------------------- ;;; keys ;;; 'q' kills temp buffers (global-set-key "q" (function (lambda (x) (interactive "p") (if (member (buffer-name) '("*Completions*" "*vc*" "*compilation*" "*MailCrypt*" " *Message-Log*" "*Warnings*" "*GNU Emacs Lisp Code Directory Apropos*" "*Shell Command Output*" "*Directory*" "*Compile-Log*" "*Message*" "*Database-Log*" "*grep*" "*Command History*" "*Fancy Diary Entries*" "*TeX Help*")) (progn ; (debug) (kill-buffer nil)) (self-insert-command x))))) (if (boundp 'view-minor-mode-map) (define-key view-minor-mode-map "q" (lambda () (interactive) (kill-buffer nil)))) ;(define-key hypropos-help-map "q" 'hypropos-quit) (global-set-key "\C-xk" 'kill-this-buffer) (global-set-key "\C-x\C-k" #'(lambda () (interactive) (kill-some-buffers) (message ""))) (global-set-key "\M-\C-h" 'backward-kill-word) ;(add-hook 'dired-load-hook ; (lambda () (define-key dired-mode-map "q" (lambda () (interactive) (kill-buffer nil))))) ;;; remove-training-wheels-and-fly-like-vi (fset 'yes-or-no-p 'y-or-n-p) ;;; (setq disabled-command-hook nil) ;(setq dired-no-confirm ; '(byte-compile chgrp chmod chown compress copy delete hardlink ; load move print shell symlink uncompress)) (define-key query-replace-map [return] 'act) (define-key query-replace-map "\C-m" 'act) ;;; vt100 mappings (19.14 likes it) ;(define-key function-key-map "\C-h" [backspace]) ; hopefully not needed (tput smkx) (define-key function-key-map "\e[A" [up]) (define-key function-key-map "\e[B" [down]) (define-key function-key-map "\e[C" [right]) (define-key function-key-map "\e[D" [left]) ;;(define-key function-key-map "\e[1~" [find]) (define-key function-key-map "\e[1~" [end]) ;(define-key function-key-map "\e[2~" [?\C-x ?\C-x]) (define-key function-key-map "\e[2~" [insert]) (define-key function-key-map "\e[3~" [delete]) (define-key function-key-map "\e[4~" [home]) ;;(define-key function-key-map "\e[4~" [select]) (define-key function-key-map "\e[5~" [prior]) (define-key function-key-map "\e[6~" [next]) ;(key-sequence-list-description "\C-x\C-\M-xab") ;(key-sequence-list-description [(control ?a) (meta ?w)]) ;;(global-set-key [select] [home]) ; home ;;(global-set-key [find] [end]) ; end ;(define-key function-key-map "\eOP" [f1]) ; pf1 ;(define-key function-key-map "\eOQ" [f2]) ; pf2 ;(define-key function-key-map "\eOR" [f3]) ; pf3 ;(define-key function-key-map "\eOS" [f4]) ; pf4 ;(define-key function-key-map "\e[25~" [f13]) ;(define-key function-key-map "\e[26~" [f14]) ;(define-key function-key-map "\e[Z" [(shift tab)]) ; shift tab ;;; conex mappings ;(global-set-key "\C-c1" [(control prior)]) ;(global-set-key "\C-c2" [(control next)]) ;(global-set-key "\C-c3" [(control up)]) ;(global-set-key "\C-c4" [(control down)]) ;(global-set-key [f1] 'help-command) (global-set-key "\M-?" 'help-command) (make-variable-buffer-local 'compile-command) (global-set-key [f2] (lambda () (interactive) (progn (require 'compile) (compile compile-command)))) (global-set-key [f3] (lambda (&optional arg) (interactive "P") (next-error arg))) (global-set-key [f4] 'call-last-kbd-macro) ;;; X mappings ;(global-set-key [mouse_2] 'x-insert-selection) (global-set-key [(control meta next)] 'next-multiframe-window) (global-set-key [(control meta prior)] 'previous-multiframe-window) (global-set-key [hpBackTab] [(backtab)]) (global-set-key [ISO_Left_Tab] [(backtab)]) (global-set-key [iso-left-tab] [(backtab)]) (global-set-key [(backtab)] [(shift tab)]) (global-set-key [(shift tab)] 'other-window) (global-set-key [(meta f1)] [f11]) (global-set-key [(meta f2)] [f12]) (global-set-key [(meta f3)] [f13]) (global-set-key [(meta f4)] [f14]) (global-set-key "\M-*" 'query-replace-regexp) ;;; scroll other window ;(global-set-key [(control prior)] (lambda () (interactive) (scroll-other-window-down nil))) ;(global-set-key [(control next)] (lambda () (interactive) (scroll-other-window nil))) (global-set-key [f11] 'tjc-unbury-buffer) (global-set-key [f12] 'tjc-bury-buffer) (global-set-key [f13] (lambda () (interactive) (scroll-down 1))) (global-set-key [f14] (lambda () (interactive) (scroll-up 1))) (global-set-key [(control shift up)] (lambda () (interactive) (scroll-down 1))) (global-set-key [(control shift down)] (lambda () (interactive) (scroll-up 1))) (global-set-key "\C-c\C-c" 'compile) (global-set-key "\C-c\C-k" 'kill-compilation) (define-key emacs-lisp-mode-map "\C-c\C-c" (lambda () (interactive) (byte-compile-file buffer-file-name))) (global-set-key "\C-x\C-j" (lambda () (interactive) (progn (setq truncate-lines (not truncate-lines)) (redraw-frame (window-frame))))) ;;; (global-set-key "\M-r" (lambda () (interactive) (eval (nth 0 command-history)))) (global-set-key "\C-cd" 'tjc-delete-buffer-file) (global-set-key "\C-xm" 'vm-mail) (global-set-key "\C-x\C-m" 'vm-continue-composing-message) ;; don't want / to clear minibuffer when entering a filename (cond ((boundp 'read-file-name-map) (define-key read-file-name-map "/" 'self-insert-command) (define-key read-file-name-must-match-map "/" 'self-insert-command))) (defun tjc-delete-buffer-file () "Delete the file behind the current buffer and/or the buffer itself" (interactive) (let ((buffer-file (buffer-file-name)) (buffer-name (buffer-name))) (if (yes-or-no-p (concat "delete file \"" buffer-file "\" ? ")) (delete-file buffer-file)) (if (y-or-n-p (concat "kill this buffer \"" buffer-name "\" ? ")) (kill-buffer buffer-name)) (message ""))) (setq bbdb-send-mail-style 'vm bbdb-always-add-addresses nil bbdb/mail-auto-create-p nil bbdb-use-alternate-names nil bbdb-quiet-about-name-mismatches t bbdb-use-pop-up nil ; bbdb/mail-auto-create-p bbdb-ignore-some-messages-hook ; bbdb-ignore-some-messages-alist '(("From" . "))) ) (add-hook 'bbdb-mode-hook (function (lambda () ; (require 'bbdb-xemacs) (define-key bbdb-mode-map "P" 'bbdb-print) (autoload 'bbdb-print "bbdb-print" "BBDB to TeX" t)))) (setq default-major-mode 'text-mode) ;; avoid deactivation of region when buffer end or beginning is reached ;(defadvice line-move (around catch-buffer-border-error activate) ; "Catch errors `beginning-of-buffer' or `end-of-buffer' to avoid ;deactivation of region" ; (condition-case () ; ad-do-it ; ((beginning-of-buffer end-of-buffer) (ding nil 'buffer-bound)))) ;;; keys functions (setq-default fill-column 72) (setq default-case-fold-search t) (setq abbrev-all-caps nil crypt-never-ever-decrypt t ; if you don't encrypt anything indent-tabs-mode t kill-whole-line t make-backup-files nil mark-even-if-inactive t next-line-add-newlines nil require-final-newline t scroll-step 1 search-highlight t visible-bell nil ) ;(put 'eval-expression 'disabled nil) ;; (put 'save-buffers-kill-emacs 'disabled t) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; dired (setq dired-dwim-target t dired-listing-switches "-alF" dired-ls-F-marks-symlinks t list-directory-verbose-switches "-lF") ;;; LaTeX ;;;(setq LaTeX-indent-level 2) (add-hook 'TeX-mode-hook (function (lambda () (turn-on-auto-fill) ; (local-set-key "\C-?" 'backward-delete-char) ; (local-set-key [delete] 'delete-char) (local-set-key [f2] (lambda () (interactive) (progn (save-buffer) (save-excursion (TeX-command TeX-command-default 'TeX-master-file)) (TeX-recenter-output-buffer nil) ))) (local-set-key [f3] 'TeX-next-error) (local-set-key "\C-cc" 'LaTeX-environment) (local-set-key "\M-g" 'goto-line) ; (setq tjc-forward-regex "^\\\\\\(subsection\\|section\\|chapter\\|end\\{document\\}\\)") (outline-minor-mode) (setq TeX-auto-untabify nil) (setq LaTeX-equation-label nil) ; (setq TeX-outline-extra '(("slide" 1))) (setq TeX-command-list (append '( ("PDFLaTeX" "pdflatex '\\nonstopmode\\input{%t}'" TeX-run-LaTeX nil t) ("TeXSpell" "texspell -c -i /usr/contrib/share/texmf/spell/texspell.inf %t /usr/contrib/share/texmf/spell/mazovia.twl" TeX-run-compile t nil)) TeX-command-list)) ; (setq TeX-auto-local "/tmp/wuja/") ; (setq LaTeX-indent-environment-list ; (append ; '(("mathematica" current-indentation)) ; LaTeX-indent-environment-list)) ))) ;;; Misc (setq auto-mode-alist (append '(("\\.def$" . tex-mode) ("\\.dtx$" . latex-mode) ("\\.mma$" . latex-mathematica) ("\\.s?html?$" . hm--html-mode) ("\\.cxx$" . c++-mode) ("\\.w$" . cweb-mode) ("\\.jw$" . javaweb-mode) ("\\.ch$" . cweb++-mode) ("\\.SCORE$\\|\\.gnus\\|\\.sql-mode" . emacs-lisp-mode) ) auto-mode-alist)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; RCS ;;(setq vc-initial-comment t) (setq diff-switches "-udw" vc-command-messages t) (add-hook 'vc-mode-hook '(defun () (setq vc-header-alist (append '((RCS (concat "$L" "og$"))) vc-header-alist)) (setq vc-static-header-alist '( ("\\.\\(c\\|cc\\|h\\|w\\)$" . "static char rcsid[] __attribute__ ((unused)) = \"$Id: .emacs,v 1.6 1996/10/10 23:40:09 tjchol01 Exp $\";\n") ;;; "\n#ident \"$Id: .emacs,v 1.6 1996/10/10 23:40:09 tjchol01 Exp $\"\n") )) (make-variable-buffer-local 'kill-buffer-query-functions) (add-hook 'kill-buffer-query-functions (function (lambda () (and vc-mode (not buffer-read-only) (y-or-n-p "File is checked out. Do you want to kill this buffer? "))))) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; C style (defconst my-c-style '("PERSONAL" (c-basic-offset . 4) (c-tab-always-indent . t) (c-comment-only-line-offset . 4) (c-hanging-braces-alist . ((block-open after) (defun-open after) (class-open after) (inline-open after) (brace-list-open after) (brace-list-intro after) (brace-list-entry after) (substatement-open after))) (c-hanging-colons-alist . ((member-init-intro before) (inher-intro) (case-label after) (label after) (access-label after))) (c-cleanup-list . (scope-operator brace-else-brace empty-defun-braces defun-close-semi list-close-comma)) (c-offsets-alist . ( ;;(arglist-close . c-lineup-arglist) (arglist-close . +) ;;(case-label . 4) ;;(block-open . 0) (statement-cont . c-lineup-math) (label . -) (knr-argdecl-intro . -))) (c-echo-syntactic-information-p . t) (c-toggle-auto-hungry-state . t) (c-block-comments-indent-p . n) (c-recognize-knr-p nil) ; no recognition for K&R style to speed up parsing (c-comment-only-line-offset 0)) "T.Ch. C Programming Style") (defun tjc-c-mode-common-hook () (setq comment-column 48) (modify-syntax-entry ?_ "w") ;!!! just experimenting (local-set-key "\M-\C-h" 'backward-kill-word) (local-set-key "\C-c]" (lambda () (interactive) (progn (beginning-of-line) (insert "#endif\n")))) (define-key c-mode-map "\C-m" 'newline-and-indent) (define-key c-mode-map "\C-c\C-c" 'compile) (define-key c-mode-map "\C-c\C-k" 'kill-compilation) ;; this will make sure spaces are used instead of tabs (setq c-comment-start-regexp "//\\|/\\*") (let ((my-style "PERSONAL")) (or (assoc my-style c-style-alist) (setq c-style-alist (cons my-c-style c-style-alist))) (c-set-style my-style))) (add-hook 'c-mode-common-hook 'tjc-c-mode-common-hook) ;;(add-hook 'c-special-indent-hook 'c-indent-after-comment-line) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Internet services ;;; ftp (setq efs-ftp-default-user (user-login-name) ; "anonymous" efs-ftp-generate-anonymous-password nil ; use $USER@`hostname` efs-ftp-binary-file-name-regexp "." ; always transfer in binary mode ) ;;; X oriented stuff (require 'font-lock) (setq font-lock-auto-fontify t) (font-lock-use-default-maximal-decoration) (cond (running-xemacs (setq cweb-specific-keywords '(("^\\(@ \\)?@[<(*a-z \t]?" . font-lock-keyword-face) ; @, @x, @* ("^\\(@ \\)?@[<(].*\\(@>[+=]*\\)" 2 font-lock-keyword-face) ; @>, @>+= ("^\\(@ \\)?@[(<]\\(.*\\)@>" 2 font-lock-doc-string-face) ; @ ("^%.*$" . font-lock-comment-face) )) (setq cweb-font-lock-keywords (purecopy (append cweb-specific-keywords c-font-lock-keywords))) (setq cweb++-font-lock-keywords (purecopy (append cweb-specific-keywords c++-font-lock-keywords))) (setq ml-font-lock-keywords (purecopy (append '("^:[A-Za-z]+:") c++-font-lock-keywords))) (setq javaweb-font-lock-keywords (purecopy (append cweb-specific-keywords java-font-lock-keywords))) (setq-default modeline-buffer-identification '("%17b")) (setq-default modeline-modified '("%1*%1+")) (setq-default modeline-format (list (purecopy "") (if (featurep 'mule) 'modeline-multibyte-status (purecopy "")) (cons modeline-modified-extent 'modeline-modified) (cons modeline-buffer-id-extent 'modeline-buffer-identification) (purecopy " ") 'global-mode-string (purecopy " %[(") (cons modeline-minor-mode-extent (list "" 'mode-name 'minor-mode-alist)) (cons modeline-narrowed-extent "%n") 'modeline-process (if emacsx (purecopy ")%]--%l/%c--") (purecopy ")%]--%l--")) (purecopy '(-3 . "%p")) (purecopy "-%-"))) )) ;; (require 'font-lock-extra) ;; (setq c-font-lock-keywords c-font-lock-keywords-3) (add-hook 'math-mode-hook (lambda () (make-local-variable 'outline-regexp) (setq outline-regexp "^[^] \t\n)]") (outline-minor-mode) (make-variable-buffer-local 'comment-start) (setq comment-start "(* ") (make-variable-buffer-local 'comment-end) (setq comment-end "*)") (make-variable-buffer-local 'comment-start-skip) (setq comment-start-skip "(\\*+[ \t]*") (require 'mma-font-lock) ;; (turn-on-font-lock) )) (defun tjc-outline-down () (interactive) (condition-case nil (outline-next-visible-heading 1) (error (beginning-of-line) (error ""))) (next-line 1)) (defun tjc-outline-up () (interactive) (previous-line 1) (condition-case nil (outline-previous-visible-heading 1) (error (next-line 1) (error ""))) (next-line 1)) (setq tex-mma-minor-mode-hook (lambda () (progn (make-variable-buffer-local 'tex-font-lock-keywords) (require 'mma-font-lock) (setq tex-font-lock-keywords (append tex-font-lock-keywords math-font-lock-keywords)) (setq font-lock-defaults '(tex-font-lock-keywords nil nil nil)) ; switch off $.$ fontlock (turn-on-font-lock) (setq fill-column 200) ;;; (local-set-key [delete] 'delete-char) ; (local-set-key "\C-?" 'backward-delete-char) (make-local-variable 'outline-regexp) (setq outline-regexp "\\\\begin{mathematica}") (outline-minor-mode) (make-variable-buffer-local 'tex-mma-keymap) (define-key tex-mma-keymap [(control down)] 'tjc-outline-down) (define-key tex-mma-keymap [(control up)] 'tjc-outline-up) (make-variable-buffer-local 'compile-command) (define-key tex-mma-keymap ?\" 'self-insert-command) (define-key tex-mma-keymap [(control insert)] 'tex-mma-update) (define-key tex-mma-keymap [f2] 'tex-mma-update) (define-key tex-mma-keymap [f3] #'(lambda () (interactive) (shell-command "killall psrender"))) ))) (add-hook 'csh-mode-hook (lambda () (progn ; (turn-on-font-lock) (setq comment-start "# ") (setq comment-start-skip "#+[ \t]*")))) (add-hook 'bibtex-mode-hook (lambda () (progn (make-local-variable 'outline-regexp) (setq outline-regexp "@") (make-local-variable 'comment-start) (setq comment-start "% ") (outline-minor-mode) (local-set-key [(control insert)] 'bibtex-entry) (local-set-key [f2] (lambda () (interactive) (progn (save-buffer) (shell-command (concat "bibtex " (file-name-sans-extension (buffer-name)) "&"))))) ))) (add-hook 'outline-minor-mode-hook #'(lambda () (local-set-key [(control down)] 'outline-next-visible-heading) (local-set-key [(control up)] 'outline-previous-visible-heading) )) ;;; CWEB (defun cweb-mode () "CWeb Mode." (interactive) (let ((c-mode-hook nil)) (c-mode)) (setq mode-name "CWeb") (setq major-mode 'cweb-mode) (make-local-variable 'outline-regexp) (setq outline-regexp "@\\($\\|[ *]\\)") (outline-minor-mode) (modify-syntax-entry ?_ "w") (setq comment-column 48) (run-hooks 'cweb-mode-hook) ) (defun cweb++-mode () "CWeb++ Mode." (interactive) (let ((c++-mode-hook nil)) (c++-mode)) (setq mode-name "CWeb++") (setq major-mode 'cweb++-mode) (make-local-variable 'outline-regexp) (setq outline-regexp "@\\($\\|[ *]\\)") (outline-minor-mode) (setq comment-column 48) (run-hooks 'cweb++-mode-hook) ) ;;; JavaWEB (defun javaweb-mode () "JavaWeb Mode." (interactive) ; (let ((java-mode-hook nil)) (java-mode) ;) (setq mode-name "JavaWeb") (setq major-mode 'cweb-mode) (make-local-variable 'outline-regexp) (setq outline-regexp "@\\($\\|[ *]\\)") (outline-minor-mode) (setq comment-column 48) (run-hooks 'javaweb-mode-hook) ) (add-hook 'metapost-mode-hook (function (lambda () (make-local-variable 'outline-regexp) (setq outline-regexp "\\(beginfig\\|end\\>\\|def\\|vardef\\)") (outline-minor-mode) (make-variable-buffer-local 'compile-command) (setq compile-command (concat "env TEX=latex mpost '\\nonstopmode; input " buffer-file-name "'")) ; (setq compile-command (concat "time bigmp '\\nonstopmode; input " buffer-file-name "'")) ; (setq compile-command (concat "time mpost '\\relax; input " buffer-file-name "'")) ))) (defun tjc-unbury-buffer () "Switch to the buffer at the bottom of the buffer list, if it's not a 'hidden' buffer." (interactive) (let ((all-buffers (buffer-list)) (done nil) (i 1)) (setq i (- (length all-buffers) 1)) (while (and (not done) (>= i 0)) (let ((buf (nth i all-buffers)) (first-char "")) (setq first-char (substring (buffer-name buf) 0 1)) (if (not (or (equal first-char "*") (equal first-char " "))) (progn (switch-to-buffer buf) (setq done t)) (setq i (- i 1)) ))) )) (defun tjc-bury-buffer () "Bury the current buffer" ;; until you find a non-'hidden' buffer." (interactive) (bury-buffer) (let ((all-buffers (buffer-list)) (done nil) (i 0)) (while (and (not done) (<= i (length all-buffers))) (let ((buf (nth i all-buffers)) (first-char "")) (setq first-char (substring (buffer-name buf) 0 1)) (if (not (or (equal first-char "*") (equal first-char " "))) (progn (switch-to-buffer buf) (setq done t)) (setq i (+ i 1)) ))) )) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; XEMACS (setq find-file-use-truenames nil find-file-compare-truenames t minibuffer-confirm-incomplete t complex-buffers-menu-p t teach-extended-commands-p t teach-extended-commands-timeout 1 ;; debug-on-error nil zmacs-regions t ) (setq-default truncate-lines nil) (if emacsx (progn ;;; X11 ;; (require 'avoid) ;; (mouse-avoidance-mode 'banish) (global-unset-key "\C-z") ;;;(setq fast-lock-cache-directories '("/tmp/wuja")) ;;;(add-hook 'font-lock-mode-hook 'turn-on-fast-lock) ; (set-face-font 'modeline "9x15bold") ; (set-face-font 'font-lock-keyword-face "9x15bold") ; (set-face-font 'bold "9x15bold") (setq *try-oblique-before-italic-fonts* t) (set-face-font 'default "-*-courier-medium-r-*-14-*-iso8859-2") (set-face-font 'bold "-*-courier-bold-r-normal-*-14-*-iso8859-2") (set-face-font 'italic "-*-courier-medium-o-normal-*-14-*-iso8859-2") (set-face-font 'bold-italic "-*-courier-bold-o-normal-*-14-*-iso8859-2") (make-face-bold 'font-lock-keyword-face) (make-face-bold 'modeline) ; (set-face-font 'default "-*-palatino-medium-r-*-14-*-iso8859-1") ; (set-face-font 'bold "-*-palatino-bold-r-normal-*-14-*-iso8859-1") ; (set-face-font 'italic "-*-palatino-medium-o-normal-*-14-*-iso8859-1") ; (set-face-font 'bold-italic "-*-palatino-bold-o-normal-*-14-*-iso8859-1") ;; window setup ; (setq default-frame-plist ; (append ; default-frame-plist ; '(width 55 height 67 left 750 top 00 border-width 0) ; )) ; (setq initial-frame-plist '(width 80 height 67 left 0 top 0 border-width 0)) ; (set-face-foreground 'default "white") ; (set-face-background 'default "black") ; (set-face-foreground 'font-lock-type-face "blue1") ; (set-face-foreground 'font-lock-comment-face "#6920ac") ; (set-face-foreground 'font-lock-string-face "green2") ; (set-face-foreground 'font-lock-doc-string-face "green1") ; (set-face-foreground 'font-lock-function-name-face "red2") ; (set-face-foreground 'font-lock-keyword-face "blue2") ;;; (set-menubar nil) (setq font-menu-ignore-scaled-fonts nil font-menu-this-frame-only-p nil bar-cursor nil mouse-yank-at-point t) ) ;;; tty (make-face-bold 'font-lock-comment-face) (make-face-bold 'font-lock-doc-string-face) (make-face-bold 'font-lock-function-name-face) (set-face-underline-p 'font-lock-function-name-face t) ; (make-face-bold 'font-lock-reference-face) (make-face-bold 'font-lock-keyword-face) (make-face-bold 'font-lock-preprocessor-face) (make-face-bold 'font-lock-string-face) (set-face-underline-p 'font-lock-type-face t) ) ;; (add-spec-list-to-specifier has-modeline-p '((global (nil . t)))) (defun diary-start (m1 d1 y1) (diary-block m1 d1 y1 1 1 2100)) ;(let ((date '(11 1 1996)) ; (entry "zuzia")) ; (diary-countdown 0 0 11 1 1996) ;) (if (file-readable-p diary-file) (progn (require 'appt) (require 'time) (appt-initialize) (setq appt-msg-countdown-list '(20 15 10 5 3 1) appt-announce-method 'appt-window-announce appt-display-duration 5 diary-list-include-blanks t) ;(if emacsx ; 'appt-frame-announce ; 'appt-window-announce) ;;;'appt-message-announce 'appt-persistent-message-announce (add-hook 'diary-display-hook 'fancy-diary-display) (add-hook 'list-diary-entries-hook 'include-other-diary-files) (add-hook 'diary-hook #'(lambda () (let ((b (get-buffer "diary"))) (if b (kill-buffer b))) )) (diary) )) (add-hook 'after-init-hook '(lambda () (setq debug-on-error '(args-out-of-range arith-error cyclic-function-indirection end-of-file invalid-function invalid-read-syntax invalid-regexp no-catch protected-field setting-constant void-function void-variable wrong-number-of-arguments wrong-type-argument)))) ;(setq debug-on-error nil) (if (file-readable-p "~/.emacs.personal") (load-file "~/.emacs.personal")) ;;; remove common mode specifiers from the modeline (setq minor-mode-alist (remassq 'font-lock-mode minor-mode-alist)) (setq eldoc-minor-mode-string "") ; (paren-set-mode 'blink-paren) ; paren-blink-interval 0.2 ; paren-ding-unmatched nil (setq paren-face (if emacsx 'bold 'red) paren-sexp-mode t paren-priority 'open paren-delay nil paren-dont-touch-blink nil) (require 'mic-paren) (paren-activate) ;;; $Log: .emacs,v $ ;;; Revision 1.6 1996/10/10 23:40:09 tjchol01 ;;; Added bibtex-mode-hook. ;;; ;;; Revision 1.5 1996/10/10 18:39:10 tjchol01 ;;; Added MetaPost mode. ;;; ;;; Revision 1.4 1996/09/13 18:02:53 tjchol01 ;;; Reinserted tjc-xemacs.el. ;;; ;;; Revision 1.3 1996/07/18 05:21:51 tjchol01 ;;; Extracted tjc-xemacs.el. ;;; ;;; Revision 1.2 1996/07/18 04:45:42 tjchol01 ;;; Before removing GNU support. ;;; ;;; Revision 1.1 1996/05/30 03:10:22 tjchol01 ;;; Initial revision