Learning Emacs, part 2

More things I learned, after scraping together bits and pieces from all over the net:

  • Write a function that deletes the whole line, and bind it to a key (for some reason Emacs doesn't have this out of the box):
    (defun delete-line ()
      "Kill the whole damn line."
      (interactive)
      (beginning-of-line)
      (kill-line 1)) ; delete line including newline 
    
    (global-set-key [(super y)] 'delete-line)
  • Resize the window so the minibuffer no longer hides behind the dock:
    (add-to-list 'default-frame-alist '(height . 39))
  • When you scroll beyond the beginning or the end of the screen, Emacs has the annoying "feature" of re-centering the cursor. This turns it off (most of the time):
    (setq-default scroll-step 2)
  • Extend the Emacs load path so I can stick custom .el files in this directory and have them recognized by (require 'foobar):
    (add-to-list 'load-path "/Users/name/projects/scripts/macosx/emacs")
  • Match parentheses automatically, always, not just when inserting them:
    (show-paren-mode)
  • Turn off the sound:
    (setq visible-bell t)
  • Turn off cursor blinking:
    (blink-cursor-mode nil)
  • When marking, always show the highlighted region:
    (transient-mark-mode t)
  • Show current column:
    (column-number-mode t)
  • Don't use tabs for intending:
    (setq-default indent-tabs-mode nil)

I also added Quack to my .emacs file; let's see how well it does when hacking Scheme.

Emacs more or less does what I want now. There are still a few things missing (like the ability to select things by moving the cursor while pressing Shift), but they're not so important.

All in all, that wasn't so bad. I expected it to take more time to get things up and running. Granted, I've looked at Emacs before (although I never really got around to using it), so I'm not *completely* new to it. The Learning GNU Emacs book was (and still is) a great help too; I found it much more useful than the built-in tutorial.

(Assuming I stay with Emacs, I will need to unlearn some vi-isms. I find myself pressing Esc a lot, or typing things like "i" or "dd". :-)

3 Comments »

  1. creidiki said,

    February 18, 2008 @ 11:40 am

    Or you can just switch on VIper mode :)

  2. creidiki said,

    February 18, 2008 @ 11:47 am

    By the way, if you do:

    M-x customize-group CUA

    Set "Cua Mode" to 'on'

    and

    "Cua Enable Cua Keys" to 'shift region only' you'll have the shift-arrow select :)

  3. Ozzi said,

    February 18, 2008 @ 2:49 pm

    Instead of using shift-highlighting, I like to turn on transient-mark-mode. Then hit c-space to start highlighting, move to wherever you want, and hit c-space again to stop highlighting.

RSS feed for comments on this post · TrackBack URI

Leave a Comment