Netlumination Portfolio
Netlumination Blog

Posts Tagged ‘tips’


Bite Sized Emacs

Wednesday, April 14th, 2010

Emacs is a big complicated beast. You can spend lots of time looking through the documentation, but sometimes it’s nice to enjoy a quick bite of Emacs goodness.

Table of Contents:
1: Custom Keystrokes
2: Indenting only as far as you feel comfortable
3: Indentation on steroids
4: Colorful shells
5: Colorful men
6: No more beeping, only flashing
7: Turn off annoying menu bar
8: Customizing font appearance
9: Line wrapping on horizontally split windows
10: Normal looking line wraps
11: Auto backup a little smarter
12: Autocomplete
13: Jumping the line
14: Moving from one window to the other easilly
15: Delete the entire word
16: Enabling the Num Pad
17: Making and storing macros
18: Word Count

Morsel 1 – Custom keystrokes

Make your own custom keystrokes.

Morsel 2 – Indenting only as far as you feel comfortable

Change the indentation rules in cc-mode to as many spaces as you want (I use 4, which looks like normal tabs on other editors, some people use 8, or 2, or whatever).
Edit your .emacs.d/init.el (depending it could be ~/.emacs, ~/.emacs.el, or ~/.emacs.d/init.el) like this (substitute the number you want where I write 4):

  1. ;; define indents as 4 spaces in cc-mode
  2. (setq c-basic-offset 4
  3.       tab-width 4
  4.       indent-tabs-mode t)

Read the rest of this entry »



Three Steps to Making a Custom Keystroke Shortcut in Emacs

Monday, April 12th, 2010

This one’s short (ish?) and sweet. It describes how to make your own global key bindings for functions of your choice in Emacs.

  1. Type “C-h b” in Emacs. This will bring up a list of all the current keybindings.
  2. Type “C-s [KEYBINDING YOU WANT WRITTEN OUT]” to double check that the shortcut isn’t taken using search. For example to check that “C-c t” isn’t taken type “C-s C-c t”.
  3. Modify your .emacs.d/init.el file like this
    1. ;; [USEFUL COMMENTS]
    2. (global-set-key (kbd "[KEYSTROKES WRITTEN OUT]") '[FUNCTION NAME])

For example to set C-c g to trigger goto-line:

  1. ;; Define C-c g as a shortcut for goto-line.
  2. (global-set-key (kbd "C-c g") 'goto-line)

That’s all there is to it. A little bit more about setting key binding in the GNU Emacs Manual.

If you want to use a key that you don’t know the code of simply press, “C-c h [KEY OF INTEREST]“. For example “C-c h [F5]” shows: ” is undefined”, so I would use (kbd “<f5>”)

Read the rest of this entry »



blog