June 2004


Gnus is by far my favourite mail- and newsreader. The Emacs Lisp package browse-url makes URLs in mail and news message clickable, i.e. it fires up your browser of choice. However, browse-url doesn’t seem to know of the existence of Apple’s Safari browser, probably it doesn’t know about the existence of OS X either.  Anyways, this code adds support for Safari.

;; starting www browser
;; ####################

(defun browse-url-osx-default-browser (url &optional new-window)
  "Open URL with system's default browser"
  (interactive (browse-url-interactive-arg "URL: "))
  (let ((osascript (executable-find "osascript"))
        (script (concat "open location "" url """)))
    (start-process
     (concat "OS X default browser: " url)
     nil
     osascript (concat "-e " script))))

(setq browse-url-browser-function
      (cond
       ((is-macosx-machine) 'browse-url-osx-default-browser)
       ((eq window-system 'x) 'browse-url-netscape)
       (t 'browse-url-w3)))

(autoload browse-url-browser-function "browse-url"
  "Ask a WWW browser to show a URL." t)

This code needs the function is-macosx-machine from this story.

Technorati Tags: , , ,

I do have some things in my init.el (XEmacs‘ configuration file), that are rather specific to OS X. The following Emacs Lisp code checks whether XEmacs runs on OS X or not:

(defun is-macosx-machine ()
  (let ((uname
         (lambda ()
           (with-temp-buffer
             (let ((temp-buffer-name (buffer-name)))
               (let ((status
                      (apply 'call-process-region
                             (point-min) (point-max)
                             "uname"
                             nil temp-buffer-name nil)))
                 (if (zerop status)
                     (replace-in-string (buffer-string) "n" ""))))))))
    (let ((os-name (funcall uname)))
      (and os-name (string-equal "Darwin" os-name)))))

Technorati Tags: ,

While writing a scsh program that controls some passwd-like programs via a pseudo-tty (see fork-pty-session) I wondered how to send control chars to the process controlled. I guess it ought to be somthing like that:

(define (write-tty-control-char tty-port tty-name control-char-index)
  (cond
   ((string-ref (tty-info:control-chars (tty-info tty-name))
                control-char-index)
    => (lambda (char)
         (start-tty-output tty-name)
         (display char tty-port)
         (stop-tty-output tty-name)))
   (else
    (error "Control char not supported by tty"
           tty-porty control-char-index))))  

(define (send-eof-tty tty-port tty-name)
  (write-tty-control-char tty-port tty-name ttychar/eof))

(define (send-interrupt-tty tty-port tty-name)
  (write-tty-control-char tty-port tty-name ttychar/interrupt))

Technorati Tags: ,

It’s a neck-and-neck race with OpenAFS and Arla on OS X.  I started using Arla with the first version of OS X, which worked fine. If I recall correctly, arla stopped working with 10.2, so I switched to OpenAFS.  However, after upgrading to 10.3 using AFS on OS X became a major pain. Lots of kernel panics. The strange thing about that: the patch to make OpenAFS work on 10.3 was submitted by an Apple employee… Perhaps that patch wasn’t as “official” as I thought. Arla doesn’t seem to work on 10.3 at all, at least I never managed to make it work.

My last experiments with arla, some version prior to 0.36, ended with even more kernel panics.  Though, in the meantime other people were successful. Moreover,  the OpenAFS CVS has some patches that are intended to fix the kernel panics. I definitely need two additional machines for more experimental installations… *sigh*

Technorati Tags: ,

Reading this weeks’ postings on the OpenAFS port-darwin mailing list was very insightful! Lots of good news.  I learned that there are two (!) implementations of Kerberos 5 plug-ins for MacOS X that given an Kerberos 5 ticket do aklog, thus obtain an AFS token for the user.  There is one implementation by Nicholas Riley and another by Ragnar Sundblad. Finally, I understood why it’s not good to remove tokens upon logout (at least on OS X). Ok, I’m going to throw away my aklog plugin which just executed the aklogin command line program (what a miserable hack!) and replace it with one of those plug-ins.

Technorati Tags: , ,

iTunes can be really annoying, especially when it comes to playing music delivered via a Netjuke server: Safari downloads a m3u playlist file and then fires up iTunes to play the song. However, iTunes expects the file to contain only one URL and subsequently ignores all other URLs. Other players like Audion do a better job on this.

As a work-around I dragged the playlist file on iTunes’ playlist column, which works fine and makes iTunes read the whole file. Fair enough!

I tried to do better and ended up writing an AppleScript (which is even more annoying than iTunes) called iNetjuke. Dropping a playlist file on iNetjuke adds all URLs from the file to iTunes. The plan is to make iNetjuke the default application for m3u file, so Safari will start iNetjuke and start playing automatically. However, it seems that don’t have enough knowledge about AppleScript yet to do so. Meanwhile, if anybody cares to know, here is the very first attempt, iNetjuke 0.1.