M-x all-things-emacs

G-client: Google Services in Emacs

March 3rd, 2007 by Ryan McGeary · 113 Comments

If you are the type who likes to do everything within emacs, check out g-client. For a full writeup, read An Emacs Client For Google Services to learn how to integrate Google’s Blogger, Reader, and Calender with emacs.

→ 113 CommentsTags:misc · news

Quick Tip: Highlighting Java .properties Files

March 1st, 2007 by Rob Christie · 127 Comments

Java .properties files are normally formatted using conf-javaprop-mode. Recently, I was frustrated because a single quote in a property was highlighted such that multiple lines were colored like a string until there was another quote on another line. I decided I was going to fix it… It turns out that I didn’t have to look far. C-h f conf-javaprop-mode led me to read about conf-mode which led to finding the command conf-quote-normal. This command sets the syntax of ‘ and “ to punctuation. This is the joy of using emacs. It’s the little things. My new .emacs snippet follows:

(add-hook 'conf-javaprop-mode-hook 
          '(lambda () (conf-quote-normal nil)))


Before conf-quote-normal


After conf-quote-normal

→ 127 CommentsTags:java · quick · tips

Quick Tip: Add occur to isearch

February 27th, 2007 by Ryan McGeary · 87 Comments

Zenspider gives us an excellent tip for extending incremental search. Add this to your emacs initialization:

(define-key isearch-mode-map (kbd "C-o")
  (lambda ()
    (let ((case-fold-search isearch-case-fold-search))
      (occur (if isearch-regexp isearch-string
               (regexp-quote isearch-string))))))

This adds an extra keybinding to interactive search (C-s) that runs occur on the current search string/regexp, immediately showing all hits in the entire buffer. I use it all the time now.

Seeing as how I run incremental searches subconsciously before even thinking about running occur, I can see myself using this shortcut constantly. I tried it on the emacs tutorial (C-h t):

C-s foo C-o
Incremental Search with Occur

→ 87 CommentsTags:elisp · isearch · quick · tips

Quick Tip: Reuse Dired Buffers

February 25th, 2007 by Ryan McGeary · 159 Comments

By default, dired creates new buffers when visiting new directories. Sometimes this is desired, especially when you need to visualize the contents of two separate directories; however, when you’re just navigating around, all the extra buffers tend to clutter your buffer list.

Typical navigation is done with dired-find-file (bound to f, RET, or e) or dired-find-file-other-window (bound to o). When performed on a directory, this visits the directory in a new dired buffer. In Emacs 22, instead try running dired-find-alternate-file (bound to a). This replaces the current buffer keeping the clutter of dired buffers to a minimum.

When you run dired-find-alternate-file for the first time, you’ll receive a warning that the function is disabled. You can either follow the built-in instructions and customizations to enable the function, or you can add the following to your .emacs.

(put 'dired-find-alternate-file 'disabled nil)


GNU Emacs Manual, Visiting Files in Dired

EmacsWiki, DiredReuseDirectoryBufferincludes other ways to enable similar behavior in Emacs 21.

→ 159 CommentsTags:dired · quick · tips

Maximize on Startup, Part 2

February 22nd, 2007 by Ryan McGeary · 144 Comments

In part 1 of the series, we discussed two ways to resize the emacs frame on startup. Here, we will use the display-pixel-width and display-pixel-height functions to automatically determine the proper size of the emacs frame.

Option 3 (the package)

As I tried to come up with a generic way to maximize the emacs frame on startup, the more the elisp moved out of my .emacs and into its own package. Soon enough, maxframe.el was born. First, I’ll describe how to install the package. Then I’ll try to describe how it works. Finally, I’ll discuss some of the caveats and gotchas.


  1. Download the full package. You can obtain the latest version (on github) or the version referenced in this article.
  2. Put maxframe.el in your load-path.
  1. Add the following to your .emacs:
(require 'maxframe)
(add-hook 'window-setup-hook 'maximize-frame t)

Maximizing the frame in the window-setup-hook helps prevent font size and window customizations from affecting the size of the newly sized frame. There are a couple optional customization variables, but we’ll explain those soon. Upon startup, emacs will resize itself to fit your display’s full resolution. VoilĂ . [Read more →]

→ 144 CommentsTags:elisp · osx · tips · windows · x

Newbie Tip: transient-mark-mode

February 20th, 2007 by Ryan McGeary · 152 Comments

Setting a mark (C-SPC) is probably the most frequent command I use besides basic navigation. The mark not only acts as a saved jump-to point, but it also sets the region. A region is what other editors might call a selection. By default, emacs does not highlight the active region, so it requires a bit of imagination to visualize it. To change that behavior, add this to your .emacs.

(setq transient-mark-mode t)

This turns the Transient Mark minor mode on. In Transient Mark mode, when the mark is active, the region is highlighted.


Note: Some commands change their behavior when transient mark mode is on and the mark is active. Personally, I like the changed behavior, but invoke C-h d transient for more information.

→ 152 CommentsTags:newbie · quick · tips

Emacs Key Bindings in MS Word

February 18th, 2007 by Ryan McGeary · 189 Comments

Macosxhints.com points us to a way to enable emacs key bindings in Microsoft Word. Just assign new shortcut keys to each of these Word commands (instructions below):

StartOfLine : C-a
EndOfLine   : C-e
LineUp      : C-p
LineDown    : C-n
CharLeft    : C-b
CharRight   : C-f

Please feel free to suggest other emacs equivalent Word commands and shortcuts in the comments.

Word 2004 for Mac

  1. Tools > Customize > Customize Keyboard …
  2. Select “All Commands” in the Categories box.
  1. Add new shortcut keys for each of the commands above.

Word 2002 (XP) for Windows

  1. Tools > Customize …
  2. Click the “Keyboard …” button.
  3. Select “All Commands” in the Categories box.
  1. Add new shortcut keys for each of the commands above.

Note: On Windows, C-p, C-n, and C-f will probably conflict with FilePrint, FileNew, and EditFind, so you may want to remove those existing shortcut keys first.

→ 189 CommentsTags:misc · osx · windows

Emacs, JDEE, Ant, and the Eclipse Java Compiler

February 13th, 2007 by Rob Christie · 145 Comments

This post describes how to integrate jdee, ant, and the eclipse batch compiler to get the same warning and error messages as your Eclipse-loving friends. I am assuming that you already know your way around the jdee environment (i.e., you have it setup and configured such that you can run an ant build from within emacs), and the ant build tool. [Read more →]

→ 145 CommentsTags:java · tips

Quick Tip: Defining Mode Specific Key Bindings

February 10th, 2007 by Rob Christie · 127 Comments

Many times I use global key mappings for commands that I use every day. For example, I build java projects daily using ant, so I have the following in my .emacs:

(global-set-key [f5] 'jde-build)

Less frequently, I use the C-c C-v C-. which is the default key binding for the command jde-complete. Both commands are in the Java Development Environment For Emacs. The jde-complete command displays completions for the symbol at point. Sometimes it is nice to have some of your key bindings be mode specific. [Read more →]

→ 127 CommentsTags:elisp · java · quick · ruby · tips

Quick Tip: dired-recursive-deletes

February 8th, 2007 by Ryan McGeary · 146 Comments

By default, dired only deletes empty directories. You know the drill. Put your point on the directory, D, y (yes), “file-error Removing directory directory not empty,” (slam fist on table). Doh!

Fortunately, dired supports deleting directories recursively. Add this to your .emacs:

(setq dired-recursive-deletes 'top)

The dired-recursive-deletes variable decides whether recursive deletes are allowed. This particular setting will prompt with confirmation for each directory at the top level but delete all subdirectories without asking. Other possible values include:

  • nil means no recursive deletes. (default)
  • 'top means ask for each directory at the top level but delete subdirectories without asking.
  • 'always means delete recursively without asking. Warning: The Surgeon General has determined that this may be hazardous to your health.
  • Anything else means ask for each directory (including subdirectories).

As always, C-h v dired-recursive-deletes for the full low-down.

→ 146 CommentsTags:dired · quick · tips