(custom-set-variables ;; custom-set-variables was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(fill-column 78) '(imenu-use-markers nil) '(inhibit-local-menu-bar-menus t) '(inhibit-startup-screen t) '(require-final-newline t) '(tool-bar-mode nil nil (tool-bar))) (custom-set-faces ;; custom-set-faces was added by Custom -- don't edit or cut/paste it! ;; Your init file should contain only one such instance. '(menu ((((type x-toolkit)) nil)))) ;; Set up the keyboard so the delete key on both the regular keyboard ;; and the keypad delete the character under the cursor and to the right ;; under X, instead of the default, backspace behavior. (global-set-key [delete] 'delete-char) (global-set-key [kp-delete] 'delete-char) ;; turn on font-lock mode (global-font-lock-mode t) (set-default-font "6x10") ;; avoid messing with final newlines: ;;(setq inhibit-default-init t) ;; stop at the end of the file, not just add lines (setq next-line-add-newlines nil) ;; always end a file with a newline (setq require-final-newline t) ;; enable visual feedback on selections (setq-default transient-mark-mode t) (defun hi-contrast () (interactive) (set-background-color "white") (set-foreground-color "black") (set-cursor-color "black") ) (defun lo-contrast () (interactive) (set-background-color "black") (set-foreground-color "white") (set-cursor-color "red") ) (defun default-colors () (interactive) (set-background-color "deep sky blue") (set-foreground-color "black") (set-cursor-color "red") ) (when window-system ;; enable wheelmouse support by default (mwheel-install) ;; use extended compound-text coding for X clipboard (set-selection-coding-system 'compound-text-with-extensions) (default-colors) ;;(set-background-color "black") ;;(set-foreground-color "honeydew3") ;;(set-background-color "GreenYellow") ;;(set-foreground-color "black") (set-cursor-color "red") ;;(set-foreground-color "red2") ;; (set-background-color "coral2") ;; (set-cursor-color "green4") ) (defun previous-window () (interactive) (other-window -1)) (global-set-key [?\C-o] 'other-window) (global-set-key [?\C-\M-O] 'previous-window) (global-set-key [?\C-\M-f] 'forward-list) (global-set-key [?\C-\M-b] 'backward-list) (global-set-key [?\M-9] 'backward-word) (global-set-key [?\M-0] 'forward-word) ; allow moving the view without moving cursor ; also can use C-l to recenter display around current cursor position (fset 'view-up-one "\C-u1\C-[xscroll-down") (fset 'view-down-one "\C-u1\C-[xscroll-up") (global-set-key [?\M-\C-n] 'view-down-one) (global-set-key [?\M-\C-p] 'view-up-one) (global-set-key [?\M-n] 'forward-paragraph) (global-set-key [?\M-p] 'backward-paragraph) (defun unfill-paragraph () (interactive) (let ((saved-fill-col fill-column)) (setq fill-column 9999999) (fill-paragraph nil) (setq fill-column saved-fill-col) )) (global-set-key [?\C-`] 'unfill-paragraph) (global-set-key [?\M-u] 'unfill-paragraph) ;;(global-set-key [?\C-@] 'unfill-paragraph) (add-hook 'text-mode-hook 'turn-on-auto-fill) (defun rebind-local () (interactive) (local-set-key [?\C-o] 'other-window)) ;;(add-hook 'dired-load-hook 'rebind) (add-hook 'dired-mode-hook 'rebind-local) (add-to-list 'load-path "~/.emacs_addons") (setq my-matlab-file "~/.emacs_addons/matlab.el") (autoload 'matlab-mode my-matlab-file "Enter Matlab mode." t) (setq auto-mode-alist (cons '("\\.m\\'" . matlab-mode) auto-mode-alist)) (autoload 'matlab-shell my-matlab-file "Interactive Matlab mode." t) (global-set-key [?\M-g] 'goto-line) (global-set-key "\C-cc" 'comment-region) (global-set-key "\C-cu" 'uncomment-region) (defun insert-timestamp () (interactive) (insert (format-time-string "%Y/%m/%d" (current-time)))) ;; (format-time-string "%Y/%m/%d %H:%M:%S" (current-time)))) (defun insert-hms () (interactive) (insert ;; (format-time-string "%Y/%m/%d" (current-time)))) (format-time-string "%H:%M:%S" (current-time)))) (global-set-key [?\M-\C-t] 'insert-hms) (global-set-key [?\M-t] 'insert-timestamp) ;;(fset 'insert-new-category ;; [?\C-a return return ?\C-p ?\C-p ?[ ?{ ?< ?> ?} return return ?[ ?] return return ?] ?\C-p ?\C-p ?\C-p ?\C-p ?\C-e ?\C-b ?\C-b]) (fset 'insert-new-category "\C-a\C-m\C-m\C-p\C-p\C-m[{<>}\C-m\C-m[]\C-m\C-m]\C-p\C-p\C-p\C-p\C-f\C-f") (global-set-key [?\M-c] 'insert-new-category) (defun count-words (beg end) (save-excursion (set-mark beg) (goto-char end) (let ((words 0)) (while (< (mark) (point)) (forward-word -1) (setq words (1+ words))) (princ (concat (number-to-string words) " word(s)"))))) (defun count-words-region () (interactive) (count-words (mark) (point))) (defun count-chars-region (&optional start end) (interactive) (or start (setq start (region-beginning))) (or end (setq end (region-end))) (princ (number-to-string (- end start)))) (defun count-words-buffer () (interactive) (count-words (point-min) (point-max))) (global-set-key "\C-cwb" 'count-words-buffer) (global-set-key "\C-cwr" 'count-words-region) (defun open-notes () (interactive) (find-file "~/Notes/notes.txt") ) (global-set-key "\C-cn" 'open-notes) ;; convert a buffer from dos ^M end of lines to unix end of lines ;; (defun dos2unix () ;; (interactive) ;; (set-buffer-file-coding-system 'undecided-unix nil)) ;;(defun unix2dos () ;; (interactive) ;; (goto-char (point-min)) ;; (while (search-forward "\n" nil t) (replace-match "\r\n"))) (defun unix2dos () (interactive) (set-buffer-file-coding-system 'dos nil)) ;vice versa (defun dos2unix () (interactive) (goto-char (point-min)) (while (search-forward "\r" nil t) (replace-match ""))) (setq visible-bell t) ;;(setq HOME (getenv "HOME")) (when (file-exists-p "~/opt/slime-2.0") (add-to-list 'load-path "~/opt/slime-2.0/") (require 'slime) (slime-setup) ;; slime-mode-map ;; slime-repl-mode-map ;; slime-scratch-mode-map (define-key text-mode-map [?\M-j] 'slime-eval-print-last-expression) (define-key text-mode-map [?\C-x ?\C-e] 'slime-eval-last-expression) (define-key text-mode-map "\C-cr" 'slime-eval-region) (define-key slime-mode-map [?\M-j] 'slime-eval-print-last-expression) ) (add-to-list 'load-path "/usr/share/emacs/21.4/lisp/") ;;(setq inferior-lisp-program "sbcl") (setq inferior-lisp-program "lisp") (global-set-key [?\M-j] 'eval-print-last-sexp) ;; in case Ctrl-Space just registers as a space (global-set-key [?\M-m] 'set-mark-command) (setq x-select-enable-clipboard nil) (global-set-key [S-insert] 'clipboard-yank) (global-set-key [S-delete] 'clipboard-kill-region) (global-set-key [C-insert] 'clipboard-kill-ring-save) ;; for ilisp ;;(setq ilisp-*use-fsf-compliant-keybindings* t) (global-set-key "\C-j" 'eval-print-last-sexp) (define-key text-mode-map "\C-c\C-r" 'eval-region) (defun add-file () "calls custom script ~/bin/add-file" (interactive) (insert-file "~/tmp/file-added") ) (global-set-key "\C-xaf" 'add-file ) (ansi-color-for-comint-mode-on) (setq truncate-partial-width-windows nil) (defmacro bind-macro (keymap keystr str num-words) "If this were defined as a function, because the function definition in \ define-key is un-evaluated until the key is pressed, we need a macro to \ put a pre-determined variable value inside the lambda function." `(define-key ,keymap ,keystr (lambda (&optional cap) (interactive (list current-prefix-arg)) (insert ,str) (if cap (capitalize-word (- 0 ,num-words)))))) (progn (fset 'make-outline-node "\C-a\C-k[{\C-y}\C-m\C-m//\C-y]") ;; requires something on a line as the title of the node (define-key text-mode-map "\C-ce" 'make-outline-node)) (progn (fset 'insert-predicates [?\C-a ?\C-k ?\C-k ?\C-y return ?\C-y return ?\C-y return ?\C-y ?\C-p ?\M-f ?\M-b ?} ? ?/ ?/ ? ?\C-p ?\C-p ?\C-a ?\M-f ?\M-b ?\C-k ?i ?m ?p ?l ?i ?c ?a ?t ?i ?o ?n ?s ?: ?\C-p ?\C-p ?\C-a ?\M-f ?\M-b ? ? ?\C-a ?\C-p ?\C-p ?\C-a ?\M-f ?\M-b ?\C-k ?{ ?p ?r ?e ?d ?i ?c ?a ?t ?e ?s ?: ?\C-a ?\C-n ?\C-n ?\C-n ?\C-n ?\C-n return ?\C-y ?\M-y ?\M-y ?\C-p ?\M-f ?\M-b ?\C-k ? ? ] ;; [?\C-n ?\C-a return ?\C-p ?\C-p ?\C-a ?\C-k ?\C-k ?\C-y ?\C-y ?\C-p ?\C-p ;; ?\M-f ?\C-k M-backspace ?{ ?p ?r ?e ?d ?i ?c ?a ?t ?e ?s ?: return ;; ?\C-p ?\C-a ?\C-k ?\C-y ?\C-a ?\C-n ?\C-n ?\M-f ?\M-b ? ? ?\C-n ;; ?\C-a return ?\C-y ?\M-b backspace ?} ?\C-p return return ?\C-p ?\C-y ;; ?\M-b backspace ?\M-d ?i ?m ?p ?l ?i ?c ?a ?t ?i ?o ?n ?s ?\C-p ?\C-p ;; ?\C-a ?\M-f ?\M-b ?\C-k ?\C-y ?\C-n ?\C-n ?\C-n ?\C-n ?\C-e ;; M-backspace ? ?/ ?/ ? ?\C-y ?\M-y ?\C-p ?\C-p ?\C-a ?\C-k ?\C-y ;; return return ?\C-a ?\C-y M-backspace ? ? ] ) (define-key text-mode-map "\C-xp" 'insert-predicates)) (progn (fset 'delimit-idea [?\C-a ?\M-f ?\M-b ?{ ?\C-a ?\C-k ?\C-k ?\C-y ?\C-y ?\C-p ?\M-f ?\M-b backspace ?} ? ?/ ?/ ? ?\C-a return return ?\C-p ?\C-p return ?\C-y ?\C-p ?\M-f ?\M-b backspace ?\C-k ?\C-c ?i ?\C-a ?\C-k ?\C-y ?\C-n ?\C-a return ?\C-y ?\M-b ?\C-k ? ? ]) (define-key text-mode-map "\C-ct" 'delimit-idea)) (bind-macro text-mode-map "\C-ci" "implications:" 1) (bind-macro text-mode-map "\C-cp" "possibilities:" 1) (bind-macro text-mode-map "\C-cc" "constraints:" 1) (bind-macro text-mode-map "\C-cr" "reasons:" 1) (blink-cursor-mode -1) (bind-macro text-mode-map "\C-c\C-i" "(indent-rigidly (mark t) (point) 2)" 0) (setq scheme-program-name "scheme48") (autoload 'run-scheme "cmuscheme48" "Run an inferior Scheme process." t) (global-set-key [?\M-i] 'indent-to) (setq blink-cursor-interval 0.1) (put 'narrow-to-region 'disabled nil) ;; for preview-latex package (load "auctex.el" nil t t) ;; for preview-latex package (load "preview-latex.el" nil t t) (column-number-mode 1) (load "desktop.el" nil t t) ;; (desktop-save-mode 1)