If you use Emacs yet you don't know much about it, then this post might be interesting to you. It is split into a few parts, so if you don't want to read the background, skip to "How Emacs actually does the things I mentioned in the first part of this post."
Why I'm writing this post
Recently, I've been working on at least one non-Java project. I've been doing some JS. I've been using WebStorm and WebStorm is great, but it doesn't support the following things found in either Emacs or mulgasoft's emacs+ plugin for Eclipse:
- Rectangles
- Kill rings (it supports them, but there's like one more keystroke needed)
This isn't a lot of functionality lost, I admit. Also, I didn't really look into whether or not the above mentioned claims are true. I guess I mainly wanted a reason to use Emacs again. I want people who use Emacs to think I am cool. I want to not be called a poser because I sometimes wear a pair of socks that have the words "Emacs Time" on them. But, I soon found myself whining because I created more problems for myself out of principle or whatever, because Eclipse and WebStorm solve 3000 things that Emacs can't solve. Literally. 3000.
I also ruined a pair of socks with a Sharpie by writing "Emacs Time" on the socks.
Jason, you and Emacs need to break-up. Probably.
Here are the 4 things that I wanted Emacs to do, but Emacs would not do:
- It would not let me cycle through my cursor history
- It would not let me display line numbers on the left margin
- It would not let me access some cool, neat user interface for customizing Emacs
- It would not let me do something similar to Eclipse's "Open Resource" dialog, or whatever WebStorm does when I hit C-xC-f.
Jason, maybe you could do some research before you end it with Emacs because you and Emacs have a lot of common friends. And honestly, most of those friends would probably choose Emacs.
Well, I considered the above bold, orange text seriously, and I fired up my browser in search for the Truth. I queried and I queried and here's what Dogpile delivered.
How Emacs actually does the things I mentioned in the first part of this post.
- Emacs does have cursor history (mostly)
- Emacs can display line numbers
- M-x linum-mode
- User Interface for customizing emacs? you betcha
- M-x customize
- But what about something similar to Eclipse's "Open Resource"? Well, here's what the following list has to say about that:
- Someone wrote a lot of what I wanted already. I'm sure there are other solutions, but this one works for me
- https://code.google.com/p/emacs-open-resource/source/browse/trunk/open-resource.el
- http://perso.wanadoo.fr/david.ponce/downloads/recentf-1.23.zip
- Save the *.el files from 4.2 & 4.3 to ~/.emacs.d & put this bit of code in your .emacs file
-
<span style="color: #808030">;</span> open resource (add-to-list 'load-path "~/.emacs.d/recentf.el") (require 'recentf) (load "~/.emacs.d/open-resource.el") (setq open-resource-repository-directory "/path/to/source/code1 /path/to/source/code/2") (setq open-resource-ignore-patterns (quote ("/target/" "~$" ".old$" ".svn"))) (global-set-key "\C-R" 'open-resource) - And if you want to query with "SoSuLCN" to find "SomeSuperLongClassName.java" (just like you do in Eclipse), add this bad boy to open-resource.el and change the "find" command in "find-file-in-directory" to use it:
-
<span style="color: #808030">(</span>defun prefix<span style="color: #808030">-</span>uppercase<span style="color: #808030">-</span>letters<span style="color: #808030">-</span>with<span style="color: #808030">-</span>asterisk <span style="color: #808030">(</span>filename<span style="color: #808030">)</span> <span style="color: #808030">(</span>let <span style="color: #808030">(</span><span style="color: #808030">(</span>case<span style="color: #808030">-</span>fold<span style="color: #808030">-</span>search nil<span style="color: #808030">)</span><span style="color: #808030">)</span> <span style="color: #808030">(</span>replace<span style="color: #808030">-</span>regexp<span style="color: #808030">-</span>in<span style="color: #808030">-</span>string <span style="color: #800000">"</span><span style="color: #0000e6">^\**</span><span style="color: #800000">"</span> <span style="color: #800000">"</span><span style="color: #800000">"</span> <span style="color: #808030">(</span>replace<span style="color: #808030">-</span>regexp<span style="color: #808030">-</span>in<span style="color: #808030">-</span>string <span style="color: #800000">"</span><span style="color: #0000e6">\*+</span><span style="color: #800000">"</span> <span style="color: #800000">"</span><span style="color: #0000e6">\*</span><span style="color: #800000">"</span> <span style="color: #808030">(</span>replace<span style="color: #808030">-</span>regexp<span style="color: #808030">-</span>in<span style="color: #808030">-</span>string <span style="color: #800000">"</span><span style="color: #0000e6">\\([A-Z]\\)</span><span style="color: #800000">"</span> <span style="color: #800000">"</span><span style="color: #0000e6">*\\1</span><span style="color: #800000">"</span> filename<span style="color: #808030">)</span><span style="color: #808030">)</span><span style="color: #808030">)</span><span style="color: #808030">)</span><span style="color: #808030">)</span> -
OSM
In closing
Emacs and I have never been happier. And the sky's the limit for us. Also, If you know of more info to spice up our lives, we're all ears.
Thanks, Jason & Emacs

