Emacs URI handler for recent GNOME.
~/.emacs:
(defun emacs-uri-handler (uri)
"Handles emacs URIs in the form: emacs:///path/to/file#LINENUM"
(let ((uri-struct (url-generic-parse-url (save-match-data (if (string-match "^'\\(.*\\)'$" uri) (match-string 1 uri) uri)))))
(select-frame-set-input-focus (selected-frame))
(find-file (decode-coding-string
(apply 'unibyte-string
(string-to-list (url-unhex-string (url-filename uri-struct))))
'utf-8))
(let ((line (url-target uri-struct)))
(if line (goto-line (string-to-number line))))))~/.local/share/applications/emacsclient.d
esktop:
[Desktop Entry]
Name=emacs url handler
Exec=/usr/bin/emacsclient --no-wait -e "(emacs-uri-handler \"%u\")"
MimeType=x-scheme-handler/emacs;
Type=Application
Terminal=false
Categories=Utility;Development;TextEditor;
Works for me on Linux Mint 11 (Emacs 23.2, Firefox 4.0, GNOME 2.32).