chris blogs: Emacs

04feb2008 · Introducing gitsum

The major showstopper before I was seriously considering going to Git was the lack of an darcsum-like interface for Git.

Yesterday night I finally decided to write it.

git-status (included as git.el in the Git distribution) is usually good enough to use, but I often like to do partial commits, that is, commit only parts of a file. Git can do that now for some time, using git add --interactive or frontends like git-hunk-commit or git-wt-add. Still, there was no way to do it conveniently in Emacs.

Let me introduce gitsum:

Gitsum screenshot

You can freely delete hunks you don’t want to commit, split big changes, or even edit the patch directly if you feel adventurous. It also integrates into git-status so you can easily switch between these frontends.

Gitsum is hosted at http://github.com/chneukirchen/gitsum (which I highly recommend) and is mirrored at http://git.vuxu.org/, patches and additions are welcome! It’s still very fresh and has some rough corners, but I already notice my increase in productivity.

NP: Twelve Tone Failure—As I Hit the Floor

11mar2007 · The day editors became handaxes

For some reason, almost everyone is hot about Ruby IDEs nowadays.

However, I still prefer using a “classic” editor, and I edit just about everything with it.

A Handaxe

The editor is a lot like a handaxe. It’s an old tool, but it’s proven, and can be used in a lots of ways: hitting something, cutting meat, opening fruits. And, I can (and do!) use it to create other tools. It’s a sharp and powerful tool. Also, my handaxe is customized just how I like it. For example, if you are left-handed, your handaxe surely will look different than the handaxes of the others.

On the other hand, a modern IDE is a lot like a wrench. If you needed a wrench, you’d be happy to have one. Trying to turn a bolt with a handaxe will be difficult. But can your wrench drive nails? Maybe if you are good at it. Cut meat? Hardly.

You may now argue that this is a really bad comparison, and maybe you are right. But compare how the intelligent Stone Age man did all his day work with a hand axe, and how the experienced developer does everything with his editor: it’s not that far off. Do you know of a mechanic that only has a wrench?

I like my editor. It fits my needs perfectly, and I can customize everything how I need it.

NP: Tom Waits—Lucinda

10jul2006 · Pastie Integration for Emacs: pastie.el

Pastie is the new cool code pasting site around the net. Totally nifty; heck, you can even post to it with Vim.

Having nothing better to do (heh… you bet), I just couldn’t resist but get the good old elisp out and write a few Emacs functions to make it accessible from Emacs, too.

Well, there you are: pastie.el.

pastie.el defines three new functions you may want to bind to appropriate keys:

  • pastie-region pastes the current region, shows the URL of the new paste and puts it in the kill buffer for immediate pasting.

  • pastie-buffer pastes the whole buffer.

  • pastie-get asks for a Pastie paste id and fetches it into an appropriate buffer.

Of course, all methods handle the various Pastie ways of syntax highlighting, provided you use the corresponding Emacs modes.

Happy pasting!

NP: Mark Knopfler—Everybody Pays

20mar2005 · Various hacking

I worked over the weekend on various things. First, I fixed darcsum.el to strip/convert ANSI character sequeces, since several people complained. Thanks to Jose Antonio Ortega Ruiz and Matthieu Lemerre for reporting this. Please darcs pull to grab the latest changes.

Then, I spent some more time on Kashmir/Elusion and added a “Do What I Mean” mode. For example, instead of

^entries.each{
  ^recent?.true?{NEW}
  ^body
  ^time.with{^day/^month/^year}
}

You can now write (assuming you use Elusion):

^entries{
  ^recent?{NEW}
  ^body
  ^time{^day/^month/^year}
}

