09/03/2008

ShifD - Emacs (and vi) Key Commands

emacs keys on shifd.com at tedroden.com

I was able to distract the guys working on shifd long enough to slide a couple of commits past them.

So for today, I'll just talk about one of the features I added when the rest of the staff wasn't looking. You can now edit and save shifd content using familiar key commands. 1

First, because it was easy, I added vi shortcuts. So i will put you in insert mode. It opens up the text box, focuses it and waits patiently. When you've added your text, you can hit [escape] :wq and it'll save and close it.

Adding vi shortcuts made me feel dirty, so I quickly added emacs commands too. The emacs version is pretty much only useful on a Mac, because control-s means something very different on windows/linux. To start a new shifd note, you can press [control]-x [control]-f2. To save the note, press [control]-x [control]-s. Not bad, eh?

There are a couple other shortcuts as well. For example, t will show/hide the input box, but those aren't quite on the same level of nerdiness, so I won't mention them all here. Go try it out for yourself.


1. This stuff, like most of the internet, is disabled in Internet Explorer.

2. I know that this would generally prompt you in emacs, but you get the gist of it.


07/09/2008

Google Region

Somehow, this didn't occur to me until today: it would be really great to select some text and enter a key command to search for that text on google. It may have taken me a long time to realize I wanted something like that, but I've used it today more times than I'd like to admit.

Anyways, here's how to make that happen in emacs, complete with a "control-c g" shortcut.

;; google-region
(defun google-region (&optional flags)
  "Google the selected region"
  (interactive)
  (let ((query (buffer-substring (region-beginning) (region-end))))
    (browse-url (concat "/search?ie=utf-8&oe=utf-8&q=" query))))
;; press control-c g to google the selected region
(global-set-key (kbd "C-c g") 'google-region)


06/28/2008

Shifd from emacs

I made a little extension for emacs so that I could shifd things directly from inside the editor. Here's a video of it in action. If you're interested in the extension, let me know. I can make it available.


from on .


03/06/2008

goto-minibuffer

I almost posted this yesterday, but I got stuck trying to explain when it's useful. Every example that I came up with seemed to have a perfectly acceptable workaround.

However, after another day of emacs usage, I decided that there are indeed times when you need to move the focus to the minibuffer window. Sometimes that is easier said than done. It's especially hard if you have a lot of windows open in one frame and move around a lot, particularly when you do that in the middle of entering a command in the minibuffer.

I couldn't find anything built in that would do that. So I wrote a tiny function to handle it. Without further ado, here is some elisp to move the focus directly to the minibuffer.

(defun teds-goto-minibuffer ()
  "Move cursor to minibuffer window"
  (interactive)
  (select-window (minibuffer-window)))
(global-set-key (kbd "C-c m") 'teds-goto-minibuffer)

If you know of a simpler1 way of doing this, please let me know.


1. Hitting control-o a bunch of times doesn't count as simple. We're talking about when you have a bunch of windows open.


03/03/2008

Soxiam's Testimonial

Sox has long been my personal motivational speaker. His geek cred has recently gone through the roof; he's quoted directly on the aquamacs-devel mailing list.

Grow Your Manhood
Grow Your Manhood

02/25/2008

Aquamacs 1.3

After several long nights and weekends, I'm happy to say the new Aquamacs.org site has launched. This also happens to coincide (more or less) with the release of Aquamacs 1.3, so you should probably upgrade.

Around Christmas, I decided that I should try to time pushing the new site with the next release of the actual software. So I spent some time redesigning the site during my holiday break. After my initial mockups, I spent a lot of time on the development list and .

I didn't save a lot of the iterations, but here's how it looked along the way. (Click for bigger images).

This is how the site looked initially.
My first mockup.
The final version.


02/18/2008

Uptimes

When I restart emacs (aquamacs) for whatever reason, I'm always curious to see how long it's been running. I've included the list of uptimes1 below. My record for this computer seems to be 15 and a half days. I'm sure I can do better on other computers, but that's pretty good for a laptop that I abuse pretty regularly.

Uptimes

1. If you have uptimes.el, and (require uptimes.el) in your .emacs file, meta-x uptimes will show you the uptimes screen.


12/12/2007

Emacs Spreadsheet

I'm constantly finding myself in situations where I need to do something on my computer, but I can't do in Emacs. Like, filling out text boxes on the web. Or posting to my blog. Or just using a shell.

Of course, time after time, I find out that I can use Emacs for these problems. For example, with It's all text, I can edit form fields with Emacs. Muse mode and a couple of scripts allows me to edit and post to my blog. And eshell has changed my life as far as using the command line goes.

The latest problem I faced was that I needed to use a spreadsheet. I'm not a spreadsheet power-user, I just needed something to help me visualize a few simple calculations. I wanted to tweak a number here, a percent there and see all the numbers change. Perfect job for a spreadsheet. But how the heck do you do it in Emacs? Simple, ses-mode. It does everything I need for a basic spreadsheet, and it's in Emacs. Either you know why this is a good thing, or you totally don't. There is very little middle-ground.

With ses-mode, you can deal with ranges of cells, do all kinds of calculations and if you install the right modes, you can even graph it with pretty charts. I haven't tried that, but it sounds awesome.

Anyways, here's a screen shot of an example spreadsheet inside Emacs. You can even see the cell's formula in the mini-buffer, in lisp. So cool!

"I'm a business man, I need a spreadsheet"

12/01/2007

Writing a book

A few months ago, I decided I needed to write a book. I've never written a book before, but I haven't done a lot of things before, so why should never having done it stop me. So I got started. I researched companies, figured out how many books I'd need to sell to make it worth my while, realized that I could do that, and got started. I wrote... about 3 or 4 chapters.

Then I found out someone whose blog that I read was writing a very similar book. Too similar in fact. I mean, if I read someone's blog, doesn't that mean that others read it too? Well, I decided that I have on my plate, and that I'd rather read the book than write it. So I haven't touched it since then. (Despite, having those chapters written, they're solid gold I tell you! GOLD!)

I'm super happy to know a book like it is getting written. If it isn't as good as I can do, then I'll write it myself, otherwise I can't wait to read it. So, I'm officially putting in my notice that I am going to pre-order it.


11/27/2007

Aquamacs File System Coding

At work I'm always downloading strange file formats, or creating files with weird names to test our system. Doing this, I noticed that aquamacs was having trouble with some of them and I couldn't figure out why. Until today! Previously, one of my test files was pretty messed up via dired and eshell, take a look:

Bad!
Bad!

But all it takes is a quick addition to your .emacs file and it's fixed! You just need to specify the "file name system coding," and there is even one included with aquamacs that is designed for the mac file system. Just add the following line to your .emacs file and you're all set:

(set-file-name-coding-system 'utf-8m)

After that, everything is rosy.

Good!
Good!