txmt URL for emacs

8 views
Skip to first unread message

pedz

unread,
Aug 10, 2008, 11:53:23 AM8/10/08
to merb
I guess technically this is not a merb topic but I bumped in to it
when I was using Merb so I thought I'd post it here as well as the
emacs developer's list.

The stack trace has URLs of type txmt. Setting Firefox's preferences
to point to emacs did not solve my problem. I finally rewrote this
function which is found in term/mac-win.el. (This is just for Mac OS
X.) The function use to take only the mailto URL but now it takes the
mailto and the txmt URLs.

(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)
(mailto
(progn
(url-mailto parsed-url)
(select-frame-set-input-focus (selected-frame))))
(txmt
(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)))))

Reply all
Reply to author
Forward
0 new messages