Latest Posts

Next 5 posts:

Another Emacs Project Library

I've posted a new project handling library to the Emacs Wiki: mk-project.el. A "project" in this sense is a directory of source files. You define a named project and provide settings for it: base directory, source file patterns, file patterns to ignore, the TAGS file, the compile command, etc.

Features:

  • Quickly switch between projects, optionally closing the files in the old project.
  • Use the new project's TAGS file -- and be able to rebuild the TAGS file based on project settings.
  • Run find-grep from the new project's base directory, ignoring certain files or directories based on project settings.
  • Run compile with the project's preferred compile command.
  • Open any file in the project quickly based on regex matches.
  • Quickly open dired on the project's base directory.
  • Define per-project startup and shutdown hooks -- useful for opening often-used files.

Perhaps the feature I'm happiest with is project-find-file. The library maintains a list of all the files under the project's base directory in a special buffer, *file-list*. Project-find-file ask for a regular expression representing part of a file's path or name and either 1) opens the file if there is only one match in *file-list*, or 2) allows selecting among the matching files with Emacs' built-in completion mechanism. Also, it sometimes comes in handy to search buffer *file-list* directly when you want an overview of the entire project. I often work with projects having thousands of files in deep folder hierarchies so project-find-file is very convenient.

After writing my library, I discovered a similar library, ProjMan by David Shilvock. The project operations we offer are similar - we even recommend similar keybindings! ProjMan is perhaps more complete, but I don't feel my time was wasted writing mk-project.el -- elisp is pleasure to code in.

Technorati tags for this post:

Suspend/Resume on a Lenovo T61 Running Ubuntu 8.04

As I've discussed before, I have a Lenovo T61 laptop with a Nvidia Nv140m video card running Ubuntu 8.04 (Hardy Heron). With the proprietary "nvidia" video driver, suspend/resume works fine. However, I use the open source "nv" driver as it supports xrandr which I need to hotdock my machine. The laptop fails to fully resume when running "nv": the screen is black; the keyboard and mouse are unresponsive.

The T61 thinkwiki pages for Ubuntu 8.04 and 7.10, the hal sleep quirk page and David Goodlad's post helped identify the root problem.

First, gnome-power-manager has taken over suspend/resume duty from acpid in 8.04 -- so the changes I had made to /etc/default/acpi-support are no longer used. Secondly, as David noted, the nv driver requires the s3_bios and vbemode_restore video quirk settings. However, my many attempts to edit /usr/share/hal/fdi/information/10freedesktop/20-video-quirk-pm-lenovo.fdi so that hal would set these particular quirks for my hardware failed. (The thinkwiki page has complaints from people who could not get hal to recognize their edits as well -- does anybody definitively know how to edit these files?) I resorted to adding these lines to my /etc/rc.local file:

hal-set-property --udi /org/freedesktop/Hal/devices/computer --key power_management.quirk.s3_bios --bool true
hal-set-property --udi /org/freedesktop/Hal/devices/computer --key power_management.quirk.s3_mode --bool false
hal-set-property --udi /org/freedesktop/Hal/devices/computer --key power_management.quirk.vbemode_restore --bool true

For the record, hal reports my hardware model as:

# hal-device | grep system.hardware
...
system.hardware.vendor = 'LENOVO'  (string)
system.hardware.product = '6459CTO'  (string)
system.hardware.version = 'ThinkPad T61'  (string)

And finally, now hal reports my quirk settings as:

# lshal | grep quirk
power_management.quirk.s3_bios = true  (bool)
power_management.quirk.s3_mode = false  (bool)
power_management.quirk.save_pci = true  (bool)
power_management.quirk.vbemode_restore = true  (bool)

Suspend/resume functionality has been resumed (ugh) for me.

As an aside, hibernate works now too. It did not work in 7.10. I don't know if these changes fixed it, or if the upgrade to 8.04 did the trick.

Update 2008/09/04: After reading the HAL spec, I discovered that the /etc/hal/fdi/information directory is where an administrator should drop custom device information for the system. Settings in this location will override the /usr/share/hal/fdi/information data. Looking there, I discovered Ubuntu had already created a lenovo.fdi file. Editing the file to look like below fixed suspend:

<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">
  <device>
    <match key="system.hardware.vendor" string="LENOVO">
      <!-- Ubuntu default settings: good for nvidia driver
      <merge key="power_management.quirk.s3_mode" type="bool">true</merge>
      <merge key="power_management.quirk.s3_bios" type="bool">false</merge>
      <merge key="power_management.quirk.save_pci" type="bool">true</merge>
      -->

      <!-- My settings: good for the nv driver -->
      <merge key="power_management.quirk.s3_bios" type="bool">true</merge>
      <merge key="power_management.quirk.save_pci" type="bool">true</merge>
      <merge key="power_management.quirk.vbemode_restore" type="bool">true</merge>
      <merge key="power_management.quirk.s3_mode" type="bool">false</merge>
    </match>
  </device>
</deviceinfo>

Why I Quit Facebook

I joined Facebook out of technical curiosity. My curiosity was satisfied after a week of light use; my patience was finally depleted after 2 1/2 months. I completed deleted my account. Not deactivated it, deleted it.

Sorry friends -- I owe you an explanation. And given my motivation for joining, I was planning a long, technical evaluation of Facebook's failings.

But this is much funnier:

Compiling SBCL with Threads and Unicode

This is one of those note-to-self posts. For whatever reason, I nearly always forget to enable threads and unicode when I build SBCL. Threads are required by hunchentoot; I enable Unicode just for kicks.

Here's my build recipe for SBCL:

  1. > git clone git://sbcl.boinkor.net/sbcl.git sbcl-git ./sbcl.git
  2. > cd sbcl.git
  3. > git checkout sbcl_1_0_18
  4. Edit customize-target-features.lisp to enable the features you want.
     (lambda (features)
       (flet ((enable (x)
                (pushnew x features))
              (disable (x)
                (setf features (remove x features))))
         ;; Threading support, available only on x86/x86-64 Linux, x86 Solaris
         ;; and x86 Mac OS X (experimental).
         (enable :sb-thread)
         (enable :sb-unicode)))
    
  5. > screen
  6. > sh make.sh
  7. detach screen from terminal while compiling -- too much output! Ctrl-a, d
  8. > sudo INSTALL_ROOT=/opt/sbcl sh install.sh

Defining Recursion Algorithmically

This is too much text to twitter, so it finds a home on my blog. From Andrew Plotkin via Wikipedia:

"If you already know what recursion is, just remember the answer. Otherwise, find someone who is standing closer to Douglas Hofstadter than you are; then ask him or her what recursion is."

« earlier :: later »