dot emacs conf00.d

Earlier I gave a brief overview of how my config file is loaded. The first directory loaded is ~/.emacs.lisp/conf00.d/ Where we find the following files:

  • bbdb.el
  • dired.el
  • misc.el
  • paren.el
  • ui.el
  • uniquify.el

bbdb

I do not have anything particularly interesting or fancy here. It loads bbdb and adds it to a hook.

(add-to-list 'load-path "/usr/share/emacs/site-lisp/bbdb")
(add-to-list 'load-path "/usr/share/emacs/site-lisp/bbdb/bits")
(load "bbdb-autoloads")
(bbdb-initialize)
(add-hook 'gnus-startup-hook 'bbdb-insinuate-gnus)

The only thing of note is the gnus startup hook. This lets me tab complete email addresses in gnus, as long as they are in bbdb. Unfortunately, that is all there is here.

I would like any addresses I send emails to be entered automatically in bbdb with an ‘auto’ tag. However, I have been too lazy to look that up.

I would like to ‘reverse insinuate’ my jabber rosters. Grab jids and info from the roster+vcard and place it in bbdb. That requires more ‘magic’ than I know how todo now.

dired

I find myself using C-x d more than I ever thought I would. Combined with C-s it is a great way to quickly search for what you need.

(eval-after-load "gnus"
  '(progn
     (require 'gnus-dired)
     (add-hook 'dired-mode-hook 'turn-on-gnus-dired-mode)
     (define-key dired-mode-map "a" 'gnus-dired-attach)

     (add-hook 'dired-mode-hook
               (lambda ()
                 (define-key dired-mode-map "\C-xm" 'jgk/dired-w3m-find-file)))))

(defun jgk/dired-w3m-find-file ()
  (interactive)
  (require 'w3m)
  (let ((file (dired-get-filename)))
    (if (y-or-n-p (format "Open 'w3m' %s " (file-name-nondirectory file)))
        (w3m-find-file file))))

(defun jgk/w3m-browse-current-buffer ()
  (interactive)
  (let ((filename (concat (make-temp-file "w3m-") ".html")))
    (unwind-protect
        (progn
          (write-region (point-min) (point-max) filename)
          (w3m-find-file filename))
      (delete-file filename))))

This evals a few functions after gnus is loaded. The only feature in here which I still use occasionally is attaching from a dired buffer. Everything else is not exactly useful to be honest. (need to add to my todo)

misc

This file is a collection of random stuff that does not configure a package or is a simple setting tweaks. Since the code is unrelated I will take it line by line.

(global-font-lock-mode t)

Turns on font lock so things are pretty.

(fset 'yes-or-no-p 'y-or-n-p)

This is very handy. It changes the yes/no to y/n. For every prompt that requires a yes or no input it becomes a single key stroke instead of typing out a whole word.

(require 'mwheel)

Simply turn on scrolling with the mouse wheel.

(setq next-line-add-newline nil
      require-final-newline t
      use-file-dialog nil
      use-dialog-box nil
      transient-mark-mode t)
  • next-line-add-newline: stop adding newlines when you move the cursor, only do it on enter
  • require-final-newline: always add a newline at the end of file, I find a lot of programs out there need this
  • use-file-dialog & use-dialog-box: disable dialog boxes!
  • transient-mark-mode: highlight active regions
(setq compilation-scroll-output t)

Automatically scroll output from compilation commands. I got this from http://egopoly.com/2007/10/31/how-to-scroll-compiler-output-in-emacs/

(push '("." . "/home/justin/.emacs.backup") backup-directory-alist)

I got really sick of have ~ files all over the place and adding them to the ignore filters for various vcs (git,hg,etc..) This puts them all into one place. The files that are created are unique since they have the full path in them, but with ! instead of /

paren

Enables paren-mode which makes the parens fade into the background and gives you great visual feedback as to where you are in the expressions.

(show-paren-mode t)
(setq show-paren-style 'expression)

ui

I like a clean UI. I never use the toolbars or menus and the scroll bar is simply taking up space. The following turns them all off.

(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

uniquify

I often find myself working in multiple projects within the same emacs session. In fact I really only have a single emacs session for everything. uniquify makes the buffer names unique based on location. So when you have two files open of the same name, uniquify will walk up the directory tree until it finds the unique part of the path, it will then change the buffer name to be unique. This is simply awesome.

;; from http://trey-jackson.blogspot.com/2008/01/emacs-tip-11-uniquify.html
(require 'uniquify)
(setq uniquify-buffer-name-style 'reverse
      uniquify-separator "/"
      uniquify-after-kill-buffer-p t ;; rename after killing uniquified
      uniquify-ignore-buffers-re "^\\*") ; don't muck with special buffers

The above settings should be obvious. I have / as the separator, all uniqified buffers are redone when one is killed and the scratch-like buffers are ignored.

That is my first ‘runlevel’ for emacs. Not much here so I took it all in one go. Any tips or improvments are most welcome.