Monday, 3 September 2007

emacs 22

I just made the switch from emacs 21 to 22. So far, it seems much the same to the average user (me!)

I decided to write down a few settings for those finding it hard to get used to - you may or may not like them all, so change these settings as you feel like it.

You can add all of these to your .emacs file to have them automatically used.
  1. highlight or fontify according to the syntax of the text you are editing
    (global-font-lock-mode t)
  2. get rid of the toolbar
    (setq tool-bar-mode)
  3. Show the column number
    (setq column-number-mode t)
  4. highlight matching parenthesis when the cursor is placed on one
    (require 'paren)
    (show-paren-mode 1)
  5. when you paste / insert text over a selection, delete the selection first (otherwise you end up with the selection _and_ the pasted text)
    (delete-selection-mode t)
  6. auto-wrapping options. This binds the key sequenct C-x w to turn on "auto wrapping". It nicely understands comments, and automatically keeps them intact.
    (setq fill-column 80)
    (setq default-fill-column 80)
    (global-set-key "\C-xw" 'auto-fill-mode)
  7. main window geometry
    (setq default-frame-alist
    '((height . 74)
    (width . 120)
  8. Bind goto-line to 'C-x g' (I use this key sequence a lot!)
    (global-set-key "\C-xg" 'goto-line)
  9. this sets the amount of time to wait between each automatic scroll, when you select something and move the mouse out of the window. Unfortunately, it is ignored if you "shake" the mouse...
    (setq mouse-scroll-delay 0.25)
  10. this is too agressive, so turn it off. It's a nice idea, but it manages to scroll through a 4000 line file in just a few scrolls, and I have to move the mouse very slowly to get normal behaviour.
    (setq mouse-wheel-progressive-speed nil)
  11. Some general editing settings - set default indent level to 3, and no tabs! Useful if you like to stick to a particular style. Tabs are evil, because everybody uses a different tab width, making a nicely formatted text file on your system look unaligned on another system.
    (setq standard-indent 3)
    (setq c-indent-level 3)
    (setq c-basic-offset 3)
    (setq perl-indent-level 3)
    (setq tcl-indent-level 3)
    (setq pascal-case-indent 3)
    (setq comment-column 40)
    (setq sh-indentation 3)
    (setq tcl-indent-level 3)
    (setq c-indent-comments-syntactically-p t)
    (setq c-default-style "ellemtel")
    (setq-default indent-tabs-mode nil)
    (setq-default tab-width 3)
  12. show column numbers
    '(column-number-mode t)
  13. Use the control-c style cut, copy and paste commands (cua mode)
    '(cua-mode t nil (cua-base))

    Note that the superior rectangle support of cua mode has changed from shift-enter to control-enter (ie. C-enter)

No comments:

Copyright 2009 Another Blog. Powered by Blogger Blogger Templates create by Deluxe Templates. WP by Masterplan