Emacs tips

March 28th, 2007 Chris Posted in Uncategorized |

  • To get more color themes for emacs install the emacs-color-themes, available in most major distros. In ubuntu:
    sudo apt-get install emacs-color-themes
    My current favorite is clarity. One you find one you like, edit your .emacs file (in your home directory) and add the line:
    (color-theme-clarity)
    (replacing “clarity” with your theme of choice, natch)
  • Once you know the keyboard commands, the toolbars just get in the way and take up valuable screen real-estate. Add the following lines to your .emacs file to get rid of them:
    (tool-bar-mode 0)
    (menu-bar-mode 0)
  • The scroll bar is also annoying, as are emacs’ default scrolling methods. We can hide the scrollbar by adding this line to our .emacs file:
    (scroll-bar-mode nil)
    The following lines will also add mousewheel support:


    ;; Mousewheel
    (defun sd-mousewheel-scroll-up (event)
    “Scroll window under mouse up by five lines.”
    (interactive “e”)
    (let ((current-window (selected-window)))
    (unwind-protect
    (progn
    (select-window (posn-window (event-start event)))
    (scroll-up 5))
    (select-window current-window))))
    (defun sd-mousewheel-scroll-down (event)
    “Scroll window under mouse down by five lines.”
    (interactive “e”)
    (let ((current-window (selected-window)))
    (unwind-protect
    (progn
    (select-window (posn-window (event-start event)))
    (scroll-down 5))

    (select-window current-window))))
    (global-set-key (kbd ““) ’sd-mousewheel-scroll-up)
    (global-set-key (kbd ““)
    ’sd-mousewheel-scroll-down

Happy Hacking!

2 Responses to “Emacs tips”

  1. To use the newer, better version, type gvim.

    Sorry, someone had to, right?

  2. Thanks, but I’ll refrain from taking the bait. I get my fill of religious wars fighting creationism. :)