Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Latest commit

 

History

History
204 lines (171 loc) · 5.97 KB

starter-kit-misc.org

File metadata and controls

204 lines (171 loc) · 5.97 KB

Starter Kit Misc

This is part of the Emacs Starter Kit.

Starter Kit Misc

Things that don’t fit anywhere else.

Color Themes

Emacs 24 introduces a streamlined theming system that replaces an older, messier one. The Starter Kit comes with Ethan Schoonover’s Solarized color theme and the Zenburn theme, in versions maintained by Bozhidar Batsov. Load it with M-x load-theme solarized-dark or M-x load-theme solarized-light. You can also try loading the zenburn and anti-zenburn themes.

(add-to-list 'custom-theme-load-path "~/.emacs.d/elpa")
(setq custom-safe-themes t)
(load-theme 'zenburn t)

Window system

(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
      font-lock-verbose nil
      inhibit-startup-message t
      transient-mark-mode 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
      ediff-split-window-function 'split-window-horizontally
      oddmuse-directory (concat dotfiles-dir "oddmuse")
      xterm-mouse-mode t
      save-place-file (concat dotfiles-dir "places"))

Turn on Minimal mode

Thin window dividers and no scroll bars. Toggle with `C-c C-s`.

(minimal-mode)

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

(global-font-lock-mode t)

Show Menu Bar in Window but not in tty

If launching Emacs as in windowing system, show the menu. If launching in a tty/terminal window, don’t display the menu.

(if window-system
    (menu-bar-mode t)
    (menu-bar-mode -1)
    )

Save a list of recent files visited.

Save place last visited in buffer

(require 'saveplace)
(setq-default save-place t)

ido mode and flx-ido

ido-mode is like magic pixie dust!

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

Other, 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)
(add-hook 'text-mode-hook 'turn-on-flyspell)
(add-hook 'LaTeX-mode-hook 'turn-on-flyspell)
(add-hook 'markdown-mode-hook 'turn-on-flyspell)
(add-hook 'org-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))))))

Powerline provides a nicer modeline

A nicer modeline.

(require 'powerline)
(powerline-default-theme)

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

Default to unified diffs

(setq diff-switches "-u")
(message "Starter Kit Misc loaded.")

Rainbow delimiters in R and elsewere

(add-hook 'org-mode-hook #'rainbow-delimiters-mode)
(add-hook 'ess-mode-hook #'rainbow-delimiters-mode)