unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Sean O'Rourke" <sorourke@cs.ucsd.edu>
Subject: Re: OS X: using emacs as default mailer?
Date: Mon, 27 Jun 2005 19:00:16 -0700	[thread overview]
Message-ID: <m2aclb1brj.fsf@80363334.dynamic.ucsd.edu> (raw)
In-Reply-To: <loom.20050628T022541-142@post.gmane.org> (John Owens's message of "Tue, 28 Jun 2005 00:30:45 +0000 (UTC)")

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:

        <key>CFBundleURLTypes</key>
	<array>
		<dict>
			<key>CFBundleURLName</key>
			<string>Email Address URL</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>mailto</string>
			</array>
		</dict>
              <!-- ... -->
        </array>

  * 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;
}

  reply	other threads:[~2005-06-28  2:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-28  0:30 OS X: using emacs as default mailer? John Owens
2005-06-28  2:00 ` Sean O'Rourke [this message]
2005-06-28  3:51   ` John Owens
2005-06-28  5:43     ` Sean O'Rourke
2005-06-28  5:47     ` Sean O'Rourke
2005-06-28  5:19   ` John Owens
2005-11-30  9:54   ` YAMAMOTO Mitsuharu
2005-06-29 10:55 ` YAMAMOTO Mitsuharu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2aclb1brj.fsf@80363334.dynamic.ucsd.edu \
    --to=sorourke@cs.ucsd.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).