<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[125828] trunk/dports/aqua/emacs-app</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/125828">125828</a></dd>
<dt>Author</dt> <dd>hum@macports.org</dd>
<dt>Date</dt> <dd>2014-09-27 01:23:49 -0700 (Sat, 27 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>emacs-app: update inline patch to rev.583.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdportsaquaemacsappPortfile">trunk/dports/aqua/emacs-app/Portfile</a></li>
<li><a href="#trunkdportsaquaemacsappfilespatchmacemacsjpinlinediff">trunk/dports/aqua/emacs-app/files/patch-macemacsjp-inline.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportsaquaemacsappPortfile"></a>
<div class="modfile"><h4>Modified: trunk/dports/aqua/emacs-app/Portfile (125827 => 125828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/aqua/emacs-app/Portfile        2014-09-27 05:48:29 UTC (rev 125827)
+++ trunk/dports/aqua/emacs-app/Portfile        2014-09-27 08:23:49 UTC (rev 125828)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> 
</span><span class="cx"> name                emacs-app
</span><span class="cx"> version             24.3
</span><del>-revision            4
</del><ins>+revision            5
</ins><span class="cx"> categories          aqua editors
</span><span class="cx"> maintainers         hum css openmaintainer
</span><span class="cx"> 
</span><span class="lines">@@ -70,7 +70,7 @@
</span><span class="cx">     # inline patch fetched from MacEmacsJP.
</span><span class="cx">     # patch-macemacsjp-inline.diff
</span><span class="cx">     # http://svn.sourceforge.jp/svnroot/macemacsjp/inline_patch/trunk/emacs-inline.patch
</span><del>-    # revision 582 (2012/05/20) modified for emacs-24.3.
</del><ins>+    # revision 583 (2013/04/13) modified for emacs-24.3.
</ins><span class="cx">     patchfiles-append   patch-macemacsjp-inline.diff
</span><span class="cx">     # http://sakito.jp/emacs/emacs24.html
</span><span class="cx">     depends_build-append port:autoconf port:automake port:libtool
</span></span></pre></div>
<a id="trunkdportsaquaemacsappfilespatchmacemacsjpinlinediff"></a>
<div class="modfile"><h4>Modified: trunk/dports/aqua/emacs-app/files/patch-macemacsjp-inline.diff (125827 => 125828)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/aqua/emacs-app/files/patch-macemacsjp-inline.diff        2014-09-27 05:48:29 UTC (rev 125827)
+++ trunk/dports/aqua/emacs-app/files/patch-macemacsjp-inline.diff        2014-09-27 08:23:49 UTC (rev 125828)
</span><span class="lines">@@ -1,540 +1,6 @@
</span><del>---- configure.orig        2013-03-08 17:13:36.000000000 +0900
-+++ configure        2013-03-12 00:01:16.000000000 +0900
-@@ -9650,7 +9650,7 @@
-      leimdir=&quot;\${ns_appresdir}/leim&quot;
-      INSTALL_ARCH_INDEP_EXTRA=
-   fi
--  NS_OBJC_OBJ=&quot;nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o&quot;
-+  NS_OBJC_OBJ=&quot;nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o&quot;
- fi
- CFLAGS=&quot;$tmp_CFLAGS&quot;
- CPPFLAGS=&quot;$tmp_CPPFLAGS&quot;
-@@ -24618,7 +24618,7 @@
-    ## 0x690 is the total size of 30 segment load commands (at 56
-    ## each); under Cocoa 31 commands are required.
-    if test &quot;$HAVE_NS&quot; = &quot;yes&quot;; then
--     libs_nsgui=&quot;-framework AppKit&quot;
-+     libs_nsgui=&quot;-framework AppKit -framework Carbon&quot;
-      headerpad_extra=6C8
-    else
-      libs_nsgui=
---- configure.ac.orig        2013-03-05 17:24:59.000000000 +0900
-+++ configure.ac        2013-03-12 00:01:01.000000000 +0900
-@@ -1571,7 +1571,7 @@
-      leimdir=&quot;\${ns_appresdir}/leim&quot;
-      INSTALL_ARCH_INDEP_EXTRA=
-   fi
--  NS_OBJC_OBJ=&quot;nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o&quot;
-+  NS_OBJC_OBJ=&quot;nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o&quot;
- fi
- CFLAGS=&quot;$tmp_CFLAGS&quot;
- CPPFLAGS=&quot;$tmp_CPPFLAGS&quot;
-@@ -4322,7 +4322,7 @@
-    ## 0x690 is the total size of 30 segment load commands (at 56
-    ## each); under Cocoa 31 commands are required.
-    if test &quot;$HAVE_NS&quot; = &quot;yes&quot;; then
--     libs_nsgui=&quot;-framework AppKit&quot;
-+     libs_nsgui=&quot;-framework AppKit -framework Carbon&quot;
-      headerpad_extra=6C8
-    else
-      libs_nsgui=
-diff -r -N -p ../emacs-24.0.96/src/Makefile.in src/Makefile.in
-*** ../emacs-24.0.96/src/Makefile.in        2012-04-08 12:03:02.000000000 +0900
---- src/Makefile.in        2012-05-03 22:23:59.000000000 +0900
-*************** obj = $(base_obj) $(NS_OBJC_OBJ)
-*** 350,356 ****
-  SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
-    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-    fontset.o dbusbind.o cygw32.o \
-!   nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
-    w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
-    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
-    w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
---- 350,356 ----
-  SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
-    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
-    fontset.o dbusbind.o cygw32.o \
-!   nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o\
-    w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
-    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
-    w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
-diff -r -N -p ../emacs-24.0.96/src/keyboard.c src/keyboard.c
-*** ../emacs-24.0.96/src/keyboard.c        2012-04-08 12:03:02.000000000 +0900
---- src/keyboard.c        2012-05-03 22:23:59.000000000 +0900
-*************** kbd_buffer_get_event (KBOARD **kbp,
-*** 3915,3922 ****
-          {
-            if (event-&gt;code == KEY_NS_PUT_WORKING_TEXT)
-              obj = Fcons (intern (&quot;ns-put-working-text&quot;), Qnil);
-!           else
-              obj = Fcons (intern (&quot;ns-unput-working-text&quot;), Qnil);
-            kbd_fetch_ptr = event + 1;
-            if (used_mouse_menu)
-              *used_mouse_menu = 1;
---- 3915,3924 ----
-          {
-            if (event-&gt;code == KEY_NS_PUT_WORKING_TEXT)
-              obj = Fcons (intern (&quot;ns-put-working-text&quot;), Qnil);
-!           else if (event-&gt;code == KEY_NS_UNPUT_WORKING_TEXT)
-              obj = Fcons (intern (&quot;ns-unput-working-text&quot;), Qnil);
-+           else if (event-&gt;code == KEY_NS_PUT_MARKED_TEXT)
-+             obj = Fcons (intern (&quot;ns-put-marked-text&quot;), event-&gt;arg);
-            kbd_fetch_ptr = event + 1;
-            if (used_mouse_menu)
-              *used_mouse_menu = 1;
-*************** keys_of_keyboard (void)
-*** 12332,12337 ****
---- 12334,12341 ----
-                              &quot;ns-put-working-text&quot;);
-    initial_define_lispy_key (Vspecial_event_map, &quot;ns-unput-working-text&quot;,
-                              &quot;ns-unput-working-text&quot;);
-+   initial_define_lispy_key (Vspecial_event_map, &quot;ns-put-marked-text&quot;,
-+                             &quot;ns-put-marked-text&quot;);
-    /* Here we used to use `ignore-event' which would simple set prefix-arg to
-       current-prefix-arg, as is done in `handle-switch-frame'.
-       But `handle-switch-frame is not run from the special-map.
-diff -r -N -p ../emacs-24.0.96/src/macim.m src/macim.m
-*** ../emacs-24.0.96/src/macim.m        1970-01-01 09:00:00.000000000 +0900
---- src/macim.m        2012-05-03 22:23:59.000000000 +0900
-***************
-*** 0 ****
---- 1,177 ----
-+ /* Implementation of Input Method Extension for MacOS X.
-+    Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-+    Taiichi Hashimoto &lt;taiichi2@mac.com&gt;.
-+ */
-+ 
-+ #include &quot;config.h&quot;
-+ 
-+ #ifdef NS_IMPL_COCOA
-+ 
-+ #include &lt;math.h&gt;
-+ #include &lt;sys/types.h&gt;
-+ #include &lt;time.h&gt;
-+ #include &lt;signal.h&gt;
-+ #include &lt;unistd.h&gt;
-+ 
-+ #include &lt;Carbon/Carbon.h&gt;
-+ 
-+ #include &quot;lisp.h&quot;
-+ #include &quot;blockinput.h&quot;
-+ 
-+ enum output_method
-+ {
-+   output_initial,
-+   output_termcap,
-+   output_x_window,
-+   output_msdos_raw,
-+   output_w32,
-+   output_mac,
-+   output_ns
-+ } output_method;
-+ 
-+ #include &quot;termhooks.h&quot;
-+ #include &quot;keyboard.h&quot;
-+ #include &quot;buffer.h&quot;
-+ 
-+ //extern Lisp_Object Qcurrent_input_method;
-+ //extern int cursor_in_echo_area;
-+ static Lisp_Object Qmac_keys_passed_to_system;
-+ 
-+ void mac_init_input_method ();
-+ int mac_pass_key_to_system (int code, int modifiers);
-+ int mac_pass_key_directly_to_emacs ();
-+ int mac_store_change_input_method_event ();
-+ 
-+ DEFUN (&quot;mac-input-source-is-ascii-capable&quot;, Fmac_input_source_is_ascii_capable, Smac_input_source_is_ascii_capable,
-+        0, 0, 0,
-+        doc: /* Is current input source ascii capable? */)
-+      (void)
-+ {
-+   TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
-+   CFBooleanRef ret = TISGetInputSourceProperty(is, kTISPropertyInputSourceIsASCIICapable);
-+   
-+   return CFBooleanGetValue(ret)? Qt : Qnil;
-+ }
-+ 
-+ DEFUN (&quot;mac-get-input-source-list&quot;, Fmac_get_input_source_list, Smac_get_input_source_list,
-+        0, 0, 0,
-+        doc: /* get input source list on MacOSX */)
-+      (void)
-+ {
-+   NSArray *is_list = (NSArray *)TISCreateInputSourceList(NULL, false);
-+   int list_size = [is_list count];
-+   Lisp_Object list[list_size];
-+   int i;
-+ 
-+   for (i = 0; i &lt; list_size; i++) {
-+     TISInputSourceRef is = (TISInputSourceRef)[is_list objectAtIndex:i];
-+     NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
-+     list[i] = make_string([id UTF8String],
-+                           [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
-+   }
-+ 
-+   return Flist(list_size, list);
-+ }
-+ 
-+ DEFUN (&quot;mac-get-current-input-source&quot;, Fmac_get_current_input_source, Smac_get_current_input_source,
-+        0, 0, 0,
-+        doc: /* get current input source on MacOSX */)
-+      (void)
-+ {
-+   TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
-+   NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
-+ 
-+   return make_string([id UTF8String],
-+                      [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
-+ }
-+ 
-+ DEFUN (&quot;mac-toggle-input-source&quot;, Fmac_toggle_input_source, Smac_toggle_input_source,
-+        1, 1, 0,
-+        doc: /* toggle input source on MacOSX */)
-+      (arg)
-+      Lisp_Object arg;
-+ {
-+   TISInputSourceRef is = NULL;
-+ 
-+   if (NILP (arg))
-+     {
-+       is = TISCopyCurrentASCIICapableKeyboardInputSource();
-+     }
-+   else
-+     {
-+       NSString *locale = [[NSLocale currentLocale] localeIdentifier];
-+       is = TISCopyInputSourceForLanguage((CFStringRef)locale);
-+     }
-+   if (is) TISSelectInputSource(is);
-+ 
-+   return arg;
-+ }
-+ 
-+ int
-+ mac_store_change_input_method_event ()
-+ {
-+   Lisp_Object dim;
-+   int ret = FALSE;
-+   
-+   dim = Fsymbol_value (intern (&quot;default-input-method&quot;));
-+   if (STRINGP (dim) &amp;&amp; strcmp(SDATA (dim), &quot;MacOSX&quot;) == 0)
-+     {
-+       ret = TRUE;
-+     }
-+ 
-+   return ret;
-+ }
-+ 
-+ int
-+ mac_pass_key_to_system (int code, int modifiers)
-+ {
-+   Lisp_Object keys = Fsymbol_value (Qmac_keys_passed_to_system);
-+   Lisp_Object m, k; 
-+ 
-+   while (!NILP (keys))
-+     {
-+       m = XCAR (XCAR (keys));
-+       k = XCDR (XCAR (keys));
-+       keys = XCDR (keys);
-+ 
-+       if (NUMBERP (m) &amp;&amp; modifiers == XINT (m))
-+         if (NILP (k)
-+             || (NUMBERP (k) &amp;&amp; code == XINT (k)))
-+           return TRUE;
-+     }
-+   
-+   return FALSE;
-+ }
-+ 
-+ int
-+ mac_pass_key_directly_to_emacs (void)
-+ {
-+ 
-+   if (NILP (Fmac_input_source_is_ascii_capable()))
-+     {
-+       if (NILP (Vmac_use_input_method_on_system)
-+           || this_command_key_count 
-+           || cursor_in_echo_area 
-+           || !NILP (BVAR (current_buffer, read_only)))
-+         return TRUE;
-+     }
-+ 
-+   return FALSE;
-+ }
-+ 
-+ 
-+ void mac_init_input_method (void)
-+ {
-+   Qmac_keys_passed_to_system = intern (&quot;mac-keys-passed-to-system&quot;);
-+   staticpro (&amp;Qmac_keys_passed_to_system);
-+ 
-+   DEFVAR_LISP (&quot;mac-use-input-method-on-system&quot;, Vmac_use_input_method_on_system,
-+                doc: /* If it is non-nil, use input method on system. */);
-+   Vmac_use_input_method_on_system = Qt;
-+ 
-+   defsubr (&amp;Smac_input_source_is_ascii_capable);
-+   defsubr (&amp;Smac_get_input_source_list);
-+   defsubr (&amp;Smac_get_current_input_source);
-+   defsubr (&amp;Smac_toggle_input_source);
-+ }
-+ #endif
-diff -r -N -p ../emacs-24.0.96/src/nsfns.m src/nsfns.m
-*** ../emacs-24.0.96/src/nsfns.m        2012-04-08 12:03:02.000000000 +0900
---- src/nsfns.m        2012-05-04 00:05:24.000000000 +0900
-*************** static ptrdiff_t image_cache_refcount;
-*** 111,117 ****
-  
-     ========================================================================== */
-  
-- 
-  void
-  check_ns (void)
-  {
---- 111,116 ----
-*************** be used as the image of the icon represe
-*** 2722,2727 ****
---- 2721,2744 ----
-                 doc: /* Toolkit version for NS Windowing.  */);
-    Vns_version_string = ns_appkit_version_str ();
-  
-+ 
-+   DEFVAR_LISP (&quot;ns-shift-key-mask&quot;, Vns_shift_key_mask,
-+                doc: /* Shift key mask defined in system. */);
-+   Vns_shift_key_mask = make_number (NSShiftKeyMask);
-+ 
-+   DEFVAR_LISP (&quot;ns-control-key-mask&quot;, Vns_control_key_mask,
-+                doc: /* Control key mask defined in system. */);
-+   Vns_control_key_mask = make_number (NSControlKeyMask);
-+ 
-+   DEFVAR_LISP (&quot;ns-alternate-key-mask&quot;, Vns_alternate_key_mask,
-+                doc: /* Alternate key mask defined in system. */);
-+   Vns_alternate_key_mask = make_number (NSAlternateKeyMask);
-+ 
-+   DEFVAR_LISP (&quot;ns-command-key-mask&quot;, Vns_command_key_mask,
-+                doc: /* Command key mask defined in system. */);
-+   Vns_command_key_mask = make_number (NSCommandKeyMask);
-+ 
-+ 
-    defsubr (&amp;Sns_read_file_name);
-    defsubr (&amp;Sns_get_resource);
-    defsubr (&amp;Sns_set_resource);
-*************** be used as the image of the icon represe
-*** 2766,2771 ****
---- 2783,2792 ----
-    defsubr (&amp;Sx_show_tip);
-    defsubr (&amp;Sx_hide_tip);
-  
-+ #ifdef NS_IMPL_COCOA
-+   mac_init_input_method ();
-+ #endif
-+ 
-    /* used only in fontset.c */
-    check_window_system_func = check_ns;
-  
-diff -r -N -p ../emacs-24.0.96/src/nsterm.h src/nsterm.h
-*** ../emacs-24.0.96/src/nsterm.h        2012-04-08 12:03:02.000000000 +0900
---- src/nsterm.h        2012-05-03 22:23:59.000000000 +0900
-*************** typedef unsigned int NSUInteger;
-*** 398,403 ****
---- 398,405 ----
-  #define KEY_NS_NEW_FRAME               ((1&lt;&lt;28)|(0&lt;&lt;16)|12)
-  #define KEY_NS_TOGGLE_TOOLBAR          ((1&lt;&lt;28)|(0&lt;&lt;16)|13)
-  #define KEY_NS_SHOW_PREFS              ((1&lt;&lt;28)|(0&lt;&lt;16)|14)
-+ #define KEY_MAC_CHANGE_INPUT_METHOD    ((1&lt;&lt;28)|(0&lt;&lt;16)|15)
-+ #define KEY_NS_PUT_MARKED_TEXT         ((1&lt;&lt;28)|(0&lt;&lt;16)|16)
-  
-  /* could use list to store these, but rest of emacs has a big infrastructure
-     for managing a table of bitmap &quot;records&quot; */
-diff -r -N -p ../emacs-24.0.96/src/nsterm.m src/nsterm.m
-*** ../emacs-24.0.96/src/nsterm.m        2012-04-09 22:08:55.000000000 +0900
---- src/nsterm.m        2012-05-04 00:12:13.000000000 +0900
-*************** ns_term_init (Lisp_Object display_name)
-*** 4040,4045 ****
---- 4040,4048 ----
-    /*   [[NSNotificationCenter defaultCenter] addObserver: NSApp
-                                           selector: @selector (logNotification:)
-                                               name: nil object: nil]; */
-+   [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
-+                                         selector: @selector (changeInputMethod:)
-+                                                    name: @&quot;AppleSelectedInputSourcesChangedNotification&quot; object: nil];
-  
-    dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
-    memset (dpyinfo, 0, sizeof (struct ns_display_info));
-*************** ns_term_shutdown (int sig)
-*** 4255,4260 ****
---- 4258,4276 ----
-      NSLog (@&quot;notification: '%@'&quot;, [notification name]);
-  }
-  
-+ - (void)changeInputMethod: (NSNotification *)notification
-+ {
-+ 
-+   struct frame *emacsframe = SELECTED_FRAME ();
-+ 
-+   if (mac_store_change_input_method_event())
-+     {
-+       emacs_event-&gt;kind = NS_NONKEY_EVENT;
-+       emacs_event-&gt;code = KEY_MAC_CHANGE_INPUT_METHOD;
-+       emacs_event-&gt;modifiers = 0;
-+       EV_TRAILER ((id)nil);
-+     }
-+ }
-  
-  - (void)sendEvent: (NSEvent *)theEvent
-  /* --------------------------------------------------------------------------
-*************** ns_term_shutdown (int sig)
-*** 4857,4863 ****
-               code, fnKeysym, flags, emacs_event-&gt;modifiers);
-  
-        /* if it was a function key or had modifiers, pass it directly to emacs */
-!       if (fnKeysym || (emacs_event-&gt;modifiers
-                         &amp;&amp; (emacs_event-&gt;modifiers != shift_modifier)
-                         &amp;&amp; [[theEvent charactersIgnoringModifiers] length] &gt; 0))
-  /*[[theEvent characters] length] */
---- 4872,4879 ----
-               code, fnKeysym, flags, emacs_event-&gt;modifiers);
-  
-        /* if it was a function key or had modifiers, pass it directly to emacs */
-!       if (mac_pass_key_directly_to_emacs ()
-!           ||fnKeysym || (emacs_event-&gt;modifiers
-                         &amp;&amp; (emacs_event-&gt;modifiers != shift_modifier)
-                         &amp;&amp; [[theEvent charactersIgnoringModifiers] length] &gt; 0))
-  /*[[theEvent characters] length] */
-*************** ns_term_shutdown (int sig)
-*** 4872,4879 ****
-                ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
-  
-            emacs_event-&gt;code = code;
-!           EV_TRAILER (theEvent);
-!           return;
-          }
-      }
-  
---- 4888,4905 ----
-                ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
-  
-            emacs_event-&gt;code = code;
-!           /* The function mac_pass_key_to_system decides 
-!              whether it is passed directly to emacs or not. */
-!           if (emacs_event-&gt;kind == NON_ASCII_KEYSTROKE_EVENT
-!               || !mac_pass_key_to_system (code, flags
-!                                           &amp; (NSShiftKeyMask
-!                                              | NSControlKeyMask
-!                                              | NSAlternateKeyMask
-!                                              | NSCommandKeyMask)))
-!             {
-!               EV_TRAILER (theEvent);
-!               return;
-!             }
-          }
-      }
-  
-*************** ns_term_shutdown (int sig)
-*** 4966,4975 ****
-      NSLog (@&quot;setMarkedText '%@' len =%d range %d from %d&quot;, str, [str length],
-             selRange.length, selRange.location);
-  
--   if (workingText != nil)
--     [self deleteWorkingText];
-    if ([str length] == 0)
-!     return;
-  
-    if (!emacs_event)
-      return;
---- 4992,5010 ----
-      NSLog (@&quot;setMarkedText '%@' len =%d range %d from %d&quot;, str, [str length],
-             selRange.length, selRange.location);
-  
-    if ([str length] == 0)
-!     {
-!       [self deleteWorkingText];
-!       return;
-!     }
-!   else
-!     {
-!       if (workingText != nil) {
-!         [workingText release];
-!         workingText = nil;
-!         processingCompose = NO;
-!       }
-!     }
-  
-    if (!emacs_event)
-      return;
-*************** ns_term_shutdown (int sig)
-*** 4979,4985 ****
-    ns_working_text = build_string ([workingText UTF8String]);
-  
-    emacs_event-&gt;kind = NS_TEXT_EVENT;
-!   emacs_event-&gt;code = KEY_NS_PUT_WORKING_TEXT;
-    EV_TRAILER ((id)nil);
-  }
-  
---- 5014,5022 ----
-    ns_working_text = build_string ([workingText UTF8String]);
-  
-    emacs_event-&gt;kind = NS_TEXT_EVENT;
-!   emacs_event-&gt;code = KEY_NS_PUT_MARKED_TEXT;
-!   emacs_event-&gt;arg = Fcons (make_number (selRange.location),
-!                             Fcons (make_number (selRange.length), Qnil));
-    EV_TRAILER ((id)nil);
-  }
-  
-*************** ns_term_shutdown (int sig)
-*** 5034,5048 ****
-  {
-    NSRect rect;
-    NSPoint pt;
-!   struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
-    if (NS_KEYLOG)
-      NSLog (@&quot;firstRectForCharRange request&quot;);
-  
-    rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
-    rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
-    pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win-&gt;phys_cursor.x);
-    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win-&gt;phys_cursor.y
-!                                        +FRAME_LINE_HEIGHT (emacsframe));
-  
-    pt = [self convertPoint: pt toView: nil];
-    pt = [[self window] convertBaseToScreen: pt];
---- 5071,5093 ----
-  {
-    NSRect rect;
-    NSPoint pt;
-!   //  struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
-!   struct window *win;
-    if (NS_KEYLOG)
-      NSLog (@&quot;firstRectForCharRange request&quot;);
-+     
-+   if (NILP (Vmac_in_echo_area))
-+     win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
-+     else if (WINDOWP (echo_area_window))
-+     win = XWINDOW (echo_area_window);
-+   else
-+     win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
-  
-    rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
-    rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
-    pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win-&gt;phys_cursor.x);
-    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win-&gt;phys_cursor.y
-!                                        +FRAME_LINE_HEIGHT (emacsframe)+2);
-  
-    pt = [self convertPoint: pt toView: nil];
-    pt = [[self window] convertBaseToScreen: pt];
-*************** variable `x-use-underline-position-prope
-*** 6764,6769 ****
---- 6809,6818 ----
-  baseline level.  The default value is nil.  */);
-    x_underline_at_descent_line = 0;
-  
-+   DEFVAR_LISP (&quot;mac-in-echo-area&quot;, Vmac_in_echo_area,
-+                doc: /* state of cursor in echo area. */);
-+   Vmac_in_echo_area = Qnil;
-+ 
-    /* Tell emacs about this window system. */
-    Fprovide (intern (&quot;ns&quot;), Qnil);
-  }
-diff -r -N -p ../emacs-24.0.96/lisp/term/common-win.el lisp/term/common-win.el
-*** ../emacs-24.0.96/lisp/term/common-win.el        2012-04-08 12:03:02.000000000 +0900
---- lisp/term/common-win.el        2012-05-03 22:23:59.000000000 +0900
</del><ins>+diff -r -N -p -x '*.elc' ../emacs-24.3.org/lisp/term/common-win.el lisp/term/common-win.el
+*** ../emacs-24.3.org/lisp/term/common-win.el        2013-01-02 05:37:17.000000000 +0900
+--- lisp/term/common-win.el        2013-04-13 21:49:53.000000000 +0900
</ins><span class="cx"> *************** is not used).&quot;
</span><span class="cx"> *** 127,132 ****
</span><span class="cx"> --- 127,133 ----
</span><span class="lines">@@ -545,12 +11,12 @@
</span><span class="cx">                  ))))
</span><span class="cx">       (set-terminal-parameter frame 'x-setup-function-keys t)))
</span><span class="cx">   
</span><del>-diff -r -N -p ../emacs-24.0.96/lisp/term/ns-win.el lisp/term/ns-win.el
-*** ../emacs-24.0.96/lisp/term/ns-win.el        2012-04-08 12:03:02.000000000 +0900
---- lisp/term/ns-win.el        2012-05-03 23:57:14.000000000 +0900
</del><ins>+diff -r -N -p -x '*.elc' ../emacs-24.3.org/lisp/term/ns-win.el lisp/term/ns-win.el
+*** ../emacs-24.3.org/lisp/term/ns-win.el        2013-01-02 05:37:17.000000000 +0900
+--- lisp/term/ns-win.el        2013-04-13 21:50:48.000000000 +0900
</ins><span class="cx"> *************** The properties returned may include `top
</span><del>-*** 173,178 ****
---- 173,179 ----
</del><ins>+*** 171,176 ****
+--- 171,177 ----
</ins><span class="cx">   (define-key global-map [ns-new-frame] 'make-frame)
</span><span class="cx">   (define-key global-map [ns-toggle-toolbar] 'ns-toggle-toolbar)
</span><span class="cx">   (define-key global-map [ns-show-prefs] 'customize)
</span><span class="lines">@@ -559,7 +25,7 @@
</span><span class="cx">   
</span><span class="cx">   ;; Set up a number of aliases and other layers to pretend we're using
</span><span class="cx"> *************** The properties returned may include `top
</span><del>-*** 259,272 ****
</del><ins>+*** 256,269 ****
</ins><span class="cx">   ;; editing window.)
</span><span class="cx">   
</span><span class="cx">   (defface ns-working-text-face
</span><span class="lines">@@ -574,7 +40,7 @@
</span><span class="cx">   (defvar ns-working-text)                 nsterm.m
</span><span class="cx">   
</span><span class="cx">   ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
</span><del>---- 260,289 ----
</del><ins>+--- 257,286 ----
</ins><span class="cx">   ;; editing window.)
</span><span class="cx">   
</span><span class="cx">   (defface ns-working-text-face
</span><span class="lines">@@ -606,7 +72,7 @@
</span><span class="cx">   
</span><span class="cx">   ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
</span><span class="cx"> *************** When text is in th echo area, this just 
</span><del>-*** 274,290 ****
</del><ins>+*** 271,287 ****
</ins><span class="cx">   (defun ns-in-echo-area ()
</span><span class="cx">     &quot;Whether, for purposes of inserting working composition text, the minibuffer
</span><span class="cx">   is currently being used.&quot;
</span><span class="lines">@@ -624,7 +90,7 @@
</span><span class="cx">   
</span><span class="cx">   ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
</span><span class="cx">   ;; always returns nil for some reason.  If this WASN'T the case, we could
</span><del>---- 291,309 ----
</del><ins>+--- 288,306 ----
</ins><span class="cx">   (defun ns-in-echo-area ()
</span><span class="cx">     &quot;Whether, for purposes of inserting working composition text, the minibuffer
</span><span class="cx">   is currently being used.&quot;
</span><span class="lines">@@ -645,8 +111,8 @@
</span><span class="cx">   ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
</span><span class="cx">   ;; always returns nil for some reason.  If this WASN'T the case, we could
</span><span class="cx"> *************** is currently being used.&quot;
</span><del>-*** 293,298 ****
---- 312,318 ----
</del><ins>+*** 290,295 ****
+--- 309,315 ----
</ins><span class="cx">   (defun ns-put-working-text ()
</span><span class="cx">     (interactive)
</span><span class="cx">     (if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text)))
</span><span class="lines">@@ -655,7 +121,7 @@
</span><span class="cx">     (interactive)
</span><span class="cx">     (ns-delete-working-text))
</span><span class="cx"> *************** The overlay is assigned the face `ns-wor
</span><del>-*** 314,332 ****
</del><ins>+*** 311,329 ****
</ins><span class="cx">   (defun ns-echo-working-text ()
</span><span class="cx">     &quot;Echo contents of `ns-working-text' in message display area.
</span><span class="cx">   See `ns-insert-working-text'.&quot;
</span><span class="lines">@@ -675,7 +141,7 @@
</span><span class="cx">     (cond
</span><span class="cx">      ((and (overlayp ns-working-overlay)
</span><span class="cx">            ;; Still alive?
</span><del>---- 334,414 ----
</del><ins>+--- 331,411 ----
</ins><span class="cx">   (defun ns-echo-working-text ()
</span><span class="cx">     &quot;Echo contents of `ns-working-text' in message display area.
</span><span class="cx">   See `ns-insert-working-text'.&quot;
</span><span class="lines">@@ -758,8 +224,8 @@
</span><span class="cx">      ((and (overlayp ns-working-overlay)
</span><span class="cx">            ;; Still alive?
</span><span class="cx"> *************** See the documentation of `create-fontset
</span><del>-*** 931,936 ****
---- 1013,1438 ----
</del><ins>+*** 943,948 ****
+--- 1025,1490 ----
</ins><span class="cx">   (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
</span><span class="cx">   
</span><span class="cx">   
</span><span class="lines">@@ -923,6 +389,26 @@
</span><span class="cx"> +      (title . &quot;C&quot;)
</span><span class="cx"> +      (cursor-color)
</span><span class="cx"> +      (cursor-type))
</span><ins>++     (&quot;com.justsystems.inputmethod.atok21.Roman&quot;
++      (title . &quot;A&quot;)
++      (cursor-color)
++      (cursor-type))
++     (&quot;com.justsystems.inputmethod.atok21.Japanese&quot;
++      (title . &quot;あ&quot;)
++      (cursor-color)
++      (cursor-type))
++     (&quot;com.justsystems.inputmethod.atok21.Japanese.Katakana&quot;
++      (title . &quot;ア&quot;)
++      (cursor-color)
++      (cursor-type))
++     (&quot;com.justsystems.inputmethod.atok21.Japanese.FullWidthRoman&quot;
++      (title . &quot;英&quot;)
++      (cursor-color)
++      (cursor-type))
++     (&quot;com.justsystems.inputmethod.atok21.Japanese.HalfWidthEiji&quot;
++      (title . &quot;半英&quot;)
++      (cursor-color)
++      (cursor-type))
</ins><span class="cx"> +     (&quot;com.justsystems.inputmethod.atok22.Roman&quot;
</span><span class="cx"> +      (title . &quot;A&quot;)
</span><span class="cx"> +      (cursor-color)
</span><span class="lines">@@ -983,6 +469,26 @@
</span><span class="cx"> +      (title . &quot;半英&quot;)
</span><span class="cx"> +      (cursor-color)
</span><span class="cx"> +      (cursor-type))
</span><ins>++     (&quot;com.justsystems.inputmethod.atok25.Roman&quot;
++      (title . &quot;A&quot;)
++      (cursor-color)
++      (cursor-type))
++     (&quot;com.justsystems.inputmethod.atok25.Japanese&quot;
++      (title . &quot;あ&quot;)
++      (cursor-color)
++      (cursor-type))
++     (&quot;com.justsystems.inputmethod.atok25.Japanese.Katakana&quot;
++      (title . &quot;ア&quot;)
++      (cursor-color)
++      (cursor-type))
++     (&quot;com.justsystems.inputmethod.atok25.Japanese.FullWidthRoman&quot;
++      (title . &quot;英&quot;)
++      (cursor-color)
++      (cursor-type))
++     (&quot;com.justsystems.inputmethod.atok25.Japanese.HalfWidthEiji&quot;
++      (title . &quot;半英&quot;)
++      (cursor-color)
++      (cursor-type))
</ins><span class="cx"> +     )
</span><span class="cx"> +   &quot;Alist of Mac script code vs parameters for input method on MacOSX.&quot;)
</span><span class="cx"> + 
</span><span class="lines">@@ -1186,4 +692,578 @@
</span><span class="cx">   (provide 'ns-win)
</span><span class="cx">   
</span><span class="cx">   ;;; ns-win.el ends here
</span><del>-
</del><ins>+diff -r -N -p ../emacs-24.3.org/src/Makefile.in src/Makefile.in
+*** ../emacs-24.3.org/src/Makefile.in        2013-01-02 05:37:17.000000000 +0900
+--- src/Makefile.in        2013-04-13 21:49:53.000000000 +0900
+*************** obj = $(base_obj) $(NS_OBJC_OBJ)
+*** 356,362 ****
+  SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
+    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
+    fontset.o dbusbind.o cygw32.o \
+!   nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
+    w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
+    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
+    w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
+--- 356,362 ----
+  SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
+    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
+    fontset.o dbusbind.o cygw32.o \
+!   nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o \
+    w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
+    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
+    w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
+diff -r -N -p ../emacs-24.3.org/src/keyboard.c src/keyboard.c
+*** ../emacs-24.3.org/src/keyboard.c        2013-02-13 13:25:53.000000000 +0900
+--- src/keyboard.c        2013-04-13 21:49:53.000000000 +0900
+*************** kbd_buffer_get_event (KBOARD **kbp,
+*** 3862,3869 ****
+          {
+            if (event-&gt;code == KEY_NS_PUT_WORKING_TEXT)
+              obj = Fcons (intern (&quot;ns-put-working-text&quot;), Qnil);
+!           else
+              obj = Fcons (intern (&quot;ns-unput-working-text&quot;), Qnil);
+            kbd_fetch_ptr = event + 1;
+            if (used_mouse_menu)
+              *used_mouse_menu = 1;
+--- 3862,3871 ----
+          {
+            if (event-&gt;code == KEY_NS_PUT_WORKING_TEXT)
+              obj = Fcons (intern (&quot;ns-put-working-text&quot;), Qnil);
+!           else if (event-&gt;code == KEY_NS_UNPUT_WORKING_TEXT)
+              obj = Fcons (intern (&quot;ns-unput-working-text&quot;), Qnil);
++           else if (event-&gt;code == KEY_NS_PUT_MARKED_TEXT)
++             obj = Fcons (intern (&quot;ns-put-marked-text&quot;), event-&gt;arg);
+            kbd_fetch_ptr = event + 1;
+            if (used_mouse_menu)
+              *used_mouse_menu = 1;
+*************** keys_of_keyboard (void)
+*** 12088,12093 ****
+--- 12090,12097 ----
+                              &quot;ns-put-working-text&quot;);
+    initial_define_lispy_key (Vspecial_event_map, &quot;ns-unput-working-text&quot;,
+                              &quot;ns-unput-working-text&quot;);
++   initial_define_lispy_key (Vspecial_event_map, &quot;ns-put-marked-text&quot;,
++                             &quot;ns-put-marked-text&quot;);
+    /* Here we used to use `ignore-event' which would simple set prefix-arg to
+       current-prefix-arg, as is done in `handle-switch-frame'.
+       But `handle-switch-frame is not run from the special-map.
+diff -r -N -p ../emacs-24.3.org/src/macim.m src/macim.m
+*** ../emacs-24.3.org/src/macim.m        1970-01-01 09:00:00.000000000 +0900
+--- src/macim.m        2013-04-13 21:50:24.000000000 +0900
+***************
+*** 0 ****
+--- 1,184 ----
++ /* Implementation of Input Method Extension for MacOS X.
++    Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
++    Taiichi Hashimoto &lt;taiichi2@mac.com&gt;.
++ */
++ 
++ #include &quot;config.h&quot;
++ 
++ #ifdef NS_IMPL_COCOA
++ 
++ #include &lt;math.h&gt;
++ #include &lt;sys/types.h&gt;
++ #include &lt;time.h&gt;
++ #include &lt;signal.h&gt;
++ #include &lt;unistd.h&gt;
++ 
++ #include &lt;Carbon/Carbon.h&gt;
++ 
++ #include &quot;lisp.h&quot;
++ #include &quot;blockinput.h&quot;
++ 
++ enum output_method
++ {
++   output_initial,
++   output_termcap,
++   output_x_window,
++   output_msdos_raw,
++   output_w32,
++   output_mac,
++   output_ns
++ } output_method;
++ 
++ #include &quot;termhooks.h&quot;
++ #include &quot;keyboard.h&quot;
++ #include &quot;buffer.h&quot;
++ 
++ //extern Lisp_Object Qcurrent_input_method;
++ //extern int cursor_in_echo_area;
++ static Lisp_Object Qmac_keys_passed_to_system;
++ 
++ void mac_init_input_method ();
++ int mac_pass_key_to_system (int code, int modifiers);
++ int mac_pass_key_directly_to_emacs ();
++ int mac_store_change_input_method_event ();
++ 
++ DEFUN (&quot;mac-input-source-is-ascii-capable&quot;, Fmac_input_source_is_ascii_capable, Smac_input_source_is_ascii_capable,
++        0, 0, 0,
++        doc: /* Is current input source ascii capable? */)
++      (void)
++ {
++   TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
++   CFBooleanRef ret = TISGetInputSourceProperty(is, kTISPropertyInputSourceIsASCIICapable);
++   
++   return CFBooleanGetValue(ret)? Qt : Qnil;
++ }
++ 
++ DEFUN (&quot;mac-get-input-source-list&quot;, Fmac_get_input_source_list, Smac_get_input_source_list,
++        0, 0, 0,
++        doc: /* get input source list on MacOSX */)
++      (void)
++ {
++   NSArray *is_list = (NSArray *)TISCreateInputSourceList(NULL, false);
++   int list_size = [is_list count];
++   Lisp_Object list[list_size];
++   int i;
++ 
++   for (i = 0; i &lt; list_size; i++) {
++     TISInputSourceRef is = (TISInputSourceRef)[is_list objectAtIndex:i];
++     NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
++     list[i] = make_string([id UTF8String],
++                           [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
++   }
++ 
++   return Flist(list_size, list);
++ }
++ 
++ DEFUN (&quot;mac-get-current-input-source&quot;, Fmac_get_current_input_source, Smac_get_current_input_source,
++        0, 0, 0,
++        doc: /* get current input source on MacOSX */)
++      (void)
++ {
++   TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
++   NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
++ 
++   return make_string([id UTF8String],
++                      [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
++ }
++ 
++ DEFUN (&quot;mac-toggle-input-source&quot;, Fmac_toggle_input_source, Smac_toggle_input_source,
++        1, 1, 0,
++        doc: /* toggle input source on MacOSX */)
++      (arg)
++      Lisp_Object arg;
++ {
++   TISInputSourceRef is = NULL;
++ 
++   if (NILP (arg))
++     {
++       is = TISCopyCurrentASCIICapableKeyboardInputSource();
++     }
++   else
++     {
++       NSString *locale;
++       NSArray *languages = [NSLocale preferredLanguages];
++       if (languages != nil) {
++           locale = [languages objectAtIndex:0];
++       } else {
++           locale = [[NSLocale currentLocale]
++                           objectForKey:NSLocaleLanguageCode];
++       }
++       is = TISCopyInputSourceForLanguage((CFStringRef)locale);
++     }
++   if (is) TISSelectInputSource(is);
++ 
++   return arg;
++ }
++ 
++ int
++ mac_store_change_input_method_event ()
++ {
++   Lisp_Object dim;
++   int ret = FALSE;
++   
++   dim = Fsymbol_value (intern (&quot;default-input-method&quot;));
++   if (STRINGP (dim) &amp;&amp; strcmp(SDATA (dim), &quot;MacOSX&quot;) == 0)
++     {
++       ret = TRUE;
++     }
++ 
++   return ret;
++ }
++ 
++ int
++ mac_pass_key_to_system (int code, int modifiers)
++ {
++   Lisp_Object keys = Fsymbol_value (Qmac_keys_passed_to_system);
++   Lisp_Object m, k; 
++ 
++   while (!NILP (keys))
++     {
++       m = XCAR (XCAR (keys));
++       k = XCDR (XCAR (keys));
++       keys = XCDR (keys);
++ 
++       if (NUMBERP (m) &amp;&amp; modifiers == XINT (m))
++         if (NILP (k)
++             || (NUMBERP (k) &amp;&amp; code == XINT (k)))
++           return TRUE;
++     }
++   
++   return FALSE;
++ }
++ 
++ int
++ mac_pass_key_directly_to_emacs (void)
++ {
++ 
++   if (NILP (Fmac_input_source_is_ascii_capable()))
++     {
++       if (NILP (Vmac_use_input_method_on_system)
++           || this_command_key_count 
++           || cursor_in_echo_area 
++           || !NILP (BVAR (current_buffer, read_only)))
++         return TRUE;
++     }
++ 
++   return FALSE;
++ }
++ 
++ 
++ void mac_init_input_method (void)
++ {
++   Qmac_keys_passed_to_system = intern (&quot;mac-keys-passed-to-system&quot;);
++   staticpro (&amp;Qmac_keys_passed_to_system);
++ 
++   DEFVAR_LISP (&quot;mac-use-input-method-on-system&quot;, Vmac_use_input_method_on_system,
++                doc: /* If it is non-nil, use input method on system. */);
++   Vmac_use_input_method_on_system = Qt;
++ 
++   defsubr (&amp;Smac_input_source_is_ascii_capable);
++   defsubr (&amp;Smac_get_input_source_list);
++   defsubr (&amp;Smac_get_current_input_source);
++   defsubr (&amp;Smac_toggle_input_source);
++ }
++ #endif
+diff -r -N -p ../emacs-24.3.org/src/nsfns.m src/nsfns.m
+*** ../emacs-24.3.org/src/nsfns.m        2013-01-02 05:37:17.000000000 +0900
+--- src/nsfns.m        2013-04-13 21:49:53.000000000 +0900
+*************** static ptrdiff_t image_cache_refcount;
+*** 107,113 ****
+  
+     ========================================================================== */
+  
+- 
+  void
+  check_ns (void)
+  {
+--- 107,112 ----
+*************** be used as the image of the icon represe
+*** 2702,2707 ****
+--- 2701,2724 ----
+                 doc: /* Toolkit version for NS Windowing.  */);
+    Vns_version_string = ns_appkit_version_str ();
+  
++ 
++   DEFVAR_LISP (&quot;ns-shift-key-mask&quot;, Vns_shift_key_mask,
++                doc: /* Shift key mask defined in system. */);
++   Vns_shift_key_mask = make_number (NSShiftKeyMask);
++ 
++   DEFVAR_LISP (&quot;ns-control-key-mask&quot;, Vns_control_key_mask,
++                doc: /* Control key mask defined in system. */);
++   Vns_control_key_mask = make_number (NSControlKeyMask);
++ 
++   DEFVAR_LISP (&quot;ns-alternate-key-mask&quot;, Vns_alternate_key_mask,
++                doc: /* Alternate key mask defined in system. */);
++   Vns_alternate_key_mask = make_number (NSAlternateKeyMask);
++ 
++   DEFVAR_LISP (&quot;ns-command-key-mask&quot;, Vns_command_key_mask,
++                doc: /* Command key mask defined in system. */);
++   Vns_command_key_mask = make_number (NSCommandKeyMask);
++ 
++ 
+    defsubr (&amp;Sns_read_file_name);
+    defsubr (&amp;Sns_get_resource);
+    defsubr (&amp;Sns_set_resource);
+*************** be used as the image of the icon represe
+*** 2746,2751 ****
+--- 2763,2772 ----
+    defsubr (&amp;Sx_show_tip);
+    defsubr (&amp;Sx_hide_tip);
+  
++ #ifdef NS_IMPL_COCOA
++   mac_init_input_method ();
++ #endif
++ 
+    /* used only in fontset.c */
+    check_window_system_func = check_ns;
+  
+diff -r -N -p ../emacs-24.3.org/src/nsterm.h src/nsterm.h
+*** ../emacs-24.3.org/src/nsterm.h        2013-01-02 05:37:17.000000000 +0900
+--- src/nsterm.h        2013-04-13 21:49:53.000000000 +0900
+*************** typedef unsigned int NSUInteger;
+*** 420,425 ****
+--- 420,427 ----
+  #define KEY_NS_NEW_FRAME               ((1&lt;&lt;28)|(0&lt;&lt;16)|12)
+  #define KEY_NS_TOGGLE_TOOLBAR          ((1&lt;&lt;28)|(0&lt;&lt;16)|13)
+  #define KEY_NS_SHOW_PREFS              ((1&lt;&lt;28)|(0&lt;&lt;16)|14)
++ #define KEY_MAC_CHANGE_INPUT_METHOD    ((1&lt;&lt;28)|(0&lt;&lt;16)|15)
++ #define KEY_NS_PUT_MARKED_TEXT         ((1&lt;&lt;28)|(0&lt;&lt;16)|16)
+  
+  /* could use list to store these, but rest of emacs has a big infrastructure
+     for managing a table of bitmap &quot;records&quot; */
+diff -r -N -p ../emacs-24.3.org/src/nsterm.m src/nsterm.m
+*** ../emacs-24.3.org/src/nsterm.m        2013-01-04 18:38:13.000000000 +0900
+--- src/nsterm.m        2013-04-13 21:53:51.000000000 +0900
+*************** ns_term_init (Lisp_Object display_name)
+*** 4049,4054 ****
+--- 4049,4057 ----
+    /*   [[NSNotificationCenter defaultCenter] addObserver: NSApp
+                                           selector: @selector (logNotification:)
+                                               name: nil object: nil]; */
++   [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
++                                         selector: @selector (changeInputMethod:)
++                                                    name: @&quot;AppleSelectedInputSourcesChangedNotification&quot; object: nil];
+  
+    dpyinfo = xzalloc (sizeof *dpyinfo);
+  
+*************** ns_term_shutdown (int sig)
+*** 4278,4283 ****
+--- 4281,4301 ----
+      NSLog (@&quot;notification: '%@'&quot;, [notification name]);
+  }
+  
++ - (void)changeInputMethod: (NSNotification *)notification
++ {
++ 
++   struct frame *emacsframe = SELECTED_FRAME ();
++ 
++   if (mac_store_change_input_method_event())
++     {
++       if (!emacs_event)
++         return;
++       emacs_event-&gt;kind = NS_NONKEY_EVENT;
++       emacs_event-&gt;code = KEY_MAC_CHANGE_INPUT_METHOD;
++       emacs_event-&gt;modifiers = 0;
++       EV_TRAILER ((id)nil);
++     }
++ }
+  
+  - (void)sendEvent: (NSEvent *)theEvent
+  /* --------------------------------------------------------------------------
+*************** not_in_argv (NSString *arg)
+*** 4957,4963 ****
+               code, fnKeysym, flags, emacs_event-&gt;modifiers);
+  
+        /* if it was a function key or had modifiers, pass it directly to emacs */
+!       if (fnKeysym || (emacs_event-&gt;modifiers
+                         &amp;&amp; (emacs_event-&gt;modifiers != shift_modifier)
+                         &amp;&amp; [[theEvent charactersIgnoringModifiers] length] &gt; 0))
+  /*[[theEvent characters] length] */
+--- 4975,4982 ----
+               code, fnKeysym, flags, emacs_event-&gt;modifiers);
+  
+        /* if it was a function key or had modifiers, pass it directly to emacs */
+!       if (mac_pass_key_directly_to_emacs ()
+!           ||fnKeysym || (emacs_event-&gt;modifiers
+                         &amp;&amp; (emacs_event-&gt;modifiers != shift_modifier)
+                         &amp;&amp; [[theEvent charactersIgnoringModifiers] length] &gt; 0))
+  /*[[theEvent characters] length] */
+*************** not_in_argv (NSString *arg)
+*** 4972,4979 ****
+                ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
+  
+            emacs_event-&gt;code = code;
+!           EV_TRAILER (theEvent);
+!           return;
+          }
+      }
+  
+--- 4991,5008 ----
+                ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
+  
+            emacs_event-&gt;code = code;
+!           /* The function mac_pass_key_to_system decides 
+!              whether it is passed directly to emacs or not. */
+!           if (emacs_event-&gt;kind == NON_ASCII_KEYSTROKE_EVENT
+!               || !mac_pass_key_to_system (code, flags
+!                                           &amp; (NSShiftKeyMask
+!                                              | NSControlKeyMask
+!                                              | NSAlternateKeyMask
+!                                              | NSCommandKeyMask)))
+!             {
+!               EV_TRAILER (theEvent);
+!               return;
+!             }
+          }
+      }
+  
+*************** not_in_argv (NSString *arg)
+*** 5067,5076 ****
+      NSLog (@&quot;setMarkedText '%@' len =%d range %d from %d&quot;, str, [str length],
+             selRange.length, selRange.location);
+  
+-   if (workingText != nil)
+-     [self deleteWorkingText];
+    if ([str length] == 0)
+!     return;
+  
+    if (!emacs_event)
+      return;
+--- 5096,5114 ----
+      NSLog (@&quot;setMarkedText '%@' len =%d range %d from %d&quot;, str, [str length],
+             selRange.length, selRange.location);
+  
+    if ([str length] == 0)
+!     {
+!       [self deleteWorkingText];
+!       return;
+!     }
+!   else
+!     {
+!       if (workingText != nil) {
+!         [workingText release];
+!         workingText = nil;
+!         processingCompose = NO;
+!       }
+!     }
+  
+    if (!emacs_event)
+      return;
+*************** not_in_argv (NSString *arg)
+*** 5080,5086 ****
+    ns_working_text = build_string ([workingText UTF8String]);
+  
+    emacs_event-&gt;kind = NS_TEXT_EVENT;
+!   emacs_event-&gt;code = KEY_NS_PUT_WORKING_TEXT;
+    EV_TRAILER ((id)nil);
+  }
+  
+--- 5118,5126 ----
+    ns_working_text = build_string ([workingText UTF8String]);
+  
+    emacs_event-&gt;kind = NS_TEXT_EVENT;
+!   emacs_event-&gt;code = KEY_NS_PUT_MARKED_TEXT;
+!   emacs_event-&gt;arg = Fcons (make_number (selRange.location),
+!                             Fcons (make_number (selRange.length), Qnil));
+    EV_TRAILER ((id)nil);
+  }
+  
+*************** not_in_argv (NSString *arg)
+*** 5135,5149 ****
+  {
+    NSRect rect;
+    NSPoint pt;
+!   struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
+    if (NS_KEYLOG)
+      NSLog (@&quot;firstRectForCharRange request&quot;);
+  
+    rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
+    rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
+    pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win-&gt;phys_cursor.x);
+    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win-&gt;phys_cursor.y
+!                                        +FRAME_LINE_HEIGHT (emacsframe));
+  
+    pt = [self convertPoint: pt toView: nil];
+    pt = [[self window] convertBaseToScreen: pt];
+--- 5175,5197 ----
+  {
+    NSRect rect;
+    NSPoint pt;
+!   //  struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
+!   struct window *win;
+    if (NS_KEYLOG)
+      NSLog (@&quot;firstRectForCharRange request&quot;);
++     
++   if (NILP (Vmac_in_echo_area))
++     win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
++     else if (WINDOWP (echo_area_window))
++     win = XWINDOW (echo_area_window);
++   else
++     win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
+  
+    rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
+    rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
+    pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win-&gt;phys_cursor.x);
+    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win-&gt;phys_cursor.y
+!                                        +FRAME_LINE_HEIGHT (emacsframe)+2);
+  
+    pt = [self convertPoint: pt toView: nil];
+    pt = [[self window] convertBaseToScreen: pt];
+*************** variable `x-use-underline-position-prope
+*** 7173,7178 ****
+--- 7221,7230 ----
+  baseline level.  The default value is nil.  */);
+    x_underline_at_descent_line = 0;
+  
++   DEFVAR_LISP (&quot;mac-in-echo-area&quot;, Vmac_in_echo_area,
++                doc: /* state of cursor in echo area. */);
++   Vmac_in_echo_area = Qnil;
++ 
+    /* Tell emacs about this window system. */
+    Fprovide (intern (&quot;ns&quot;), Qnil);
+  }
+*** ../emacs-24.3.org/configure        2013-03-08 17:13:36.000000000 +0900
+--- configure        2013-04-13 23:11:56.000000000 +0900
+*************** if test &quot;${HAVE_NS}&quot; = yes; then
+*** 9650,9656 ****
+       leimdir=&quot;\${ns_appresdir}/leim&quot;
+       INSTALL_ARCH_INDEP_EXTRA=
+    fi
+!   NS_OBJC_OBJ=&quot;nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o&quot;
+  fi
+  CFLAGS=&quot;$tmp_CFLAGS&quot;
+  CPPFLAGS=&quot;$tmp_CPPFLAGS&quot;
+--- 9650,9656 ----
+       leimdir=&quot;\${ns_appresdir}/leim&quot;
+       INSTALL_ARCH_INDEP_EXTRA=
+    fi
+!   NS_OBJC_OBJ=&quot;nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o&quot;
+  fi
+  CFLAGS=&quot;$tmp_CFLAGS&quot;
+  CPPFLAGS=&quot;$tmp_CPPFLAGS&quot;
+*************** case &quot;$opsys&quot; in
+*** 24618,24624 ****
+     ## 0x690 is the total size of 30 segment load commands (at 56
+     ## each); under Cocoa 31 commands are required.
+     if test &quot;$HAVE_NS&quot; = &quot;yes&quot;; then
+!      libs_nsgui=&quot;-framework AppKit&quot;
+       headerpad_extra=6C8
+     else
+       libs_nsgui=
+--- 24618,24624 ----
+     ## 0x690 is the total size of 30 segment load commands (at 56
+     ## each); under Cocoa 31 commands are required.
+     if test &quot;$HAVE_NS&quot; = &quot;yes&quot;; then
+!      libs_nsgui=&quot;-framework AppKit -framework Carbon -framework Cocoa&quot;
+       headerpad_extra=6C8
+     else
+       libs_nsgui=
+*** ../emacs-24.3.org/configure.ac        2013-03-05 17:24:59.000000000 +0900
+--- configure.ac        2013-04-13 23:11:56.000000000 +0900
+*************** if test &quot;${HAVE_NS}&quot; = yes; then
+*** 1571,1577 ****
+       leimdir=&quot;\${ns_appresdir}/leim&quot;
+       INSTALL_ARCH_INDEP_EXTRA=
+    fi
+!   NS_OBJC_OBJ=&quot;nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o&quot;
+  fi
+  CFLAGS=&quot;$tmp_CFLAGS&quot;
+  CPPFLAGS=&quot;$tmp_CPPFLAGS&quot;
+--- 1571,1577 ----
+       leimdir=&quot;\${ns_appresdir}/leim&quot;
+       INSTALL_ARCH_INDEP_EXTRA=
+    fi
+!   NS_OBJC_OBJ=&quot;nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o&quot;
+  fi
+  CFLAGS=&quot;$tmp_CFLAGS&quot;
+  CPPFLAGS=&quot;$tmp_CPPFLAGS&quot;
+*************** case &quot;$opsys&quot; in
+*** 4322,4328 ****
+     ## 0x690 is the total size of 30 segment load commands (at 56
+     ## each); under Cocoa 31 commands are required.
+     if test &quot;$HAVE_NS&quot; = &quot;yes&quot;; then
+!      libs_nsgui=&quot;-framework AppKit&quot;
+       headerpad_extra=6C8
+     else
+       libs_nsgui=
+--- 4322,4328 ----
+     ## 0x690 is the total size of 30 segment load commands (at 56
+     ## each); under Cocoa 31 commands are required.
+     if test &quot;$HAVE_NS&quot; = &quot;yes&quot;; then
+!      libs_nsgui=&quot;-framework AppKit -framework Carbon -framework Cocoa&quot;
+       headerpad_extra=6C8
+     else
+       libs_nsgui=
</ins></span></pre>
</div>
</div>

</body>
</html>