Showing posts with label annoyances. Show all posts
Showing posts with label annoyances. Show all posts

Saturday, March 14, 2009

Fix dired under Fink xemacs (Mac annoyance Saturday)

Tonight I literally spent a couple of hours grappling with an uber-annoying bug under XEmacs in current Fink: dired-mode chokes on directories containing symbolic links. The symptom is that when you try to open a directory in dired, a cryptic "no file on this line" error appears in the minibuffer and dired fails to open.

To make a long story short: this fix from the Apple support forums is (unbelievably) the fastest and most foolproof way to fix this error. Step by step:

  1. sudo xemacs /sw/lib/xemacs/xemacs-packages/lisp/dired/dired.el
  2. Find the line containing the regex
    "[^ ][-r][-w][^ ][-r][-w][^ ][-r][-w][^ ][-+ 0-9+]"
    and change the regex to
    "[^ ][-r][-w][^ ][-r][-w][^ ][-r][-w][^ ][@\+]?[-+ 0-9+]"
  3. C-x C-s
  4. M-x byte-compile-file
  5. C-x C-c
  6. Quit and restart XEmacs.

Of course, you will need to do this again whenever Fink decides to overwrite dired.el; unless the Fink maintainers merge in the upstream fix.

Gory details below.


Under Mac OS X, unlike every other Unix in recorded history, ls inserts an @ or + sign after the permissions list on certain types of files (symlinks and files with "extended security information"). The dired.el code is brittle with respect to this oddity. Furthermore, it does not provide any way to customize the regular expression that matches and parses the output of ls (which, incidentally, is my primary evidence that Mac OS X is the first Unix in history to behave this way; it's essentially impossible that a Unix could have existed for any length of time like this without a patch being fed upstream to Emacs).

Now, it turns out that this bug was fixed in Dired 7.15. So the real problem is that Fink XEmacs has not pulled down the latest Dired; it's currently stuck on 7.13.

So, what's a hacker to do? Let me count the frustrations.

1. XEmacs has a built-in elisp package manager called pui. Maybe I can upgrade Dired that way?

I use M-x pui-list-packages; then I set a package mirror from the Tools > Packages menu; finally, I select the Dired package and type I to install:

(error/warning) Error in process filter: (ftp-error FTP Error: CWD 550 /pub/packages/editors/xemacs/packages/.: No such file or directory failed: )

Oh great. I try a half-dozen different package mirrors and every motherfucking one gives me this error (except when it dies even earlier due to some other FTP problem).

2. Aha, MacPorts has a more recent XEmacs! Screw Fink, maybe the MacPorts guys know what they're doing:

$ sudo fink remove xemacs
. . . long console spew . . . 
$ sudo port install xemacs
. . . long console spew . . . 
$ xemacs
Error: attempt to add non-widget child "*scratch*"
to parent "Buffers" which supports only widgets
[xemacs crashes]

The current MacPorts package of xemacs doesn't even start up. Bloody motherfucker.

3. Maybe I should just switch to FSF Emacs, which I already use on all my other boxes. I mean, Fink has emacs22-gtk now. Yeah, right:

$ sudo fink install emacs22-gtk
Information about 8097 packages read in 1 seconds.

. . . [deletia] . . .
The following package will be installed or updated:
 emacs22-gtk
. . . [deletia; making a long story short:] . . .
sed: /usr/X11/lib/libfontconfig.la: No such file or directory
### execution of /var/tmp/tmp.1.UdYe2K failed, exit code 1
Removing runtime build-lock...
Removing build-lock package...
/sw/bin/dpkg-lockwait -r fink-buildlock-fontconfig2-dev-2.4.1-106
(Reading database ... 42622 files and directories currently installed.)
Removing fink-buildlock-fontconfig2-dev-2.4.1-106 ...
Failed: phase installing: fontconfig2-dev-2.4.1-106 failed

4. So, I finally gave Carbon Emacs a try. Carbon Emacs runs, and dired actually works fine. Miracle of miracles.

Unfortunately, fonts are completely busted under Carbon Emacs. You get a slick anti-aliased font out of the box, but you can look forward to a hair-pulling exercise in frustration if you attempt to change that font to anything that's (a) legible and (b) fits more than 50 vertical lines of text on a Macbook Pro screen. Anti-aliased Courier looks even more terrible at 8pt than Courier usually looks. And Carbon Emacs is the first windowed Emacs I've used where no variant of the "Clean" font works out-of-the-box. Congratulations Apple! You've broken a piece of software that's basically worked for twenty years. So Carbon Emacs is out.

5. About twenty minutes of screwing around trying to install dired from CVS into a user-local directory, and have it override the one in the system directory, yields no progress.

6. I could try to install the latest dired package by hand, but I am sort of scared of what else might break if I do this. So, as much as I dislike manually twiddling with system files that should be under my package manager's control, I grit my teeth and did the voodoo noted at the top of this post. Which finally gets me everything I want, but my mouth is left with the distinct bitter residue of time sucked away from my life that I'll never get back.


My conclusions from this whole experience are as follows.

First, package maintainers for Fink and MacPorts aren't as good as the maintainers for Debian or Ubuntu. At any given time, a fair number of important packages will simply be nonfunctional. So the package situation will always be a pain in the ass on Mac compared to Linux.

Second, Mac OS X's random gratuitous differences from other *nix flavors will continue to suck away at least as much time from my life as I spent getting wireless and other random hardware widgets to work on a Linux laptop. Truly, for a programmer, there's no such thing as a laptop where you don't spend a significant amount of time fiddling with random bullshit just so you can get work done.

Saturday, February 28, 2009

Option key as Alt in KDE apps on Mac (Mac annoyance Saturday)

The default keyboard setup of Apple's X11.app for Mac OS X doesn't support Alt- shortcuts in KDE apps (at least not when KDE's installed via current fink, e.g. by sudo /sw/bin/fink install kdebase). This makes konsole just about unusable, as konsole translates Alt events into Meta keypresses on the underlying terminal, and discards true Meta events. To fix this, assign the keycodes as follows in your ~/.Xmodmap:

keycode 66 = Alt_L
keycode 69 = Alt_R

Then, ensure that your X11 "Preferences..." are as follows (dialogue box is from Leopard):

Finally, restart X11.

For completeness, here's the keyboard layout kcontrol module (you shouldn't have to do anything here, as these are the default settings):

Credit to this macosxhints.com post, which took an astonishing amount of searching to sift from the vast oceans of trash and non-working solutions that you get when you search for X11 issues for Mac. I post this in the hope that it will serve as more efficient Google-food.

(Background: I recently killed the hard drive on my ~2.5-year-old work MacBook, and so I've been reconstructing my work environment on the shiny new MacBook they requisitioned for me. Running emacs in a screen session on a remote Linux box is one of my most common activities, so having konsole with no Alt/Meta makes Mac usage just about unbearable. I could not for the life of me remember the magical incantation I did to fix Alt last time, so I literally spent about half a workday intermittently typing random permutations of "kde", "fink", "alt", "meta", "konsole", and "leopard" into my web search box. Blech.)

Tuesday, September 02, 2008

Against video

Is anyone else out there annoyed that an increasing proportion of web content — particularly on political blogs, although the disease seems to have spread more broadly — consists of embedded videos or links to video files?

As a communicative medium, video on the web:

  • Runs on Flash, and therefore looks lousy.
  • Runs on Flash, and therefore is flaky on any platform where Flash is flaky.
  • Runs on Flash, and therefore cannot easily be saved offline for future reference.
  • Cannot usually be watched muted (no subtitles).
  • Cannot be easily quoted, re-edited, or linked-to. Note the large number of people who embed or link to a video and say "watch for 0:28" or "the relevant bit starts at 4:37" (argh). Again, this cuts against the spirit of the web. Video on the web — YouTube comments and "video replies" notwithstanding (har har) — is not a medium of conversation, the way that text or even images can be. We need the <blockquote> and <a href> tags to work with video.
  • Cannot be scanned, skimmed, or watched at greater than 1x speed (again, usually no subtitles); so in order to watch a video, I have to sit there for however long the person responsible thought was an appropriate amount of time. This is perhaps the worst scourge of all. I probably read word-for-word no more than 10% of the stuff I look at on the web. On any given page of text, mostly I read the title and then skim for interesting phrases; I only Read The Whole Thing for the rare article that appears to be worth the time. Video makes this behavior impossible: the viewer has to suck the content through the narrow straw of the video player, one paltry second's worth of content in any given second. In three minutes I can read a 200-word blog post and skim 5 more; or in three minutes I can watch one video containing, often, about 200 words of contentful speech. What a waste of my time. (Audiocasts are no better.) To make things worse, many web videos are poorly and amateurishly edited. And those which are professionally edited are often no better, as they have often pointlessly long intros/outros (musical, animated, or both) which are frankly holdovers from a pre-Web era where video producers had to do all branding via interstitials instead of overlays or surrounding dressing (that is, time-division multiplexing branding with the content instead of space-division multiplexing). Just cut to the chase already!

Seriously, for any given video I run across on the web, there's roughly a 99% chance that I'd get just as much or more out of a textual transcript. But video seems to be so damn popular and honestly I don't understand it. Is it just because it's campaign season and everyone feels like reposting ads? Or is it something deeper? My previous post was about how video game fans mistakenly seem to think video games aspire to the condition of cinema. Is it possible that the web has the same mistaken inferiority complex with television? But television seems worse in almost every way. I mean, video's fine for carefully hewn narrative works of entertainment — I like The Wire as much as the next guy — but as a medium of online conversation I find video sorely lacking.

Saturday, June 21, 2008

Stop X11 from launching xterm (Mac annoyance Saturday)

In short, type the following at a command prompt:

defaults write org.x.X11 app_to_run /usr/bin/true

Wow, it's so intuitive! Mac UI genius scores again.

Via this macosxhints.com thread, although the recipe at the top is broken, at least in Leopard. The suggestion at the bottom of the thread is the winner.

(I'm going to start posting my Mac annoyances on Saturdays. From my experiences so far with Mac, I think my only problem will be limiting myself to one per week.)