How to Escape a Viper

January 21, 2009

This is kind of a dumb post.* I like to use the viper package for emacs, which mostly works just fine.  I’m in the habit of using C-[ (hold-down control, press '[') instead of <escape> to back into command mode.

Sometimes I run emacs on Mac OS X (be it a Carbon port, in X11, or through a terminal).  Unfortunately, various Mac-compatible emacsen interpret C-[ as Meta and not as <escape>.  So instead of backing into command mode, I see "ESC-" at the bottom of the screen.  I can wait forever and emacs will never parse it into an <escape>.  If I try again, I see "ESC-ESC-".  If I try a third time, the command completes but does nothing, except causing me to scream in agony since I'm still not in command mode.

Fortunately I found that adding a simple (setq viper-ESC-key "^[") to my ~/.viper, where '^[' is literally the <escape> character (i.e., ASCII 27)**, fixes everything (viper-ESC-key is set to "\e" by default, which is supposed to be <escape> but whatever).

And there you have it.

* ... but this took me months to figure out.  I'm posting this so that maybe someone searching for "mac os x emacs meta escape viper fails" finds the help they need...

** If you're editing in emacs, type C-q C-[ to get a literal '^]‘.  If you’re editing in vim, type C-k C-[ to get a literal ‘^[‘.


The Last Lecture

January 17, 2009

lastlecDr. Randy Pausch’s The Last Lecture is a pretty good read.  The highlight for me is his description of higher education not as “learning to learn,” which is the accepted cliche, but as “learning to judge yourself.”  In other words, developing your own internal feedback loop so that you know where you stand in life—both in your own mind and as others perceive you.

Some comments I’ve read criticize Dr. Pausch for spending time on a book instead of with his family.  To me that’s unsympathetic:  “acute as well as terminally ill patients frequently prefer to be surrounded by persons and possessions that are familiar” [1].  So why not a familiar task?  After all, here was a hardcore academic who spent his life writing furiously to meet deadlines.  Here, he didn’t have to pretend to be someone else—and he created a lasting legacy for his kids.


F-29 Retaliator (1991)

October 24, 2008

Retaliator Splash ScreenRetaliator is a cool game that I used to play a lot of.  Actually it’s the only flight sim I’ve ever enjoyed.  Its gameplay involves cruising around on a small map (settings included ‘Pacific’ and ‘Middle East’) and destroying labelled targets and enemy aircraft in the area (splash one lizard, yo).  Its 3D engine is simple but remarkably smooth for its time.

 multiplayer

What really makes the game fun is its head-to-head modem play.  The slower modem we typically used ran at 2400 baud, which meant choppy updates but otherwise a very playable experience.  The only problems came up when trying to fly in formation: a slight change in trajectory could cause your opponent to slam right into you.

Retaliator gameplay screenshotTypical of the genre, Retaliator supports multiple views: the standard cockpit view, various views taken from outside the plane, and one looking “behind,” shown on the right.  Hm.  Is that you, or the copilot?  I’ve only ever seen one parachute come out of an airplane…

Retaliator gameplay screenshotWhen you are shot, different parts of your plane stop working: radar, fuel lines, weapons. This is kind of cool—your sensors can get damaged and you can keep flying around.  But if you’re damaged badly enough, your engines will intermittently fail and your plane will start to nosedive. You can pull up, prolonging the inevitable, but eventually you must eject. Oh, and while your engines aren’t working, Retaliator plays the most horrible alarm out of the PC speaker.  Possibly one of the worst noises I’ve ever heard in my life.  Cool MIDI soundtrack, though.


A Spectre of Forgery

October 22, 2008

Arts & Letters Daily is one of my favorite ways to get cultured.  Today they link to a New Yorker article about Han van Meegeren, forger extraordinaire.  The author criticizes forgery:

“The spectre of forgery chills the receptiveness—the will to believe—without which the experience of art cannot occur.”

This struck home with me.  I’m no connoisseur of fine art, but I’ve experienced this effect first-hand in other media.  For instance, comedy is so much funnier when it’s happening in front of you instead of on a TV set; fighting is similarly much more brutal.  I think in part it’s due to the possibility of video editing, TV’s very own spectre of forgery.


hlsearch for Emacs

September 19, 2008

Vim has an option called “hlsearch” that highlights every instance of your most recent search term.  Like this:

Searching for "ground" in a text document using Vim.

Searching for "ground" in a document using Vim.

Emacs has the viper and vimpulse plugins that closely emulate vi/vim keyboard commands, but no hlsearch.  If you’re using viper and a version of Emacs later than 22.0, pasting the following into your .viper will give you this functionality.

(defun viper-flash-search-pattern ()
  (hi-lock-mode 0) (hi-lock-mode 1)
  (hi-lock-set-pattern
     (car viper-search-history) 'hi-green)
)

Unfortunately toggling hi-lock mode (line 2) is destructive if you’re using hi-lock mode for anything in addition to highlighting search terms.  In other words, there’s probably a better way to write this function. To solve the problem of clearing highlighting I’m no longer using, I use this (inefficient) snippet:

(viper-record-kbd-macro "//"
  'vi-state
  [(meta x) h i - l o c k - m o d e (control m)
   (meta x) h i - l o c k - m o d e (control m)]
't)


Hack’ & ‘Hack

September 1, 2008

I woke up and scrambled two eggs for breakfast.  I travelled to campus to meet with my friend Lonn, and we played hacky sack for a bit.  By then I was hungry, so we looked for food but all the lineups were too long.  Instead, I bought a granola bar out of a vending machine and we played nethack for *hours*.  I managed to polymorph my dog (via polymorph trap) into a master lich; meanwhile, Lonn found rings of poly-control and polymorph and decided that a master lich was the best thing for him to polymorph into.  I died when an air elemental engulfed and tore my meager 59-hp character to shreds, but Lonn’s is alive and well.  Afterwards, I was so… hungry…

Today my ankle is doing fairly well (hence the hacky sack) but still not completely recovered.  I really want to go back to judo & teh jitz, but not just yet.

Tomorrow I start my Ph.D. studies.  I *still* need to decide on a class to take, but I’m uncertain enough about each of the classes to have to visit each one in turn to make my decision.  I also need to decide on a research topic—my supe is taking several very interesting directions in his research, and experience tells me I’ll benefit by complementing his interests and experience.


Nerd Stories I

August 25, 2008

In junior high I had a (deserved) reputation as one of those brats who messed around with the school computers.  So when someone stole all of the mouse balls from the computer lab, I was a prime suspect.  The school principal came into the class to scold us…

Read the rest of this entry »


Samizdat

August 23, 2008

Ninjalicious’s Access All Areas is a surprisingly well-written bundle of guidelines, warnings, and stories having to do with Urban Exploration.  Urban Explorers pursue hidden and off-limits areas with the goal of appreciating the spaces (habitable or otherwise) that humans have created.  Destinations include drains, abandoned/construction sites, hotels, and—this was the coolest one by far—ghost ships.  I was saddened to hear that Ninjalicious (Jeff Chapman) died recently due to lung cancer, but his contributions are everywhere (q.v. the Infiltration and Yip e-zines).  8/10 on the enjoy-o-meter.

"A User's Guide to the Art of Urban Exploration" "How to own The Box"

Stealing the Network is a collection of short stories by various authors involving present-day hardware and software.  On the whole, they aren’t very well-written (clearly the authors’ strengths lie elsewhere) but til I discovered this gem I was finding it hard to stomach books on computer crime that had no basis in reality.  These stories feature real software, real hardware, and believable trickery that made me a little nervous about how we exchange data in the real-world.  That, and the overall theme of the collection is that bad guys always win.  6/10.


Melancholia II

August 21, 2008

“We are eradicating a major cultural force, the muse behind much art and poetry and music. We are annihilating melancholia.”


Scifi Safari

July 3, 2008

I went on a little sci-fi safari recently and thought I’d write to my immense readership about it. The three books I read were Orson Scott Card’s Lost Boys, Robert J Sawyer’s Rollback, and Orson Scott Card’s Children of the Mind. I keep returning to Card because, in my opinion, he’s one of the few sci-fi authors who can actually write

Read the rest of this entry »


Follow

Get every new post delivered to your Inbox.