Binding nxml-complete in Aquamacs Emacs

Paul R. Brown @ 2008-11-15T06:22:35Z

The folks who bundled up nXML mode for inclusion with Aquamacs Emacs did think to include the useful schemas bundled with nXML mode, e.g., for XSLT 1.0, but I can't figure out why they didn't bind nxml-complete (context-sensitive, schema-driven completion and suggestion) to a keystroke. (If memory serves, C-Return used to work.)

It's an easy fix, but I always forget just how to do it. As a reminder to myself or a hint to others, the fix is to add the following to ~/Library/Preferences/Aquamacs Emacs/:

(add-hook 'nxml-mode-hook
	  '(lambda ()
	     (define-key nxml-mode-map "\C-c\C-c"
	       'nxml-complete)))

My preference is for C-c C-c but yours may be different. In any case, that's about as blissful as editing XSLT gets.

(comment bubbles) 0 comments

Emacs haskell-mode Unicode Cuteness

Paul Brown @ 2007-09-15T18:21:00Z

With haskell-mode for Emacs, hidden away in haskell-font-lock.el, is the variable haskell-font-lock-symbols. Setting it to 'unicode' will make Emacs do pretty things for anonymous functions:

and composition:

among others. Nice. (N.B. it can interfere with alignment, but I have yet to run into any issues.)

(comment bubbles) 3 comments

Largely Mouseless Browsing

Paul Brown @ 2006-06-14T06:39:00Z

The mouse has its place, but I've never been that fond of the degree to which use of the mouse is required in many GUIs. (I'll take the position that anything that can reasonably be done without the mouse should be.) QuickSilver was a giant leap forward in de-emphasizing the mouse, and Mail ActOn helped; but the browser was largely the domain of the mouse. Now the Conkeror extension for Firefox takes a step toward mouse-free browsing with an interface that seldom requires taking hands away from the keyboard. In addition to Emacs-ish key bindings (including for text areas) and conveniences (like c to copy the current URL to the clipboard), Conkeror numbers the links and form elements on a page for random access (as opposed to the sequential access provided by TAB'ing in a traditional browser interface), and so far it's an improvement. (This approach does run afoul of really fancy interfaces like GMail, but the mouse remains usable for those situations.)

Conkeror also has a nice feature called “webjumps” (derived from an Emacs feature of the same name) that reminds me a bit of YubNub. For example, to find out how far below hair care brands, the NPR Paul Brown, and famous football coaches I rank on Google, I type g followed by google Paul Brown. Or, to add the current URL to my del.icio.us bookmarks, I type g followed by adelicious .. This requires adding the line delicious_username=“prb” (in my case) to your ~/.conkerorrc file and ensuring that Conkeror knows the location of your rc file by telling it on the help page (M-x help-page). (The . in the del.icio.us webjump is just window dressing and could just as well be foo or whatever; the webjump doesn't take any arguments, but Conkeror doesn't interpret a URL as a webjump unless an argument is supplied...)

Bill Clementson has some additional tips here and here.

(comment bubbles) 0 comments

Emacs as a WS-BPEL Editor, Part II

Paul Brown @ 2004-10-10T01:52:00Z

Yesterday, I put together a RNC schema for the legacy version of BPEL, a.k.a. BPEL4WS 1.1. After writing a few processes, I've made some corrections, and I've also put together a RNC schema that matches the current (September 2, 2004) commitee draft XML schema.

nxml-mode and rnc-mode in Carbonized-Emacs
(comment bubbles) 0 comments

Emacs as a WS-BPEL Editor

Paul Brown @ 2004-10-09T02:16:00Z

Emacs with nxml-mode has become my XML editor of choice, thanks to real-time validation and context-sensitive editing features. The price of the elegance and utility is that nxml-mode requires a Relax NG compact syntax ("RNC") schema, and most of the documents that I work with are defined by XML Schema.

So, with the intention of using Emacs as an editor for WS-BPEL, I put together a RNC schema for the legacy version of WS- BPEL, a.k.a., BPEL4WS 1.1. You can download the schema from here. The schema comes without the 14.3 "enhancements" to assignment enabled, but there is a comment that explains how to make the one-line change needed.

This was my first outing with the RNC syntax, and after a quick skim over the tutorial, the terseness of the syntax is agreeable. For writing RNC, David Rosenborg's rnc-mode was helpful, and nxml-mode will "validate" RNC documents when it loads them. (To specify a schema for a document, use C-cC-s.)

I now have the following in my .emacs:

(setq auto-mode-alist
      (cons '("\.\(xml\|xsl\|rng\|xhtml\|bpel\)\'" . nxml-mode)
	    auto-mode-alist))

and it works like a charm. As a bonus, some of the little differences between Relax NG and XML Schema allow the RNC version performs some validation that the XML Schema is not able to, e.g., knowing the various legal attribute combinations versus all possible attribute combinations on a <bpel:from>.

(comment bubbles) 0 comments