Configuration

Server

It is possible to run emacs in client-server mode. One way of doing this comfortably is this:
  1. set EDITOR to emacsclient -c $@
  2. set ALTERNATE_EDITOR to ""
  3. [optionally] create an alias for convenience, e.g. e="emacsclient -c $@". Specifying -n will not have emacsclient wait until the user has finished editing the buffer.

Whitespace

To highlight whitespaces of any sort in Emacs, you can use whitespace-mode. To enable it write the following in your ~/.emacs (global-whitespace-mode 1) To configure which whitespace you want to highlight put a line in your ~/.emacs that sets the variable whitespace-style, e.g.
  • (set-variable 'whitespace-style '(face trailing tabs empty space-before-tab tab-mark)) for Emacs 24, or
  • (set-variable 'whitespace-style (face trailing tabs empty space-before-tab tab-mark)) for Emacs 23.
To see a detailed explanation of all available options start emacs and type C-h v whitespace-style.

Movement in windows

In case you like to use move around in your windows with ALT arrow, put the following lines in your ~/.emacs:
(global-set-key (kbd "M-<up>") 'windmove-up)
(global-set-key (kbd "M-<down>") 'windmove-down)
(global-set-key (kbd "M-<right>") 'windmove-right)
(global-set-key (kbd "M-<left>") 'windmove-left)

Hooks for ruby-mode

Options that are not specific to ruby-mode will probably also work for any other mode that supports hooks. This will make emacs use the correct amount of indentation when using parentheses in ruby-mode.
;; Ruby-mode
(add-hook 'ruby-mode-hook (lambda ()
             (set-variable 'ruby-deep-indent-paren nil)))

-- MatthiasPausch - 13 Aug 2013

Makro for jumping between matching parenthesis by pressing "%"

Insert this in your Emacs configuration file:
(global-set-key "%" 'match-paren)
(defun match-paren (arg)
  "Go to the matching parenthesis if on parenthesis otherwise insert %."
  (interactive "p")
  (cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
        ((looking-at "\\s\)") (forward-char 1) (backward-list 1))
        (t (self-insert-command (or arg 1)))))

Setting and jumping to bookmarks

(global-set-key [f11] #'(lambda() (interactive)(message "Bookmark 'bm' gesetzt")(bookmark-set "bm")))
(global-set-key [f12] #'(lambda() (interactive)(message "Springe zu Bookmark 'bm'")(bookmark-jump "bm")))

-- UweScholz - 14 Aug 2013

Shrink and enlarge windows vertically/horizontally

(global-set-key (kbd "S-C-<left>") 'shrink-window-horizontally)
(global-set-key (kbd "S-C-<right>") 'enlarge-window-horizontally)
(global-set-key (kbd "S-C-<down>") 'shrink-window)
(global-set-key (kbd "S-C-<up>") 'enlarge-window)

-- ThomasStibor - 16 Aug 2013
Topic revision: r3 - 2013-08-16, ThomasStibor