|
| 1 | +#+TITLE: Starter Kit Misc |
| 2 | +#+OPTIONS: toc:nil num:nil ^:nil |
| 3 | + |
| 4 | +This is part of the [[file:starter-kit.org][Emacs Starter Kit]]. |
| 5 | + |
| 6 | +* Starter Kit Misc |
| 7 | +Things that don't fit anywhere else. |
| 8 | + |
| 9 | +** Color Themes |
| 10 | +Emacs24 has build in support for saving and loading themes. |
| 11 | + |
| 12 | +A Theme builder is available at http://elpa.gnu.org/themes/ along with |
| 13 | +a list of pre-built themes at http://elpa.gnu.org/themes/view.html. |
| 14 | + |
| 15 | +Downloaded themes may be saved to the =themes/= directory in the base |
| 16 | +of the starter kit which ignored by git. Once downloaded and |
| 17 | +evaluated a theme is activated using the =load-theme= function. |
| 18 | + |
| 19 | +** Window systems |
| 20 | +#+srcname: starter-kit-window-view-stuff |
| 21 | +#+begin_src emacs-lisp |
| 22 | +(when window-system |
| 23 | + (setq frame-title-format '(buffer-file-name "%f" ("%b"))) |
| 24 | + (blink-cursor-mode -1)) |
| 25 | + |
| 26 | +(mouse-wheel-mode t) |
| 27 | +(set-terminal-coding-system 'utf-8) |
| 28 | +(set-keyboard-coding-system 'utf-8) |
| 29 | +(prefer-coding-system 'utf-8) |
| 30 | + |
| 31 | +(setq visible-bell t |
| 32 | + echo-keystrokes 0.1 |
| 33 | + font-lock-maximum-decoration t |
| 34 | + inhibit-startup-message t |
| 35 | + transient-mark-mode t |
| 36 | + color-theme-is-global t |
| 37 | + delete-by-moving-to-trash t |
| 38 | + shift-select-mode nil |
| 39 | + truncate-partial-width-windows nil |
| 40 | + uniquify-buffer-name-style 'forward |
| 41 | + whitespace-style '(trailing lines space-before-tab |
| 42 | + indentation space-after-tab) |
| 43 | + whitespace-line-column 100 |
| 44 | + ediff-window-setup-function 'ediff-setup-windows-plain |
| 45 | + oddmuse-directory (concat starter-kit-dir "oddmuse") |
| 46 | + xterm-mouse-mode t |
| 47 | + save-place-file (concat starter-kit-dir "places")) |
| 48 | +#+end_src |
| 49 | + |
| 50 | +** Transparently open compressed files |
| 51 | +#+begin_src emacs-lisp |
| 52 | +(auto-compression-mode t) |
| 53 | +#+end_src |
| 54 | + |
| 55 | +** Save a list of recent files visited. |
| 56 | +#+begin_emacs-lisp |
| 57 | +(recentf-mode 1) |
| 58 | +#+end_emacs-lisp |
| 59 | + |
| 60 | +** Highlight matching parentheses when the point is on them. |
| 61 | +#+srcname: starter-kit-match-parens |
| 62 | +#+begin_src emacs-lisp |
| 63 | +(show-paren-mode 1) |
| 64 | +#+end_src |
| 65 | + |
| 66 | +** ido mode |
| 67 | +ido-mode is like magic pixie dust! |
| 68 | +#+srcname: starter-kit-loves-ido-mode |
| 69 | +#+begin_src emacs-lisp |
| 70 | +(when (> emacs-major-version 21) |
| 71 | + (ido-mode t) |
| 72 | + (setq ido-enable-prefix nil |
| 73 | + ido-enable-flex-matching t |
| 74 | + ido-create-new-buffer 'always |
| 75 | + ido-use-filename-at-point t |
| 76 | + ido-max-prospects 10)) |
| 77 | +#+end_src |
| 78 | + |
| 79 | +** Other, spell checking, tabs, imenu and a coding hook |
| 80 | +#+begin_src emacs-lisp |
| 81 | + (set-default 'indent-tabs-mode nil) |
| 82 | + (set-default 'indicate-empty-lines t) |
| 83 | + (set-default 'imenu-auto-rescan t) |
| 84 | + |
| 85 | + (add-hook 'text-mode-hook 'turn-on-auto-fill) |
| 86 | + (add-hook 'text-mode-hook 'turn-on-flyspell) |
| 87 | + |
| 88 | + (defvar starter-kit-coding-hook nil |
| 89 | + "Hook that gets run on activation of any programming mode.") |
| 90 | + |
| 91 | + (defalias 'yes-or-no-p 'y-or-n-p) |
| 92 | + ;; Seed the random-number generator |
| 93 | + (random t) |
| 94 | +#+end_src |
| 95 | + |
| 96 | +*** functions for prettier source code |
| 97 | +#+begin_src emacs-lisp |
| 98 | +(defun starter-kit-pretty-lambdas () |
| 99 | + (font-lock-add-keywords |
| 100 | + nil `(("(\\(lambda\\>\\)" |
| 101 | + (0 (progn (compose-region (match-beginning 1) (match-end 1) |
| 102 | + ,(make-char 'greek-iso8859-7 107)) |
| 103 | + nil)))))) |
| 104 | +#+end_src |
| 105 | + |
| 106 | +*** possible issues/resolutions with flyspell |
| 107 | +Most of the solution came from [[http://www.emacswiki.org/emacs/FlySpell][EmacsWiki-FlySpell]]. Here is one |
| 108 | +possible fix. |
| 109 | + |
| 110 | +**** Emacs set path to aspell |
| 111 | +it's possible aspell isn't in your path |
| 112 | +#+begin_src emacs-lisp :tangle no |
| 113 | + (setq exec-path (append exec-path '("/opt/local/bin"))) |
| 114 | +#+end_src |
| 115 | + |
| 116 | +**** Emacs specify spelling program |
| 117 | +- This didn't work at first, possibly because cocoAspell was |
| 118 | + building its dictionary. Now it seems to work fine. |
| 119 | +#+begin_src emacs-lisp :tangle no |
| 120 | + (setq ispell-program-name "aspell" |
| 121 | + ispell-dictionary "english" |
| 122 | + ispell-dictionary-alist |
| 123 | + (let ((default '("[A-Za-z]" "[^A-Za-z]" "[']" nil |
| 124 | + ("-B" "-d" "english" "--dict-dir" |
| 125 | + "/Library/Application Support/cocoAspell/aspell6-en-6.0-0") |
| 126 | + nil iso-8859-1))) |
| 127 | + `((nil ,@default) |
| 128 | + ("english" ,@default)))) |
| 129 | +#+end_src |
| 130 | + |
| 131 | +** Hippie expand: at times perhaps too hip |
| 132 | +#+begin_src emacs-lisp |
| 133 | +(delete 'try-expand-line hippie-expand-try-functions-list) |
| 134 | +(delete 'try-expand-list hippie-expand-try-functions-list) |
| 135 | +#+end_src |
| 136 | + |
| 137 | +** Don't clutter up directories with files~ |
| 138 | +Rather than saving backup files scattered all over the file system, |
| 139 | +let them live in the =backups/= directory inside of the starter kit. |
| 140 | +#+begin_src emacs-lisp |
| 141 | +(setq backup-directory-alist `(("." . ,(expand-file-name |
| 142 | + (concat starter-kit-dir "backups"))))) |
| 143 | +#+end_src |
| 144 | + |
| 145 | +** Default to unified diffs |
| 146 | +#+begin_src emacs-lisp |
| 147 | +(setq diff-switches "-u") |
| 148 | +#+end_src |
| 149 | + |
| 150 | +** Cosmetics |
| 151 | + |
| 152 | +#+begin_src emacs-lisp |
| 153 | +(eval-after-load 'diff-mode |
| 154 | + '(progn |
| 155 | + (set-face-foreground 'diff-added "green4") |
| 156 | + (set-face-foreground 'diff-removed "red3"))) |
| 157 | + |
| 158 | +(eval-after-load 'magit |
| 159 | + '(progn |
| 160 | + (set-face-foreground 'magit-diff-add "green3") |
| 161 | + (set-face-foreground 'magit-diff-del "red3"))) |
| 162 | +#+end_src |
| 163 | + |
0 commit comments