unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#1367: #1367 - 23.0.60; Mailto service won't work - Emacs bug report logs
@ 2008-11-21 21:00 Adrian Robert
  2008-11-22  1:36 ` YAMAMOTO Mitsuharu
  0 siblings, 1 reply; 3+ messages in thread
From: Adrian Robert @ 2008-11-21 21:00 UTC (permalink / raw)
  To: 1367; +Cc: Harald Hanche-Olsen

Hello,

> I have set the mailto handler to be emacs. If I run the command open mailto:joe.the-plumber@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







^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#1367: #1367 - 23.0.60; Mailto service won't work - Emacs bug report logs
  2008-11-21 21:00 bug#1367: #1367 - 23.0.60; Mailto service won't work - Emacs bug report logs Adrian Robert
@ 2008-11-22  1:36 ` YAMAMOTO Mitsuharu
  2008-11-22  2:51   ` Adrian Robert
  0 siblings, 1 reply; 3+ messages in thread
From: YAMAMOTO Mitsuharu @ 2008-11-22  1:36 UTC (permalink / raw)
  To: Adrian Robert, 1367; +Cc: Harald Hanche-Olsen

>>>>> On Fri, 21 Nov 2008 16:00:47 -0500, Adrian Robert <adrian.b.robert@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@math.s.chiba-u.ac.jp






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#1367: #1367 - 23.0.60; Mailto service won't work - Emacs bug report logs
  2008-11-22  1:36 ` YAMAMOTO Mitsuharu
@ 2008-11-22  2:51   ` Adrian Robert
  0 siblings, 0 replies; 3+ messages in thread
From: Adrian Robert @ 2008-11-22  2:51 UTC (permalink / raw)
  To: YAMAMOTO Mitsuharu; +Cc: Harald Hanche-Olsen, 1367


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@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








^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-11-22  2:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-21 21:00 bug#1367: #1367 - 23.0.60; Mailto service won't work - Emacs bug report logs Adrian Robert
2008-11-22  1:36 ` YAMAMOTO Mitsuharu
2008-11-22  2:51   ` Adrian Robert

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).