Skip to content

Latest commit

 

History

History
175 lines (146 loc) · 5.41 KB

starter-kit-misc.org

File metadata and controls

175 lines (146 loc) · 5.41 KB

Starter Kit Misc

This is part of the Emacs Starter Kit.

Starter Kit Misc

Things that don’t fit anywhere else.

Check Dependencies

Determine whether required packages are installed. If not, use ELPA to install them. Other dependencies are provided by Emacs 24.

(starter-kit-install-if-needed 'magit)

Color Themes

Emacs24 has build in support for saving and loading themes.

A Theme builder is available at http://elpa.gnu.org/themes/ along with a list of pre-built themes at http://elpa.gnu.org/themes/view.html and themes are available through ELPA.

Downloaded themes may be saved to the themes/ directory in the base of the starter kit which ignored by git. Once downloaded and evaluated a theme is activated using the load-theme function.

Window systems

(when window-system
  (setq frame-title-format '(buffer-file-name "%f" ("%b")))
  (blink-cursor-mode -1)
  (when (require 'mwheel nil 'no-error) (mouse-wheel-mode t)))

(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(prefer-coding-system 'utf-8)

(setq visible-bell t
      echo-keystrokes 0.1
      font-lock-maximum-decoration t
      inhibit-startup-message t
      transient-mark-mode t
      color-theme-is-global t
      delete-by-moving-to-trash t
      shift-select-mode nil
      truncate-partial-width-windows nil
      uniquify-buffer-name-style 'forward
      whitespace-style '(trailing lines space-before-tab
                                  indentation space-after-tab)
      whitespace-line-column 100
      ediff-window-setup-function 'ediff-setup-windows-plain
      oddmuse-directory (concat starter-kit-dir "oddmuse")
      xterm-mouse-mode t
      save-place-file (concat starter-kit-dir "places"))

Transparently open compressed files

(auto-compression-mode t)

Save a list of recent files visited.

(recentf-mode 1)

Highlight matching parentheses when the point is on them.

(show-paren-mode 1)

ido mode

ido-mode is like magic pixie dust!

(when (> emacs-major-version 21)
  (ido-mode t)
  (setq ido-enable-prefix nil
        ido-enable-flex-matching t
        ido-create-new-buffer 'always
        ido-use-filename-at-point t
        ido-max-prospects 10))

Other, spell checking, tabs, imenu and a coding hook

(set-default 'indent-tabs-mode nil)
(set-default 'indicate-empty-lines t)
(set-default 'imenu-auto-rescan t)

(add-hook 'text-mode-hook 'turn-on-auto-fill)
(eval-after-load "ispell"
  '(when (executable-find ispell-program-name)
     (add-hook 'text-mode-hook 'turn-on-flyspell)))

(defvar starter-kit-coding-hook nil
  "Hook that gets run on activation of any programming mode.")

(defalias 'yes-or-no-p 'y-or-n-p)
;; Seed the random-number generator
(random t)

functions for prettier source code

(defun starter-kit-pretty-lambdas ()
  (font-lock-add-keywords
   nil `(("(\\(lambda\\>\\)"
          (0 (progn (compose-region (match-beginning 1) (match-end 1)
                                    ,(make-char 'greek-iso8859-7 107))
                    nil))))))

possible issues/resolutions with flyspell

Most of the solution came from EmacsWiki-FlySpell. Here is one possible fix.

Emacs set path to aspell

it’s possible aspell isn’t in your path

(setq exec-path (append exec-path '("/opt/local/bin")))

Emacs specify spelling program

  • This didn’t work at first, possibly because cocoAspell was building its dictionary. Now it seems to work fine.
(setq ispell-program-name "aspell"
      ispell-dictionary "english"
      ispell-dictionary-alist
      (let ((default '("[A-Za-z]" "[^A-Za-z]" "[']" nil
                       ("-B" "-d" "english" "--dict-dir"
                        "/Library/Application Support/cocoAspell/aspell6-en-6.0-0")
                       nil iso-8859-1)))
        `((nil ,@default)
          ("english" ,@default))))

Hippie expand: at times perhaps too hip

(when (boundp 'hippie-expand-try-functions-list)
  (delete 'try-expand-line hippie-expand-try-functions-list)
  (delete 'try-expand-list hippie-expand-try-functions-list))

Don’t clutter up directories with files~

Rather than saving backup files scattered all over the file system, let them live in the backups/ directory inside of the starter kit.

(setq backup-directory-alist `(("." . ,(expand-file-name
                                        (concat starter-kit-dir "backups")))))

Default to unified diffs

(setq diff-switches "-u")

Cosmetics

(eval-after-load 'diff-mode
  '(progn
     (set-face-foreground 'diff-added "green4")
     (set-face-foreground 'diff-removed "red3")))

(eval-after-load 'magit
  '(progn
     (set-face-foreground 'magit-diff-add "green3")
     (set-face-foreground 'magit-diff-del "red3")))