;; file: ~/.emacs ;; ================================================================ ;; ;; UBUNTU'S DEFAULT SETUP? ;; ;; ================================================================ ;; ;; uncomment this line to disable loading of "default.el" at startup (setq inhibit-default-init t) ;; turn on font-lock mode (when (fboundp 'global-font-lock-mode) (global-font-lock-mode t)) ;; enable visual feedback on selections (setq transient-mark-mode t) ;; default to better frame titles (setq frame-title-format (concat "%b - emacs@" system-name)) ;; default to unified diffs (setq diff-switches "-u") ;; (setq-default fill-column 36) ;; ================================================================ ;; ;; EMACS BEHAVIOUR - ALTERED ;; ;; ================================================================ ;; ;; ;; Prevents emacs from deleting the mailspool. (setq rmail-preserve-inbox 1) ;; Set the default font ;; (set-default-font "-*-bitstream vera sans mono-medium-r-*-*-10-*-*-*-*-*-iso8859-1") ;; This works but generates VERY small fonts ;; (set-default-font "-*-anorexia.se-*-*-*-*-*-*-*-*-*-*-*") (tool-bar-mode 1) ;; (set scroll-bar-mode 1) ;; pop up todays diary entry ;; (diary) ;; color marked sections in a different color ;; (toggle-transient-mark-mode) ;; display current time in the status bar (display-time) ;; change yes/no questions to y/n. (fset 'yes-or-no-p 'y-or-n-p) ;; scroll properly (setq scroll-step 1) ;; put column number into modeline (column-number-mode 1) ;; highlight matching parenthesis (show-paren-mode 1) ;; toggle-menu-bar 0=off 1=on (menu-bar-mode 1) ;; toggle weather or not to use auto-fill by default in textmode (toggle-text-mode-auto-fill) ;; Transparently decompress compressed files. (auto-compression-mode 1) ;; ================================================================ ;; ;; MOUSE INPUT MANIPULATION ;; ;; ================================================================ ;; ;; enables mouse scrolling. (defun up-slightly () (interactive) (scroll-up 5)) (defun down-slightly () (interactive) (scroll-down 5)) (global-set-key [mouse-4] 'down-slightly) (global-set-key [mouse-5] 'up-slightly) ;; pressing down the Shift key while scrolling make emacs scroll one line at a time (defun up-one () (interactive) (scroll-up 1)) (defun down-one () (interactive) (scroll-down 1)) (global-set-key [S-mouse-4] 'down-one) (global-set-key [S-mouse-5] 'up-one) ;; pressing the Control key while scrolling makes it go faster. (defun up-a-lot () (interactive) (scroll-up)) (defun down-a-lot () (interactive) (scroll-down)) (global-set-key [C-mouse-4] 'down-a-lot) (global-set-key [C-mouse-5] 'up-a-lot) ;; ================================================================ ;; ;; USER DEFINED EXTRA FUNCTIONS ;; ;; ================================================================ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; INSERTION OF DATES. ;; (defun insert-date-string () "Insert a nicely formated date string." (interactive) ;; (insert (format-time-string "%Y-%M-%d"))) (insert (format-time-string "%a, %d %b %Y %02H:%02M:%02S %z"))) ;; C-c i calls insert-date-string (global-set-key (kbd "C-c i") 'insert-date-string) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; DICTIONARY INIT ;; ;; Make the dictionary funktion accessible to emacs it Loads the ;; contents of this file, so I won't have to write it all in this file (load "dictionary-init") ;; Key-bindings for the dictionary-lookup function (global-set-key "\C-cs" 'dictionary-search) (global-set-key "\C-cm" 'dictionary-match-words) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; WORD COUNT ;; ;; Found this on a mailing list, it uses the wc -w command to ;; countwords, and displays it in emacs. I renamed it from ;; buffer-word-count to wc-buffer. ;; http://list-archive.xemacs.org/xemacs/199905/msg00667.html ;; (defun wc-buffer () (interactive) (shell-command-on-region (point-min) (point-max) "wc") (set-buffer "*Shell Command Output*") (goto-char (point-min)) (re-search-forward "\\s-*[0-9]+\\s-*\\([0-9]+\\)") (message (match-string 1))) ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; WORD COUNT II ;; ;; This is anther wordcount function found on the same mailing list ;; http://list-archive.xemacs.org/xemacs/199905/msg00629.html ;; written by Sam Steingold (http://www.goems.com/~sds) ;; (defun sds-word-count (start end) "Count lines/words/characters from START to END. Replacement for count-lines-region." (interactive "r") (let ((ost (syntax-table)) (nst (copy-syntax-table))) (modify-syntax-entry ?_ "w" nst) (modify-syntax-entry ?- "w" nst) (save-excursion (save-restriction (narrow-to-region start end) (goto-char (min start end)) (unwind-protect (progn (set-syntax-table nst) (message "Region (%d to %d) has: lines: %d; \ words: %d; characters: %d." start end (count-lines start end) (string-to-number (how-many "\\<")) (- end start))) (set-syntax-table ost)))))) ;; I removed the keymapping myself. ;;(define-key esc-map "=" 'sds-word-count) ; was count-line-region ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; UNFILL PARAGRAPHS ;; ;; Stefan Monnier . It is the opposite of fill-paragraph ;; Takes a multi-line paragraph and makes it into a single line of text. (defun unfill-paragraph () (interactive) (let ((fill-column (point-max))) (fill-paragraph nil))) ;; ================================================================ ;; ;; ENVIRONMENT ;; ;; ================================================================ ;; (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. '(auto-compression-mode t nil (jka-compr)) '(browse-url-generic-program "/usr/bin/firefox" t) '(case-fold-search t) '(current-language-environment "UTF-8") '(default-input-method "rfc1345") '(global-font-lock-mode t nil (font-lock)) '(ps-font-family (quote Times)) '(ps-font-size (quote (9 . 12))) '(ps-footer-font-size (quote (9 . 9))) '(ps-header-font-size (quote (7 . 7))) '(ps-header-title-font-size (quote (7 . 7))) '(ps-paper-type (quote a4) t) '(save-place t nil (saveplace)) '(show-paren-mode t nil (paren)) '(smtpmail-debug-info t) '(smtpmail-default-smtp-server "smtp.gmail.com") '(smtpmail-smtp-server "smtp.gmail.com") '(speedbar-frame-parameters (quote ((minibuffer) (width . 20) (border-width . 0) (menu-bar-lines . 0) (tool-bar-lines . 0) (unsplittable . t) (set-background-color "black")))) '(text-mode-hook (quote (turn-on-auto-fill (lambda nil (auto-fill-mode 1))))) '(transient-mark-mode t) '(uniquify-buffer-name-style (quote forward) nil (uniquify))) ;; ;; UPCASE & DOWNCASE REGIONS ;; (put 'upcase-region 'disabled nil) (put 'downcase-region 'disabled nil)