Emacs bindings in Cocoa?

January 30, 2006
Key Meaning
ctrl-q Beeps. If pressed twice deletes selection.
ctrl-w Cuts text
ctrl-e Moves to end of line
ctrl-r Beeps??
ctrl-t Swaps near characters
ctrl-y Pastes text
ctrl-u Beeps??
ctrl-i Beeps??
ctrl-o Insert new line after current
ctrl-p Moves cursor to previous line
ctrl-a Moves to beginning of line
ctrl-s Beeps??
ctrl-d Deletes character on the right
ctrl-f Moves forward one character
ctrl-g Beeps??
ctrl-h Deletes character on the left
ctrl-j Beeps??
ctrl-k Cuts line from cursor to the end
ctrl-l Does nothing?
ctrl-z Beeps??
ctrl-x Beeps??
ctrl-c Beeps??
ctrl-v Moves half screen down
ctrl-b Moves backward one character
ctrl-n Moves cursor to next line
ctrl-m Beeps??

TextMate: the definitive editor?

January 29, 2006

Unfortunately it appears I’ve no time to talk about programming. It takes lot of time to think about something useful, to write examples and such. However, I promise I will doing it soon.

And yet I’m again talking about a text editor. In fact since most of my computer time is spent on an editor, this makes sense. It’s the most crucial application to me (and the one I spend most time to learn using its full power).

I already said I discovered TextMate. The more I study the more I’m amazed. In fact it did substitute Aquamacs even for latex editing. The new bundle is perfectly integrated with Texniscope and “Command-B” opens in TextMate the pdf document compiled from the document I’m editing. That makes environment such that TexShop almost useless to me.

Emacs is more powerful. But most of the times I’m not using that power. It’s my fault, of course. Still TextMate is always open on my Mac, and I started using it even for latex. That’s the main reason. If I have to do a very long latex editing session I still do prefer Aquamacs.

The Python mode is now wonderful. It lets me check my sources with pychecker or with pyflakes. It allows me to run them from inside TextMate, lets me run unit-tests with one command. And even more. Right at the moment it’s the best python programming environment I’ve ever met (a part from WingIDE).

The only thing I’m missing right now is a “prolog mode”. And probably I have to work on TextMate/Xcode integration (it has been done, but I haven’t done it yet). Oh, and I’m looking forward to see TextMate 2, that should have massive improvements on the “project management” side. And probably I’d like some more refined auto-completion with static languages. This could have somehow been added (TextMate can be extended and customized a lot, still in a really simple way), but I’ve not yet discovered if and how.

But the reason I wrote this is another. For years the “Text editors” with capital T have been Emacs and vim. BBEdit was a beautiful Mac editor, but first it is very web-oriented, second it is somehow less powerful in the way it deals with text.

On the windows platform I have not found really impressive text editors. There are a bunch that are powerful and easy to use. But in fact I installed vim (gvim) and I was happy with that. Most such editors were more concerned in “integrating” command line utilities (compilers, latex, interpreters) with the editor not to have the “programmer” opening the “DOS console” than pure text editing.

Newer editor for Linux (Kate for example) also paled in comparison with Emacs or vim. Now I’m wondering:

  1. Was I superficial? It is possible that no one did something that could be compared with vim or Emacs before TextMate? This seems really unlikely.
  2. Why haven’t I spotted such editors? They exist? Let me know. I’m talking about “pure text editors”, not about “IDEs”.

GeekTool CPU Script

January 28, 2006

If you don’t know what GeekTool is go here.
It is very likely you’ll find it useful. If you use Tiger, use this version that fixes a lot of issues.

GeekTool allows you to put a lot of interesting informations on the desktop. You can “print” logfiles on the desktop or you can put there pictures or, and that is what is interesting, put the output of a chosen command.
For example I put a random fortune on the desktop. It easier to do download GeekTool and do it than reading an explanation.

