(defun	
    (kill-line
	(prefix-argument-loop
	    (progn
		(beginning-of-line)
		(save-excursion
		    (set-mark)
		    (next-line)
		    (if (! (eobp)) (beginning-of-line))
		    (delete-to-killbuffer)))))
    (insert-line
	(prefix-argument-loop
	    (beginning-of-line)
	    (newline-and-backup)))
    (backup-line
	(prefix-argument-loop
	    (previous-line)
	    (beginning-of-line)))
    (forward-line
	(prefix-argument-loop
	    (next-line)
	    (beginning-of-line)))
    (goto-line &ln
	(setq &ln (arg	1 "Line number: "))
	(beginning-of-file)
	(provide-prefix-argument (- &ln 1) (next-line)))
    (exit-recursive-edit
	(if (recursion-depth)
	    (exit-emacs)
	    (message "no recursive edit in progress (use ^X^C)")))
    (write-current-file-exit
	(write-current-file)
	(exit-emacs))
    (to-buffer
	(pop-to-buffer (get-tty-buffer ": to-buffer ")))
    (pause-emacs timer
	(setq timer (show-time 0))
	(system-call "cutils:shell")
	(show-time timer))
    (unmark
	(setq buffer-is-modified 0)
	(novalue)))
(autoload "add-change-log-entry" "addlog.ml")
(autoload "bibTeX-mode" "bibtex.ml")
(autoload "buffer-edit" "buffered.ml")
(autoload "dired" "dired.ml")
(autoload "electric-c-mode" "electricc.ml")
(autoload "electric-lisp-mode" "electricl.ml")
(autoload "goto-line" "goto.ml")
(autoload "grep" "grep.ml")
(autoload "incremental-search" "isearch.ml")
(autoload "new-electric" "newelmode.ml")
(autoload "new-undo" "undo.ml")
(autoload "prolog" "prolog.ml")
(autoload "reverse-incremental-search" "isearch.ml")
(autoload "shell" "shell.ml")
(autoload "show-line-number" "goto.ml")
(autoload "sml" "sml.ml")
(autoload "TeX-mode" "TeXmode.ml")
(autoload "next-typo" "spelling.ml")
(autoload "sweep-typos" "spelling.ml")
(auto-execute "electric-c-mode" "*.c")
(auto-execute "electric-c-mode" "*.h")
(auto-execute "electric-lisp-mode" "*.emacs_pro")
(auto-execute "electric-lisp-mode" "*.ml")
(auto-execute "TeX-mode" "*.tex")
(auto-execute "bibTeX-mode" "*.bib")
(setq-default terminal (getenv "TERM"))
(if (= (substr terminal 1 5) "vi200")
    (progn
	(bind-to-key "beginning-of-file" "\eH")
	(bind-to-key "execute-extended-command" "\e?M"); KENTER
	(bind-to-key "write-current-file-exit" "\e?l"); K,
	(bind-to-key "beginning-of-line" "\e?p"); K0
	(bind-to-key "end-of-line" "\e?q"); K1
	(bind-to-key "end-of-file" "\e?r"); K2
	(bind-to-key "end-of-window" "\e?s"); K3
	(bind-to-key "kill-line" "\e?t"); K4
	(bind-to-key "delete-next-character" "\e?u"); K5
	(bind-to-key "replace-string" "\e?v"); K6
	(bind-to-key "insert-line" "\e?w"); K7
	(bind-to-key "search-forward" "\e?y"); K9
	(bind-to-key "backward-word" "\eP"); F0
	(bind-to-key "forward-word" "\eQ"); F1
	(bind-to-key "backup-line" "\eR"); F2
	(bind-to-key "forward-line" "\e "); F3
	(bind-to-key "case-word-lower" "\e!"); F4
	(bind-to-key "case-word-upper" "\e\""); F5
	(bind-to-key "case-word-invert" "\e#"); F6
	(bind-to-key "transpose-characters" "\e$"); F7
    ))
(if (| (= (substr terminal 1 5) "vt100") (= (substr terminal 1 4) "wy75"))
    (progn
	(bind-to-key "beginning-of-file" "\e[H")
	(bind-to-key "execute-extended-command" "\eOM"); KENTER
	(bind-to-key "write-current-file-exit" "\eOl"); K,
	(bind-to-key "beginning-of-line" "\eOp"); K0
	(bind-to-key "end-of-line" "\eOq"); K1
	(bind-to-key "end-of-file" "\eOr"); K2
	(bind-to-key "end-of-window" "\eOs"); K3
	(bind-to-key "kill-line" "\eOt"); K4
	(bind-to-key "delete-next-character" "\eOu"); K5
	(bind-to-key "replace-string" "\eOv"); K6
	(bind-to-key "insert-line" "\eOw"); K7
	(bind-to-key "search-forward" "\eOy"); K9
	(bind-to-key "beginning-of-window" "\eOP"); PF1
	(bind-to-key "end-of-window" "\eOQ"); PF2
	(bind-to-key "line-to-top-of-window" "\eOR"); PF3
	(bind-to-key "backward-word" "\e[?5i"); F1
	(bind-to-key "forward-word" "\e[?3i"); F2
	(bind-to-key "backup-line" "\e[2i"); F3
	(bind-to-key "forward-line" "\e[@"); F4
	(bind-to-key "case-word-lower" "\e[M"); F5
	(bind-to-key "case-word-upper" "\e[17~"); F6
	(bind-to-key "case-word-invert" "\e[18~"); F7
	(bind-to-key "transpose-characters" "\e[19~"); F8
	(bind-to-key "previous-page" "\e[28~"); F15
	(bind-to-key "next-page" "\e[29~"); F16
	(if (= (substr terminal 1 4) "wy75")
	    (setq visible-bell 1))
    )
)
(bind-to-key "add-change-log-entry" "\^Xc")
(bind-to-key "buffer-edit" "\^X\^B")
(bind-to-key "case-word-capitalize" "\ec")
(bind-to-key "define-global-abbrev" "\^X")
(bind-to-key "delete-white-space" "\ek")
(bind-to-key "goto-line" "\^Xg")
(bind-to-key "incremental-search" "\es")
(bind-to-key "new-undo" "\^X\^U")
(bind-to-key "next-typo" "\^X\^T")
(bind-to-key "pause-emacs" '^Z')
(bind-to-key "re-search-forward" '^S')
(bind-to-key "re-search-reverse" '^R')
(bind-to-key "reverse-incremental-search" "\er")
(bind-to-key "search-reverse" "\^H")
(bind-to-key "show-line-number" "\^Xl")
(bind-to-key "sweep-typos" "\et")
(bind-to-key "to-buffer" "\^X\^O")
(bind-to-key "visit-existing-file" "\^X\^F")
(bind-to-key "exit-recursive-edit" '^C')
(setq ask-about-buffer-names 0)
(setq ctlchar-with-^ 1)
(setq default-mode-line-format "Buffer: %b%* File: %f  %M (%m)  %p%]")
(setq help-on-command-completion-error 0)
(setq quick-redisplay 1)
(setq remove-help-window 1)
(setq scroll-step 3)
(setq track-eol-on-^N-^P 0)
(setq unlink-checkpoint-files 1)
(setq wrap-long-lines 1)
(use-local-map "Minibuf-local-NS-map")
(local-bind-to-key "ESC-prefix" "\e")
(use-local-map "Minibuf-local-map")
(local-bind-to-key "ESC-prefix" "\e")
