GNU bug report logs - #1367
23.0.60; Mailto service won't work

Previous Next

Package: emacs;

Reported by: Harald Hanche-Olsen <hanche <at> math.ntnu.no>

Date: Tue, 18 Nov 2008 09:40:04 UTC

Severity: wishlist

Merged with 3963, 9135

Found in version 24.0.50

To reply to this bug, email your comments to 1367 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1367; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Harald Hanche-Olsen <hanche <at> math.ntnu.no>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; Mailto service won't work
Date: Tue, 18 Nov 2008 10:30:33 +0100 (CET)
I have set the mailto handler to be emacs. If I run the command

open mailto:joe.the-plumber <at> example.com

in a terminal (or click on a mailto link in firefox), emacs is
activated (i.e., it comes to the foreground), but nothing else
happens.

At the very least, I would have expected a <ns-spi-service-call> event
to be generated, but C-h l shows no such event. (In contrast, dragging
selected text from a terminal window onto emacs works as expected, and
leaves <ns-drag-text> in the event history.)

In GNU Emacs 23.0.60.1 (powerpc-apple-darwin9.5.0, NS apple-appkit-949.35)
 of 2008-11-14 on macknife
Windowing system distributor `Apple', version 97.112.112.108.101.45.97.112.112.107.105.116.45.57.52.57.46.51.53
configured using `configure  '--with-ns' '--without-x''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  show-paren-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
(irrelevant, apart from the missing <ns-spi-service-call>)






bug reassigned from package `emacs' to `emacs,ns'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Tue, 18 Nov 2008 23:40:04 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1367; Package emacs,ns. Full text and rfc822 format available.

Acknowledgement sent to Adrian Robert <adrian.b.robert <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #12 received at 1367 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Adrian Robert <adrian.b.robert <at> gmail.com>
To: 1367 <at> debbugs.gnu.org
Cc: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Subject: #1367 - 23.0.60; Mailto service won't work - Emacs bug report logs
Date: Fri, 21 Nov 2008 16:00:47 -0500
Hello,

> I have set the mailto handler to be emacs. If I run the command open mailto:joe.the-plumber <at> example.com
> ...
>
> At the very least, I would have expected a <ns-spi-service-call>  
> event to be generated

