emacs 23 on OS X: mailto links & calling compose-mail?

639 Views Asked by At

I'm trying the 23.2 release Cocoa Emacs build (OS X 10.6). There's a number of things that are more annoying about Cocoa Emacs than the terrific Carbon Emacs (based on an Emacs 22 build, I believe), so I hoped folks might have some solutions/thoughts (unfortunately posting on neither the carbon-emacs list nor emacs-dev has produced a useful reply, so I thought I'd try Stack Overflow for the first time):

  • In Firefox, I can set the Preferences, Applications, mailto content type to "Use Emacs". This used to work in Carbon Emacs. Now when I click on a Firefox mailto link, it changes focus to Emacs but doesn't actually do anything.

    My .emacs has the following, which I guess doesn't work in 23. Suggestions?

    (setq browse-url-browser-function
          '(("^http:" . browse-url-generic)
            ("^https:" . browse-url-generic)
            ("^mailto:" lambda (url &rest stuff) (compose-mail 
                                                  (substring to 7)))
            ;; ("^mailto:"  . browse-url-mail) ;; same behavior
            ("^file:.*\\.html?$" . w3m-browse-url))
    )
1

There are 1 best solutions below

4
On BEST ANSWER

I suspect that emacs is failing to find the 'file' it's being told to open. Try a couple things on the command line to see what happens:

emacs mailto:[email protected]

should just open emacs and stare at you blankly.

emacs --eval '(browse-url "mailto:[email protected]")'

should handle the url.

If that all checks out, then you need to wrap things when firefox makes it's invocation (with a script unless FF lets you specify the command line using a %s replacement). Alternatively, you might be able to get things working by setting TRAMP up to understand a mailto: url, but that seems a bit convoluted.

(now that I know what to look for: you might find the EmacsWiki:MailtoHandler helpful.)