Skip to content

Latest commit

 

History

History
210 lines (178 loc) · 6.69 KB

starter-kit-misc.org

File metadata and controls

210 lines (178 loc) · 6.69 KB

Starter Kit Misc

This is part of the Emacs Starter Kit.

Starter Kit Misc

Things that don’t fit anywhere else.

Color Themes

The Color Themes package provides support for changing, saving, sharing Emacs color themes. To view and apply color themes available on your system run M-x color-theme-select. See the color theme website and EmacsWiki pages for more information.

This following loads color-theme so that it is available by default.

(add-to-list 'load-path
             (expand-file-name "color-theme"
                               (expand-file-name "src" dotfiles-dir)))
(require 'color-theme)
(eval-after-load "color-theme"
  '(progn
     (color-theme-initialize)))

Once you’ve selected a preferred color theme it can be installed by adding its function to your initialization. For example

(color-theme-railscasts)

will load the railscasts color theme when Emacs starts.

Window system stuff

(when window-system
  (setq frame-title-format '(buffer-file-name "%f" ("%b")))
  (tooltip-mode -1)
  (tool-bar-mode -1)
  (blink-cursor-mode -1)
  (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 dotfiles-dir "oddmuse")
      xterm-mouse-mode t
      save-place-file (concat dotfiles-dir "places"))

Nxhtml – utilities for we development

Nxhtml is a large package of utilities for web development and for embedding multiple major modes in a single buffer.

Nxhtml is not installed in this version of the starter-kit by default, for information on installing nxhtml see EmacsWiki-Nxhtml.

Set browser

Set this to whatever browser you use e.g…

;; (setq browse-url-browser-function 'browse-url-firefox)
;; (setq browse-url-browser-function 'browse-default-macosx-browser)
;; (setq browse-url-browser-function 'browse-default-windows-browser)
;; (setq browse-url-browser-function 'browse-default-kde)
;; (setq browse-url-browser-function 'browse-default-epiphany)
;; (setq browse-url-browser-function 'browse-default-w3m)
;; (setq browse-url-browser-function 'browse-url-generic
;;       browse-url-generic-program "~/src/conkeror/conkeror")

Transparently open compressed files

(auto-compression-mode t)

Enable syntax highlighting for older Emacsen that have it off

(global-font-lock-mode t)

No Menu Bar

You really don’t need this; trust me.

(menu-bar-mode -1)

Save a list of recent files visited.

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

(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)
(add-hook 'text-mode-hook 'turn-on-flyspell)

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

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

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

(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~

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

Associate modes with file extensions

(add-to-list 'auto-mode-alist '("COMMIT_EDITMSG$" . diff-mode))
(add-to-list 'auto-mode-alist '("\\.css$" . css-mode))
(require 'yaml-mode)
(add-to-list 'auto-mode-alist '("\\.ya?ml$" . yaml-mode))
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("\\.js\\(on\\)?$" . js2-mode))
;; (add-to-list 'auto-mode-alist '("\\.xml$" . nxml-mode))

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")))