An interesting feature that is in the documentation (so it’s something you probably wouldn’t read) is that scripts/commands placed in “~/Library/Application Support/GeekTool Scripts” need not to be specified with full path. So we will put the script “cpuload.py” in that directory and we will refer to it with “cpuload.py”

And now the script:

    # -*- coding: utf-8 -*-

    import os

    class command(object):
        def __init__(self, c):
            self._command = c
            fi, foe = os.popen4(self._command)
            self.out = list([line.strip() for line in foe])

    def cpu_load(string_list):
        # a bit functional... not pythonic at all
        return sum(map(lambda l: float(l.split()[2]), 
            string_list), 0)

    def main():
        ulist = command("ps -ux").out[1:]
        slist = command("ps -aux").out[1:]
        print "System CPU: ", cpu_load(slist), "%"
        print "User CPU:   ", cpu_load(ulist), "%"

    if __name__ == "__main__":

Class “command” is a stripped down version of a class I’m writing for another project. I also think that any script you write should be executable.

SourceForge.net: Aquamacs Emacs 0.9.8 is out

January 20, 2006

SourceForge.net: Aquamacs Emacs 0.9.8 is out:
Posted By: davidswelt
Date: 2005-12-21 09:32
Summary: Aquamacs Emacs 0.9.8 is out
Aquamacs, the friendly, mac-like distribution of GNU Emacs for the Mac is available in version 0.9.8. It brings a number of bugfixes and goodies for people with non-English keyboard layouts. It’s a highly recommended update for those with version 0.9.6 or older.

(Via Aquamacs.)

Inner float…. (CSS)

January 18, 2006

I feel so stupid. I never thought there was a simple solution like this. I have to find out “why” it works. It is probably written somewhere here. It’s late night I’m not going to do it now.

I read the answer in this page (and it is here I got the previous link). Thanks to Gomi to point me the solution. I would have linked the original post, but it unfortunately uses Archive: no and x-no-archive: yes, so no google groups.

Tunatic (Italian)

January 14, 2006

Tunatic è un piccolo software non intrusivo che identifica le canzoni. Prende il suo output dal microfono e attraverso un database online le confronta con quelle che ha in memoria. I risultati sono sorprendentemente buoni.

Ho sottoposto canzoni di diverso genere musicale, e spesso le canzoni (tipicamente rock) sono state riconosciute anche dal solo riff. In compenso si trova più in difficoltà con parti “lead”.

È invece stato assolutamente incapace di riconoscere canzoni (di altre) suontate dal sottoscritto. Anche con i live si trova abbastanza in difficoltà.

Potete anche arricchire il db, se trovate una canzone di cui sapete l’origine e che non è presente


  • Stevie Wonder
    • Higher ground (ok)
    • Don’t you worry about a thing (ok)
  • Nightwish
    • Come cover me (ok)
  • Saxon
    • The crusader (no)
    • Just let me rock (no)
  • Rhapsody
    • Forest of unicorns (ok)
    • Dargor, Shadowlord Of The Black
  • Helloween
    • The twilight of the Gods (ok)
    • March of time (no)
    • Future world (ok)
  • Dire Straits
    • Money for nothing [senza arrivare nemmeno al riff] (ok)
    • Two young lovers (no)
    • Les Boys (ok)
    • Solid rock (live) (no)
  • Royksopp
    • Alpha male (ok)
    • A beautiful day without you (ok)
    • So easy (ok)
  • Tim Buckley
    • Gypsy woman (no)
    • Dream letter (yes)
  • Cat Stevens
    • Father and son (yes)
    • Miles from nowhere (yes)
  • Chieftains
    • O’Sullivans March (no)
  • Bandabardò
    • Ewa (no)
    • Sette sono i re (no)
  • Orbital
    • Halcyon (yes)

TextMate 1.5 is out

January 10, 2006

New TextMate version is out. It is a big improvement over the last stable (I happen not to know which version number it had, since I’ve always been on the edge with betas — and with no problems, update system is wonderful )

These are some of its new features (following list is copy & pasted from TextMate website)

You are supposed to go and it!

More informations here