[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

txmt URL for Mac OS X

From: Perry Smith
Subject: txmt URL for Mac OS X
Date: Sun, 10 Aug 2008 11:13:50 -0500

I'm not sure where this started but when Merb prints out its stack trace, it has URLs of "protocol" txmt. On the Mac, this generates an "OpenURL" event (I'm probably not using the proper terms here). Filefox 3 has a preference which points to TextMate for this "protocol". I changed it to Emacs but that did not work. In fact, TextMate was still invoked which really confused me.

I finally tracked down the mac-ae-get-url function in term/mac-win.el file. If it does not understand the URL, it passes it on which I guess is why TextMate is still invoked.

I rewrote mac-ae-get-url to understand the txmt url.  The code is:

(defun mac-ae-get-url (event)
  "Open the URL specified by the Apple event EVENT.
Currently the `mailto' and `txmt' schemes are supported."
  (interactive "e")
  (let* ((ae (mac-event-ae event))
         (the-text (mac-ae-text ae))
         (parsed-url (url-generic-parse-url the-text))
         (the-url-type (url-type parsed-url)))
    (case (intern the-url-type)
         (url-mailto parsed-url)
         (select-frame-set-input-focus (selected-frame))))
(let* ((not-used (string-match "txmt://open\\?url=file://\\ ([^&]*\\)\\(&line=\\([0-9]*\\)\\)?" the-text))
              (file-name (match-string 1 the-text))
              (lineno (match-string 3 the-text)))
         (if (null file-name)
             (message "Bad txmt URL: %s" the-text)
           (find-file file-name)
           (goto-line (if lineno (string-to-number lineno) 0))
           (select-frame-set-input-focus (selected-frame)))))
      (t (mac-resume-apple-event ae t)))))

The txmt URL looks like:


The url-generic-parse-url gets confused. I'm not sure if the URL is a valid URL or not. But instead of making "open" the host with url and line as arguments, it makes "open?url=file" the host, 0 the port, etc. So, that is why the string-match, etc. It may be that url- generic-parse-url needs to be changed but that seemed more dangerous than just mucking with mac-ae-get-url.

Anyhow, I hope this helps,
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems

reply via email to

[Prev in Thread] Current Thread [Next in Thread]