I am unsure about how mailto: works.  However, ns-spi-service-call is  
only generated when items under the "Emacs.app" heading in the  
Services menu are called.  If the mailto: mapping you describe should  
do this (I don't readily see how), then there is a bug.

On the other hand, if the mailto: mapping results in some random  
applescript command being sent to Emacs, then what is needed is an  
enhancement.  I am unfamiliar with how standardized the various  
applescript things a well-behaved OS X application should respond to  
is.  Is there documentation on this somewhere?  Also, I don't know if  
you are familiar with Cocoa programming, but I wonder if there is an  
NSApp delegate method or a notification that could be registered for,  
avoiding the need to parse applescript.  (This is the way, e.g.,  
double-clicking associated files in the Finder can open them in  
Emacs.app.)

The Carbon port of emacs did do applescript parsing, but I was never  
convinced that it was sufficiently "core" functionality to bring to  
the Cocoa port (given the bloat involved).  Though nowadays with DBUS  
in the X11 emacs the case is more compelling.

-Adrian





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1367; Package emacs,ns. Full text and rfc822 format available.

Acknowledgement sent to YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #17 received at 1367 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
To: Adrian Robert <adrian.b.robert <at> gmail.com>, 1367 <at> debbugs.gnu.org
Cc: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Subject: Re: bug#1367: #1367 - 23.0.60;	Mailto service won't work - Emacs bug report logs
Date: Sat, 22 Nov 2008 10:36:09 +0900
>>>>> On Fri, 21 Nov 2008 16:00:47 -0500, Adrian Robert <adrian.b.robert <at> gmail.com> said:

> On the other hand, if the mailto: mapping results in some random
> applescript command being sent to Emacs, then what is needed is an
> enhancement.  I am unfamiliar with how standardized the various
> applescript things a well-behaved OS X application should respond to
> is.  Is there documentation on this somewhere?  Also, I don't know
> if you are familiar with Cocoa programming, but I wonder if there is
> an NSApp delegate method or a notification that could be registered
> for, avoiding the need to parse applescript.  (This is the way,
> e.g., double-clicking associated files in the Finder can open them
> in Emacs.app.)

You don't need to "parse" AppleScript.  What Carbon or Cocoa
applications receive is an Apple event:

  http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/chapter_11_section_4.html

Core functionalities such as "open documents" and "quit application"
also send some corresponding Apple events, and Cocoa applications
usually handle them via some application delegate methods.

  http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/chapter_11_section_3.html

> The Carbon port of emacs did do applescript parsing, but I was never
> convinced that it was sufficiently "core" functionality to bring to
> the Cocoa port (given the bloat involved).  Though nowadays with
> DBUS in the X11 emacs the case is more compelling.

Unlike Cocoa, Carbon applications need to handle the "core
functionalities" via Apple event handers.  In the original Carbon
Emacs by Andrew Choi, the handlers were hard-coded C routines.  I
lifted them to the Lisp-level so I can provide graceful termination(*)
in response to the "quit application" event.  The mailto: URL support
via "get URL" handler in the Carbon port is a bonus that came for free
by its general Lisp-level Apple event handling mechanism.

(*) If you try logout/shutdown/reboot while leaving a file-visiting
    buffer modified and unsaved, a popup window appears for
    confirmation.  If you cancel the termination of Emacs, the whole
    logout/shutdown/reboot process is also canceled immediately.

				     YAMAMOTO Mitsuharu
				mituharu <at> math.s.chiba-u.ac.jp




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com:
bug#1367; Package emacs,ns. Full text and rfc822 format available.

Acknowledgement sent to Adrian Robert <adrian.b.robert <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, don <at> donarmstrong.com. Full text and rfc822 format available.

Message #22 received at 1367 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Adrian Robert <adrian.b.robert <at> gmail.com>
To: YAMAMOTO Mitsuharu <mituharu <at> math.s.chiba-u.ac.jp>
Cc: 1367 <at> debbugs.gnu.org, Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Subject: Re: bug#1367: #1367 - 23.0.60;	Mailto service won't work - Emacs bug report logs
Date: Fri, 21 Nov 2008 21:51:01 -0500
On Nov 21, 2008, at 8:36 PM, YAMAMOTO Mitsuharu wrote:

>>>>>> On Fri, 21 Nov 2008 16:00:47 -0500, Adrian Robert <adrian.b.robert <at> gmail.com 
>>>>>> > said:
>
>> On the other hand, if the mailto: mapping results in some random
>> applescript command being sent to Emacs, then what is needed is an
>> enhancement.  I am unfamiliar with how standardized the various
>> applescript things a well-behaved OS X application should respond to
>> is.  Is there documentation on this somewhere?  Also, I don't know
>> if you are familiar with Cocoa programming, but I wonder if there is
>> an NSApp delegate method or a notification that could be registered
>> for, avoiding the need to parse applescript.  (This is the way,
>> e.g., double-clicking associated files in the Finder can open them
>> in Emacs.app.)
>
> You don't need to "parse" AppleScript.  What Carbon or Cocoa
> applications receive is an Apple event:

Thanks.. right, I meant "parse Apple Events" -- basically a property  
list, but I've seen some pretty voluminous code to do this, and you  
need to know some agreed conventions.  In this case though, as you  
say, this gets handled under a standardized "GetURL" pattern, and it  
appears from the docs you cite that Cocoa does most of the actual  
parsing.

Now the main decision is whether to go for a general AE facility, or  
just implement a kAEGetURL handler.

thanks,
Adrian






Severity set to `wishlist' from `normal' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Thu, 15 Jan 2009 23:45:05 GMT) Full text and rfc822 format available.

Forcibly Merged 1367 3963 9135. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 21 Jul 2011 04:19:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#1367; Package emacs. (Sat, 04 Dec 2021 21:37:02 GMT) Full text and rfc822 format available.

Message #29 received at 1367 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Harald Hanche-Olsen <hanche <at> math.ntnu.no>
Cc: Alan Third <alan <at> idiocy.org>, 1367 <at> debbugs.gnu.org, 3963 <at> debbugs.gnu.org
Subject: Re: bug#1367: 23.0.60; Mailto service won't work
Date: Sat, 04 Dec 2021 22:36:10 +0100
Harald Hanche-Olsen <hanche <at> math.ntnu.no> writes:

> In Mail.app on Mac OS X, open Preferences -> General, and select Emacs
> as the the default email reader.
> Quit Mail.app and never use it again. 8-)
>
> Now click on a mailto: link in your favourite web browser, or else run
> a command like this:  open mailto:nobody <at> example.com
>
> Notice that Emacs comes to the foreground, but nothing more happens.
> What SHOULD happen is that Emacs opens a new draft email message
> addressed to the named recipient.

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This behaviour is still present in Emacs 29.  I.e., it just foregrounds
the Emacs frame, and then nothing else.

Yamamoto said:

> What Carbon or Cocoa applications receive is an Apple event:
> 
>   http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/chapter_11_section_4.html
> 
> Core functionalities such as "open documents" and "quit application"
> also send some corresponding Apple events, and Cocoa applications
> usually handle them via some application delegate methods.
> 
>   http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/chapter_11_section_3.html

So I guess we're just not handling that event?  It'd be cool if we
could; adding Alan to the CCs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




This bug report was last modified 3 years and 190 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.