Elusion will then figure out on it’s own what you want to do (If there is an #each, iterate. If it’s true, just call the block. Else yield self to the block.) Also, you can now pass a block to Kashmir#expand to automatically create an Elusion.

Now, there is a restartable exception library to be coded…

NP: Bob Dylan—Knockin’ On Heaven’s Door

13mar2005 · darcsum.el polished

Since John Wiegley stopped using darcs, there have been no changes to darcsum.el, a fairly good Emacs-mode for interfacing with darcs.

With the update to darcs 1.0.2 darcsum.el even broke, as the look of the prompts darcs.el waits for has changed. Therefore, I have decided to “fork” it, fix it for 1.0.2 and add features I always wanted in darcsum.el.

You can get the latest darcsum.el by running:

darcs get http://chneukirchen.org/repos/darcsum/

Simply stuff the darcsum.el into your load-path and (require 'darcsum). Run it with M-x darcsum-whatsnew.

Features added by me include a Edit/Update-Log cycle (think of Arch) and having a look at the context of patches (think diff -u).

NP: Silbermond—1000 Fragen

21jan2005 · Umlauts and Carbon Emacs

I finally found out how to enter special characters the right way in Carbon Emacs. Previously, when I hit “ä” and the likes, it would tell me about “Undefined keys” and the like. Interestingly, the character C-q ä on my german keyboard creates a totally different character than it’s supposed to be (0x8a vs 0x8e4). I helped myself adding these characters with TextEdit afterwise, well knowing that this approach can’t be the whole truth.

However, this is now fixed. I simply added

(set-keyboard-coding-system 'mac-roman)

to my .emacs and now I can enter the correct characters with a single keypress.

I still haven’t found out how to make Emacs actually display these characters, though: I still only see empty boxes. Not that bad, but not perfect either. Comments on this would be very welcome.

Update 30jan2005: I fixed that issue! The code you need in your .emacs is:

(create-fontset-from-fontset-spec
 "-apple-monaco-medium-r-normal--9-*-*-*-*-*-fontset-mac,
  ascii:-apple-monaco-medium-r-normal--9-*-*-*-m-*-mac-roman,
  latin-iso8859-1:-apple-monaco-medium-r-normal--9-*-*-*-m-*-mac-roman,
  mule-unicode-0100-24ff:-apple-monaco-medium-r-normal--9-*-*-*-m-*-mac-roman")
(set-frame-font "fontset-mac" 'keep)
(add-to-list 'default-frame-alist
         '(font . "fontset-mac"))

NP: Interpol—Not Even Jail

31oct2004 · Org-mode

I’ve been looking for an usable Outliner to run on Linux for a long time now. (My ideal is still UserLand Frontier’s.) And I’ve always been dissatisfied with the Emacs outline-mode because I think it doesn’t behave like an outliner should. It’s more for documents that have an outline.

However, isomer of #emacs just pointed out Org-mode, Carsten’s outline mode for keeping track of everything. I have to say it really rocks. You can manipulate the whole outline with a few keys, TAB, M-RET, M-left and M-right. Besides, it has lots of features like TODO lists, a diary view, calendar integration, hyperlinks, excellent table support (sweet), and HTML export. It also integrates with planner.el and remember.el.

Hmm, maybe I should add OPML support… :-)

NP: Eagles of Death Metal—Stuck in the Metal With You

21oct2004 · Your own CADR

Brad Parker did it: Emulating CADR microcode on modern hardware.

Who didn’t ever want to have a Lisp Machine of his own? There you go! :-)

Grab it over at www.heeltoe.com while it’s still hot! It already works fairly well, you can evaluate code and edit with Zmacs. However, there are some cons (pun intended): It takes 100% CPU even if idle and input is still fleaky (the mouse behaves really annoying…). Besides, it’s not exactly fast (recompiling with -mcpu helps a bit, though). It’s nothing that couldn’t be fixed at a later release.

One dumb thing is that the window is 768x1024, so you have to move the window all the time with a resolution lower than 1600x1200…

Quick screenshot:

CADR screenshot

NP: Bob Dylan—Shelter From The Storm

18sep2004 · ETE - Errors To Emacs

I’ve spent the whole afternoon writing two small scripts. What did I do?

My desktop is basically one Emacs instance beneath one Aterm. (Well, there’s a lot of stuff around it, but that doesn’t matter here.) When I code, I write the programs in Emacs, and run them in Aterm. Switching between those two windows is easy, I simply press M-Tab. This is a feature by Enlightenment. However, when my code raises an unhandled exception, there was no easy way to jump directly to the error; I had to jump to and retype the line number of the erroneous file.

This has changed now. I simply run my programs as usual, but write ete before:

$ ete ruby fuckup.rb
fuckup.rb:1: undefined method `fuckup' for main:Object (NoMethodError)

To handle this (trivial) error, I simply switch to Emacs and type C-x :. Emacs will now load the output of ete and jump to the first (mostly only) error. I could use C-x ` if I had several errors. (Unlikely with Ruby, but maybe a C extension…)

You can download ete here: ete (shell script), ete.el (elisp).

On a side note, put this into your .emacs:

;; Make ruby-mode usable for hs-minor-mode.
(add-to-list 'hs-special-modes-alist
         (list 'ruby-mode
           (concat ruby-block-beg-re "\|{")
           (concat ruby-block-end-re "\|}")
           "#"
           'ruby-forward-sexp nil))

Now open some lengthy Ruby file, and do:

M-x hs-minor-mode
M-x reveal-mode

Move over some defs, press C-c @ C-l (better rebind that :P), and be astonished moving your cursor in and out. ;-) Cool, eh?

NP: Velvet Revolver—Superhuman

10sep2004 · Scribble

Today I’ve spent some time to implement the counterpart of RigRag, a wiki-like hypertext system which I dub Scribble.

I decided to write it in Emacs Lisp, since I use Emacs for most of my other stuff too (I keep all my addresses in bbdb, for example), so that would be a nice fit.

I’d have liked to implement RigRag in elisp too, but it’s too graphical to be practical to be used inside a text editor (if you want to call Emacs that way :-)).

Well, I discovered that my elisp knowledge leaves a lot to be desired, so it’s probably going to take some time until I get into it again. However, I need to say that the Emacs documentation really is superb: Being clearly written, covering just about everything one needs to know, and having a comprehensive index is not something you see every day when working with software.

NP: Presidents of the USA—Last Girl On Earth

20jun2004 · nukumi.el

I finished nukumi.el today, which includes a major mode for writing nukumi blog entries. It works very nicely now as it

  • highlights header lines,
  • displays leading and trailing space,
  • generates new blog entries with partly filled fields
    (that is, Date, Encoding, Now-Playing.)
  • and calls nukumi on C-c C-c.

See it in action:
Screenshot of nukumi.el

NP: Die toten Hosen—The Passenger

13jun2004 · Insightful comment on editors

A great comment by Martin DeMello on ruby-talk, inside a long, unneeded thread on userface simplicity and commandlines:

vi isn’t easy to learn; it’s easy to use. You can do a lot of very powerful stuff with surprising ease, far more so than in the more userfriendly editors. emacs too, espcially if you’re an octopus :)

*rofl*

18may2004 · Lisp, Arch & Emacs

Yay, Dave Roberts cites me in his blog “Finding Lisp”; when he asked why so many Lisp projects use Arch:

The best thing I heard was from Christian Neukirchen who wrote and said it was “…because Lispers like to do it the Right Way.” Somehow, that sort of makes sense. Lispers certainly don’t follow the crowd. They look for good solutions to problems and they aren’t afraid to stick with something that isn’t winning the technology popularity contest. So, while the rest of the masses struggle on with CVS, it seems like a lot of Lispers are turning to Arch for its superior approach to change sets, branching and merging, etc.

I exchanged a few emails with Christian and as a result of his urging, I have started using Arch myself.

(I didn’t urge at all! I just told the truth :-))

So far, there were many Arch interfaces for Emacs, and a self-made repository browser contained the comment:

;; nbbba.el doesn't yet integrate with the other tla interfaces,
;; as time will tell which one of the few around will put through.

A mail from Matthieu Moy tells me:

That was true a few weeks ago, but today, tla.el and tilly.el (and recently mst-arch.el) joined xtla, which is now the Emacs interface for tla.

xtla calls itself “a very complete Emacs front-end for tla”.

I tried xtla before, and wasn’t too impressed of it, but a diff against a more recent revision tells me that lots of functionality was added. The archive browser feels a lot like mine but has lots of additional features like viewing changesets, diffing to arbitrary revisions etc. Furthermore, the code is a lot cleaner than mine, since it uses ewoc and not string twiddling for display.

Masatake Yamato even had a patch to make it use tree-widget to get a nice tree overview; he wanted to install that patch soon. It seems to kicks ass now.

Cory Doctorow does civil obedience in the cinema, and they like it!

Ihr seid alle Atheisten! Ich bin ein Christ, ich war von Anfang an Verlieren gewohnt!

NP: Hammerfall—Legacy of Kings

09apr2004 · As seen on #lisp...

 <dan`b> hmm.  I think my lwn subscription runs
         out tomorerow
 <dan`b> "I believe ctrl-W for delete line
         originated, and is pretty much only used
 <dan`b> in vi and emacs (I have neither one
         installed on my system, and I'd
 <dan`b> rather not install something I'll
         only use once, so I can't confirm
 <dan`b> this)"

Ok, this LWN article really seems crap (haven't read it, don't have a subscription):

  1. C-w doesn't delete the line in Emacs (that's what C-k does), but kills the region.
  2. You have vi installed on your system.
  3. If you're not interested in trying new things, you probably shouldn't write for "Linux Weekly News".
  4. C-w works in lots of applications, it's supported in readline, Gtk+ and Mozilla has it too.

NP: Void Main—Follow the GNU feat. RMS

07apr2004 · Emacs update finished

After installing texinfo 4.6, GNU Emacs 21.3.50.2 now runs out-of-the-box without any problems. I think it's time it replaces my current, rather old Emacs 21.1.

I also don't use CVS now to get the latest one, but GNU Arch, which simplifies getting diffs a lot.

Sag jetzt nicht das du müde bist.Ich bin so fit wie ein Stein!

NP: Bob Dylan & Johnny Cash—I Threw It All Away

03apr2004 · Emacs CVS

Just updated my GNU Emacs to CVS HEAD, trying to ride on the bleeding edge for a while...

Installation was quite painless, but my makeinfo was too old so I needed to hack the Makefiles a bit to include --force.

I tried the new GTK+ 2.0 support but didn't like it, the plain X style looks better on my box (but then, my GTK is quite old and I don't have anti-aliasing).

Also tried the new debugger mode—gdba—it works nicely but I personally don't use debuggers that often.

After removing the tons of new font-locking which seem to appear in every new version again, I like it better than my old 21.2 one. If I now knew how to make info-mode not remove the heading underlinings, it would be perfect.

Especially cool is the reveal-mode that shows the text inside the "..." of invisible regions if the point is over it. It makes exploring (and editing!) outline files a joy.

NP: Manowar—Hand Of Doom

Copyright © 2004–2016