From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Sean O'Rourke" Newsgroups: gmane.emacs.devel Subject: Re: OS X: using emacs as default mailer? Date: Mon, 27 Jun 2005 19:00:16 -0700 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1119923726 3312 80.91.229.2 (28 Jun 2005 01:55:26 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 28 Jun 2005 01:55:26 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 28 03:55:17 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dn5JM-0004xV-Mh for ged-emacs-devel@m.gmane.org; Tue, 28 Jun 2005 03:54:52 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dn5R7-0001IR-BV for ged-emacs-devel@m.gmane.org; Mon, 27 Jun 2005 22:02:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dn5Ql-0001CI-6S for emacs-devel@gnu.org; Mon, 27 Jun 2005 22:02:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dn5Qc-00017l-4v for emacs-devel@gnu.org; Mon, 27 Jun 2005 22:02:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dn5Qc-00017i-1L for emacs-devel@gnu.org; Mon, 27 Jun 2005 22:02:22 -0400 Original-Received: from [132.239.1.56] (helo=mailbox4.ucsd.edu) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1Dn5T8-0000Ym-5U for emacs-devel@gnu.org; Mon, 27 Jun 2005 22:04:58 -0400 Original-Received: from smtp.ucsd.edu (smtp-a.ucsd.edu [132.239.1.49]) by mailbox4.ucsd.edu (8.13.3/8.13.3) with ESMTP id j5S20HBd056703 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 27 Jun 2005 19:00:18 -0700 (PDT) Original-Received: from 80363334.dynamic.ucsd.edu (80363334.dynamic.ucsd.edu [128.54.51.52]) by smtp.ucsd.edu (8.12.10/8.9.3) with ESMTP id j5S20GTg017756; Mon, 27 Jun 2005 19:00:17 -0700 (PDT) Original-To: John Owens , emacs-devel@gnu.org In-Reply-To: (John Owens's message of "Tue, 28 Jun 2005 00:30:45 +0000 (UTC)") User-Agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (darwin) X-Greylisting: NO DELAY (Trusted relay host); processed by UCSD_GL-v1.2 on mailbox4.ucsd.edu; Mon, 27 June 2005 19:00:18 -0700 (PDT) X-MailScanner: PASSED (v1.2.8 51895 j5S20HBd056703 mailbox4.ucsd.edu) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:39711 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:39711 I've got Emacs directly accepting URLs locally, and I've been meaning to contribute it when I get some time (unless someone beats me to it). Unfortunately, it's tangled with my local drag-n-drop changes, which need some work to better cooperate with X DnD. What you need to do is: * add a CFBundleURLTypes entry to Emacs.app's Info.plist, like so: CFBundleURLTypes CFBundleURLName Email Address URL CFBundleURLSchemes mailto * Handle the 'GURL' event in src/macterm.c (see code at end for an example which handles the Mac-specific bits), adding this to init_required_apple_events: err = AEInstallEventHandler('GURL', 'GURL', NewAEEventHandlerUPP ((AEEventHandlerProcPtr) do_ae_geturl), 0L, false); * As you suggested, go into Mail.app and change your default mail application. You might be able to do this with a shell script or applescript ("on GetURL do ...", I think) by making it into an app and adding the appropriate entries to its Info.plist, but I couldn't get that to work when I tried it before. Good luck. /s static pascal OSErr do_ae_geturl (const AppleEvent *pAE, AppleEvent *reply, long refcon) { OSErr err; AEDesc desc; int i, nitems; err = AEGetParamDesc (pAE, '----', 'list', &desc); if (err != noErr) return err; err = AECountItems (&desc, &nitems); if (err != noErr) goto err_count; for (i = 1; i <= nitems; i++) { Size size; DescType type; Lisp_Object url; if (AESizeOfNthItem (&desc, i, &type, &size) != noErr) continue; url = make_uninit_string (size); if (AEGetNthPtr (&desc, i, typeChar, NULL, NULL, SDATA (url), size, NULL) != noErr) continue; mac_add_drag ("url", "open", url); } err_count: AEDisposeDesc (&desc); return err; }