* txmt URL for Mac OS X
@ 2008-08-10 16:13 Perry Smith
0 siblings, 0 replies; only message in thread
From: Perry Smith @ 2008-08-10 16:13 UTC (permalink / raw)
To: emacs-devel
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)
(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)))))
The txmt URL looks like:
txmt://open?url=file:///Users/pedz/Source/Merb/wnp/app/views/site_configurations/index.html.erb&line=18
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,
Perry
Ease Software, Inc. ( http://www.easesoftware.com )
Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-08-10 16:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-10 16:13 txmt URL for Mac OS X Perry Smith
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.