[94319] trunk/dports/aqua/emacs-app

hum at macports.org hum at macports.org
Fri Jun 15 04:58:21 PDT 2012


Revision: 94319
          https://trac.macports.org/changeset/94319
Author:   hum at macports.org
Date:     2012-06-15 04:58:20 -0700 (Fri, 15 Jun 2012)
Log Message:
-----------
emacs-app: update to 24.1; update patches for inline, fullscreen; remove patches for clang, jpfont, title-bar.

Modified Paths:
--------------
    trunk/dports/aqua/emacs-app/Portfile
    trunk/dports/aqua/emacs-app/files/patch-fullscreen.diff
    trunk/dports/aqua/emacs-app/files/patch-lion-fullscreen.diff
    trunk/dports/aqua/emacs-app/files/patch-macemacsjp-inline.diff

Removed Paths:
-------------
    trunk/dports/aqua/emacs-app/files/patch-clang.diff
    trunk/dports/aqua/emacs-app/files/patch-fix-title-bar.diff
    trunk/dports/aqua/emacs-app/files/patch-macemacsjp-jpfont.diff

Modified: trunk/dports/aqua/emacs-app/Portfile
===================================================================
--- trunk/dports/aqua/emacs-app/Portfile	2012-06-15 08:24:00 UTC (rev 94318)
+++ trunk/dports/aqua/emacs-app/Portfile	2012-06-15 11:58:20 UTC (rev 94319)
@@ -4,8 +4,7 @@
 PortSystem          1.0
 
 name                emacs-app
-version             23.4
-revision            1
+version             24.1
 categories          aqua editors
 maintainers         css hum openmaintainer
 
@@ -28,72 +27,56 @@
 master_sites        gnu:emacs
 distname            emacs-${version}
 dist_subdir         emacs
-checksums           rmd160  5fb7e4cd4270a524b8723ad86a145a0e47336bf7 \
-                    sha256  b9a2b8434052771f797d2032772eba862ff9aa143029efc72295170607289c18
+checksums           rmd160  0fed00042339f46b29449bd561d2f881d13d8d38 \
+                    sha256  60d26dd1d9c0b955543ae83a2f4dd7c8b6af59e16a06822cfb175f1bf97c8bab
 
 depends_lib         port:ncurses
 
 patchfiles          patch-src_emacs.c.diff
 
-if {${configure.compiler} == "clang"} {
-    patchfiles-append   patch-clang.diff
-}
-
 post-patch {
     reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/src/emacs.c
 }
 
 configure.args      --with-ns --without-x --without-dbus
 
-use_parallel_build  yes
-
 destroot {
-    system "cd ${worksrcpath} && make install"
+    system -W ${worksrcpath} "make install"
     xinstall -m 755 -d ${destroot}${applications_dir}
     file copy ${worksrcpath}/nextstep/Emacs.app \
         ${destroot}${applications_dir}
     file copy ${filespath}/site-start.el \
         ${destroot}${applications_dir}/Emacs.app/Contents/Resources/site-lisp
-}
-
-post-destroot {
     reinplace "s|__PREFIX__|${prefix}|g" \
         ${destroot}${applications_dir}/Emacs.app/Contents/Resources/site-lisp/site-start.el
 }
 
-# patch-fullscreen.diff
-#   http://gist.github.com/291150
-#   http://www.sanityinc.com/full-screen-support-for-cocoa-emacs-on-osx
 variant fullscreen description {Add fullscreen patch} {
-    patchfiles-append   patch-fullscreen.diff
+    if {${os.major} < 11} {
+        # patch-fullscreen.diff
+        # http://cloud.github.com/downloads/hh/emacs/feature-fullscreen.patch
+        # http://untree.com/post/7649492902/building-a-fullscreen-enabled-emacs-24-on-mac-os-x-snow
+        patchfiles-append   patch-fullscreen.diff
+    } else {
+        # patch-lion-fullscreen.diff
+        # https://gist.github.com/1355895
+        # http://techresearchinfo.blogspot.jp/2011/12/emacs-24-on-lion-mention-top-right.html
+        patchfiles-append   patch-lion-fullscreen.diff
+    }
 }
 
-# inline and font patches are fetched from MacEmacsJP.
-#   http://svn.sourceforge.jp/svnroot/macemacsjp/inline_patch/trunk/
-#   revision 579 (2012/01/13).
-# patch-macemacsjp-inline.diff <= emacs-inline.patch
-# patch-macemacsjp-jpfont.diff <= font.patch
 variant inline description {Add inline patch from MacEmacsJP} {
+    # inline patch fetched from MacEmacsJP.
+    # patch-macemacsjp-inline.diff
+    # http://svn.sourceforge.jp/svnroot/macemacsjp/inline_patch/trunk/emacs-inline.patch
+    # revision 582 (2012/05/20).
     patchfiles-append   patch-macemacsjp-inline.diff
 }
 
-variant jpfont description {Add Japanese font patch from MacEmacsJP} {
-    patchfiles-append   patch-macemacsjp-jpfont.diff
-}
+variant jpfont requires inline description {Obsolete compatibility variant} {}
 
-variant patches requires fullscreen inline jpfont description {Add all patches: fullscreen, inline and jpfont} {}
+variant patches requires fullscreen inline description {Add all patches: fullscreen and inline} {}
 
-platform darwin 11 {
-   patchfiles-append    patch-fix-title-bar.diff
-   # patch-lion-fullscreen.diff
-   #   https://github.com/downloads/typester/emacs/emacs-23-lion-fullscreen-test.patch
-   if {[variant_isset fullscreen]} {
-       patchfiles-append   patch-lion-fullscreen.diff
-   }
-   configure.cflags-append   -fno-pie -O2
-   configure.ldflags-append  -fno-pie
-}
-
 livecheck.type      regex
 livecheck.url       http://ftp.gnu.org/gnu/emacs/?C=M&O=D
 livecheck.regex     emacs-(\\d+\\.\\d+\\w*)\\.tar

Deleted: trunk/dports/aqua/emacs-app/files/patch-clang.diff
===================================================================
--- trunk/dports/aqua/emacs-app/files/patch-clang.diff	2012-06-15 08:24:00 UTC (rev 94318)
+++ trunk/dports/aqua/emacs-app/files/patch-clang.diff	2012-06-15 11:58:20 UTC (rev 94319)
@@ -1,33 +0,0 @@
---- src/nsfont.m~	2011-10-05 22:55:46.000000000 +0900
-+++ src/nsfont.m	2011-10-05 23:03:53.000000000 +0900
-@@ -1286,7 +1286,7 @@
-       }
- 
-     CGContextRestoreGState (gcontext);
--    return;
-+    return 0;
-   }
- #endif  /* NS_IMPL_COCOA */
- 
---- src/nsimage.m~	2011-01-09 02:45:14.000000000 +0900
-+++ src/nsimage.m	2011-10-05 23:14:17.000000000 +0900
-@@ -325,7 +325,7 @@
- 
- /* Set color for a bitmap image (see initFromSkipXBM).  Note that the alpha
-    is used as a mask, so we just memset the entire array. */
--- setXBMColor: (NSColor *)color
-+- (void) setXBMColor: (NSColor *)color
- {
-   NSSize s = [self size];
-   int len = (int) s.width * s.height;
---- src/nsterm.m~	2011-10-05 22:55:46.000000000 +0900
-+++ src/nsterm.m	2011-10-05 22:59:43.000000000 +0900
-@@ -5494,7 +5494,7 @@
-   NSTRACE (performDragOperation);
- 
-   if (!emacs_event)
--    return;
-+    return NO;
- 
-   position = [self convertPoint: [sender draggingLocation] fromView: nil];
-   x = lrint (position.x);  y = lrint (position.y);

Deleted: trunk/dports/aqua/emacs-app/files/patch-fix-title-bar.diff
===================================================================
--- trunk/dports/aqua/emacs-app/files/patch-fix-title-bar.diff	2012-06-15 08:24:00 UTC (rev 94318)
+++ trunk/dports/aqua/emacs-app/files/patch-fix-title-bar.diff	2012-06-15 11:58:20 UTC (rev 94319)
@@ -1,14 +0,0 @@
---- src/ChangeLog.orig	2011-07-23 12:31:39.000000000 -0400
-+++ src/ChangeLog	2011-07-23 12:31:39.000000000 -0400
---- src/nsterm.m.orig	2011-07-23 12:31:39.000000000 -0400
-+++ src/nsterm.m	2011-07-23 12:31:39.000000000 -0400
-@@ -5106,7 +5106,8 @@
- 
-   win = [[EmacsWindow alloc]
-             initWithContentRect: r
--                      styleMask: (NSResizableWindowMask |
-+                      styleMask: (NSTitledWindowMask |
-+                                  NSResizableWindowMask |
-                                   NSMiniaturizableWindowMask |
-                                   NSClosableWindowMask)
-                         backing: NSBackingStoreBuffered

Modified: trunk/dports/aqua/emacs-app/files/patch-fullscreen.diff
===================================================================
--- trunk/dports/aqua/emacs-app/files/patch-fullscreen.diff	2012-06-15 08:24:00 UTC (rev 94318)
+++ trunk/dports/aqua/emacs-app/files/patch-fullscreen.diff	2012-06-15 11:58:20 UTC (rev 94319)
@@ -1,6 +1,6 @@
---- lisp/term/ns-win.el.orig	2011-01-29 15:01:48.000000000 -0500
-+++ lisp/term/ns-win.el	2011-01-29 15:01:52.000000000 -0500
-@@ -1263,6 +1263,11 @@
+--- lisp/term/ns-win.el
++++ lisp/term/ns-win.el
+@@ -1263,6 +1263,11 @@ the operating system.")
  (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
  
  
@@ -12,9 +12,9 @@
  (provide 'ns-win)
  
  ;; arch-tag: eb138a45-4e2e-4d68-b1c9-a39665731644
---- src/nsfns.m.orig	2011-01-29 15:01:48.000000000 -0500
-+++ src/nsfns.m	2011-01-29 15:01:52.000000000 -0500
-@@ -2599,6 +2599,34 @@
+--- src/nsfns.m
++++ src/nsfns.m
+@@ -2589,6 +2589,34 @@ Value is t if tooltip was open, nil otherwise.  */)
  
  #endif
  
@@ -49,7 +49,7 @@
  
  /* ==========================================================================
  
-@@ -2684,6 +2712,8 @@
+@@ -2676,6 +2704,8 @@ be used as the image of the icon representing the frame.  */);
    defsubr (&Sx_show_tip);
    defsubr (&Sx_hide_tip);
  
@@ -58,9 +58,9 @@
    /* used only in fontset.c */
    check_window_system_func = check_ns;
  
---- src/nsterm.h.orig	2011-01-29 15:01:48.000000000 -0500
-+++ src/nsterm.h	2011-01-29 15:01:52.000000000 -0500
-@@ -95,8 +95,25 @@
+--- src/nsterm.h
++++ src/nsterm.h
+@@ -95,8 +95,25 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
  {
    NSPoint grabOffset;
  }
@@ -86,9 +86,9 @@
  
  /* ==========================================================================
  
---- src/nsterm.m.orig	2011-01-29 15:01:48.000000000 -0500
-+++ src/nsterm.m	2011-01-29 15:01:52.000000000 -0500
-@@ -685,6 +685,13 @@
+--- src/nsterm.m
++++ src/nsterm.m
+@@ -686,6 +686,13 @@ ns_focus (struct frame *f, NSRect *r, int n)
  /*debug_lock--; */
              }
  
@@ -102,7 +102,7 @@
            if (view)
  #ifdef NS_IMPL_GNUSTEP
              r ? [view lockFocusInRect: u] : [view lockFocus];
-@@ -1130,8 +1137,14 @@
+@@ -1131,8 +1138,14 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
    f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f);
    compute_fringe_widths (f, 0);
  
@@ -119,16 +119,7 @@
  
    /* If we have a toolbar, take its height into account. */
    if (tb)
-@@ -1149,7 +1162,7 @@
-                   + FRAME_NS_TOOLBAR_HEIGHT (f);
- 
-   /* constrain to screen if we can */
--  if (screen)
-+  if (screen && ![window isKindOfClass:[EmacsFullWindow class]])
-     {
-       NSSize sz = [screen visibleFrame].size;
-       NSSize ez = { wr.size.width - sz.width, wr.size.height - sz.height };
-@@ -1196,7 +1209,7 @@
+@@ -1197,7 +1210,7 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
    change_frame_size (f, rows, cols, 0, 1, 0); /* pretend, delay, safe */
    FRAME_PIXEL_WIDTH (f) = pixelwidth;
    FRAME_PIXEL_HEIGHT (f) = pixelheight;
@@ -137,7 +128,7 @@
  
    mark_window_cursors_off (XWINDOW (f->root_window));
    cancel_mouse_face (f);
-@@ -5589,6 +5602,59 @@
+@@ -5609,6 +5622,59 @@ extern void update_window_cursor (struct window *w, int on);
  
  @implementation EmacsWindow
  
@@ -197,7 +188,7 @@
  /* called only on resize clicks by special case in EmacsApp-sendEvent */
  - (void)mouseDown: (NSEvent *)theEvent
  {
-@@ -5647,6 +5713,32 @@
+@@ -5667,6 +5733,32 @@ extern void update_window_cursor (struct window *w, int on);
  
  @end /* EmacsWindow */
  
@@ -229,4 +220,4 @@
 +
  
  /* ==========================================================================
- 
+                                   
\ No newline at end of file

Modified: trunk/dports/aqua/emacs-app/files/patch-lion-fullscreen.diff
===================================================================
--- trunk/dports/aqua/emacs-app/files/patch-lion-fullscreen.diff	2012-06-15 08:24:00 UTC (rev 94318)
+++ trunk/dports/aqua/emacs-app/files/patch-lion-fullscreen.diff	2012-06-15 11:58:20 UTC (rev 94319)
@@ -1,54 +1,222 @@
---- src/nsterm.m.old	2011-11-25 22:36:38.000000000 +0900
-+++ src/nsterm.m	2011-11-25 22:59:56.000000000 +0900
-@@ -5182,6 +5182,7 @@
-   [win setAcceptsMouseMovedEvents: YES];
-   [win setDelegate: self];
-   [win useOptimizedDrawing: YES];
-+  [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
+=== modified file 'lisp/term/ns-win.el'
+--- lisp/term/ns-win.el	2011-10-01 20:32:01 +0000
++++ lisp/term/ns-win.el	2011-11-10 16:22:51 +0000
+@@ -928,6 +928,10 @@
+ (add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
+ (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
  
-   sz.width = FRAME_COLUMN_WIDTH (f);
-   sz.height = FRAME_LINE_HEIGHT (f);
-@@ -5671,6 +5672,43 @@
-   cols = c;
++(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
++(defun ns-toggle-fullscreen ()
++  (interactive)
++  (ns-toggle-fullscreen-internal))
+ 
+ (provide 'ns-win)
+ 
+
+=== modified file 'src/nsfns.m'
+--- src/nsfns.m	2011-11-05 12:25:01 +0000
++++ src/nsfns.m	2011-11-10 18:54:31 +0000
+@@ -2567,6 +2567,22 @@
  }
  
-+- (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions {
-+    return proposedOptions | NSApplicationPresentationAutoHideToolbar;
-+}
+ 
++DEFUN ("ns-toggle-fullscreen-internal", Fns_toggle_fullscreen_internal, Sns_toggle_fullscreen_internal,
++        0, 0, 0,
++        doc: /* Toggle fulscreen mode */)
++()
++{
++  struct frame *f = SELECTED_FRAME();
++  EmacsWindow *window = ns_get_window(f);
 +
-+- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize {
-+    NSRect r = NSMakeRect(0.f, 0.f, proposedSize.width, proposedSize.height);
-+    int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, r.size.width);
-+    int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, r.size.height);
++#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
++  [window toggleFullScreen:nil];
++#endif
 +
-+    change_frame_size (emacsframe, rows, cols, 0, 1, 0); /* pretend, delay, safe */
-+    FRAME_PIXEL_WIDTH (emacsframe) = (int)r.size.width;
-+    FRAME_PIXEL_HEIGHT (emacsframe) = (int)r.size.height;
++  return Qnil;
++}
 +
-+    emacsframe->border_width = [window frame].size.width - r.size.width;
-+    FRAME_NS_TITLEBAR_HEIGHT (emacsframe) = 0;
 +
-+    return proposedSize;
-+}
+ /* ==========================================================================
+ 
+     Class implementations
+@@ -2724,6 +2740,8 @@
+   defsubr (&Sx_show_tip);
+   defsubr (&Sx_hide_tip);
+ 
++  defsubr (&Sns_toggle_fullscreen_internal);
 +
-+- (void)windowDidExitFullScreen:(NSNotification *)notification {
-+    NSWindow* window = [notification object];
+   /* used only in fontset.c */
+   check_window_system_func = check_ns;
+ 
+
+=== modified file 'src/nsmenu.m'
+--- src/nsmenu.m	2011-07-29 05:31:12 +0000
++++ src/nsmenu.m	2011-11-10 16:22:51 +0000
+@@ -986,7 +986,7 @@
+    -------------------------------------------------------------------------- */
+ {
+   BLOCK_INPUT;
+-  [[FRAME_NS_VIEW (f) toolbar] setVisible: NO];
++  [[FRAME_NS_VIEW (f) window] setToolbar: nil];
+   FRAME_TOOLBAR_HEIGHT (f) = 0;
+   UNBLOCK_INPUT;
+ }
+@@ -1003,6 +1003,8 @@
+   EmacsToolbar *toolbar = [view toolbar];
+ 
+   BLOCK_INPUT;
++  [window setToolbar: toolbar];
 +
-+    NSRect r = [window contentRectForFrameRect:[window frame]];
-+    int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, r.size.width);
-+    int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, r.size.height);
+   [toolbar clearActive];
+ 
+   /* update EmacsToolbar as in GtkUtils, build items list */
+
+=== modified file 'src/nsterm.h'
+--- src/nsterm.h	2011-09-09 01:06:52 +0000
++++ src/nsterm.h	2011-11-10 18:39:22 +0000
+@@ -38,6 +38,9 @@
+ #ifndef MAC_OS_X_VERSION_10_6
+ #define MAC_OS_X_VERSION_10_6 1060
+ #endif
++#ifndef MAC_OS_X_VERSION_10_7
++#define MAC_OS_X_VERSION_10_7 1070
++#endif
+ #endif /* NS_IMPL_COCOA */
+ 
+ #ifdef __OBJC__
+
+=== modified file 'src/nsterm.m'
+--- src/nsterm.m	2011-11-05 12:25:01 +0000
++++ src/nsterm.m	2011-11-10 18:54:02 +0000
+@@ -5299,39 +5299,7 @@
+ #endif
+   if (rows < MINHEIGHT)
+     rows = MINHEIGHT;
+-#ifdef NS_IMPL_COCOA
+-  {
+-    /* this sets window title to have size in it; the wm does this under GS */
+-    NSRect r = [[self window] frame];
+-    if (r.size.height == frameSize.height && r.size.width == frameSize.width)
+-      {
+-        if (old_title != 0)
+-          {
+-            xfree (old_title);
+-            old_title = 0;
+-          }
+-      }
+-    else
+-      {
+-        char *size_title;
+-        NSWindow *window = [self window];
+-        if (old_title == 0)
+-          {
+-            const char *t = [[[self window] title] UTF8String];
+-            char *pos = strstr (t, "  —  ");
+-            if (pos)
+-              *pos = '\0';
+-            old_title = (char *) xmalloc (strlen (t) + 1);
+-            strcpy (old_title, t);
+-          }
+-        size_title = xmalloc (strlen (old_title) + 40);
+-	esprintf (size_title, "%s  —  (%d x %d)", old_title, cols, rows);
+-        [window setTitle: [NSString stringWithUTF8String: size_title]];
+-        [window display];
+-        xfree (size_title);
+-      }
+-  }
+-#endif /* NS_IMPL_COCOA */
 +
-+    change_frame_size (emacsframe, rows, cols, 0, 1, 0); /* pretend, delay, safe */
-+    FRAME_PIXEL_WIDTH (emacsframe) = (int)r.size.width;
-+    FRAME_PIXEL_HEIGHT (emacsframe) = (int)r.size.height;
+ /*fprintf (stderr,"    ...size became %.0f x %.0f  (%d x %d)\n",frameSize.width,frameSize.height,cols,rows); */
+ 
+   return frameSize;
+@@ -5353,14 +5321,6 @@
+   NSTRACE (windowDidResize);
+ /*fprintf (stderr,"windowDidResize: %.0f\n",[theWindow frame].size.height); */
+ 
+-#ifdef NS_IMPL_COCOA
+-  if (old_title != 0)
+-    {
+-      xfree (old_title);
+-      old_title = 0;
+-    }
+-#endif /* NS_IMPL_COCOA */
+-
+   /* Avoid loop under GNUstep due to call at beginning of this function.
+      (x_set_window_size causes a resize which causes
+      a "windowDidResize" which calls x_set_window_size).  */
+@@ -5388,6 +5348,60 @@
+   ns_send_appdefined (-1);
+ }
+ 
++#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
++- (void)windowDidEnterFullScreen:(NSNotification *)notification
++{
++    NSTRACE (windowDidEnterFullScreen);
++    /* NSLog(@"Calling windowDidEnterFullScreen"); */
++    
++    NSWindow *window = [self window];
++    NSRect wr = [window frame];
++    int w = (int)wr.size.width - emacsframe->border_width;
++    int h = (int)wr.size.height;
++    cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, w);
++    rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, h);
++    /* NSLog(@"window_size=%dx%d (%dx%d)", w, h, cols, rows); */
++    FRAME_PIXEL_WIDTH (emacsframe) = w;
++    FRAME_PIXEL_HEIGHT (emacsframe) = h;
++    change_frame_size (emacsframe, rows, cols, 0, 1, 0);
++    SET_FRAME_GARBAGED (emacsframe);
++    cancel_mouse_face (emacsframe);
++    ns_send_appdefined (-1);
++}
++#endif
 +
-+    emacsframe->border_width = [window frame].size.width - r.size.width;
-+    FRAME_NS_TITLEBAR_HEIGHT (emacsframe) =
-+        [window frame].size.height - r.size.height;
++#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
++- (void)windowDidExitFullScreen:(NSNotification *)notification
++{
++    NSTRACE (windowDidExitFullScreen);
++    /* NSLog(@"Calling windowDidExitFullScreen"); */
++    
++    NSWindow *window = [self window];
++    NSRect wr = [window frame];
++    int w = (int)wr.size.width - emacsframe->border_width;
++    int h = (int)wr.size.height
++    - FRAME_NS_TITLEBAR_HEIGHT (emacsframe)
++    - FRAME_TOOLBAR_HEIGHT (emacsframe);
++    cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, w);
++    rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, h);
++    /* NSLog(@"window_size=%dx%d (%dx%d)", w, h, cols, rows); */
++    FRAME_PIXEL_WIDTH (emacsframe) = w;
++    FRAME_PIXEL_HEIGHT (emacsframe) = h;
++    change_frame_size (emacsframe, rows, cols, 0, 1, 0);
++    SET_FRAME_GARBAGED (emacsframe);
++    cancel_mouse_face (emacsframe);
++    ns_send_appdefined (-1);
++}
++#endif
 +
-+    [[window delegate] windowDidMove:nil];
++#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
++- (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions
++{
++    /* NSLog(@"Calling window:willUseFullScreenPresentationOptions: %d", proposedOptions); */
++    return proposedOptions | NSApplicationPresentationAutoHideToolbar;
 +}
++#endif
 +
- @end  /* EmacsView */
  
+ - (void)windowDidBecomeKey: (NSNotification *)notification
+ /* cf. x_detect_focus_change(), x_focus_changed(), x_new_focus_frame() */
+@@ -5559,6 +5573,14 @@
+   [NSApp registerServicesMenuSendTypes: ns_send_types
+                            returnTypes: nil];
  
++#if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
++  if (NSApp != nil)
++  {
++    [NSApp setPresentationOptions: NSApplicationPresentationFullScreen | [NSApp presentationOptions] ];
++    [win setCollectionBehavior: NSWindowCollectionBehaviorFullScreenPrimary | [win collectionBehavior] ];
++  }
++#endif
++
+   ns_window_num++;
+   return self;
+ }

Modified: trunk/dports/aqua/emacs-app/files/patch-macemacsjp-inline.diff
===================================================================
--- trunk/dports/aqua/emacs-app/files/patch-macemacsjp-inline.diff	2012-06-15 08:24:00 UTC (rev 94318)
+++ trunk/dports/aqua/emacs-app/files/patch-macemacsjp-inline.diff	2012-06-15 11:58:20 UTC (rev 94319)
@@ -1,18 +1,562 @@
-diff -r -p -x '*.elc' ../emacs-23.3-0-lion/lisp/term/ns-win.el lisp/term/ns-win.el
-*** ../emacs-23.3-0-lion/lisp/term/ns-win.el	2011-12-05 16:49:13.000000000 +0900
---- lisp/term/ns-win.el	2012-01-13 08:55:10.000000000 +0900
+diff -N -p ../emacs-24.0.97/configure.in ./configure.in
+*** ../emacs-24.0.97/configure.in	2012-05-17 11:19:50.000000000 +0900
+--- ./configure.in	2012-05-20 17:01:19.000000000 +0900
+*************** if test "${HAVE_NS}" = yes; then
+*** 1582,1588 ****
+    fi
+    ns_frag=$srcdir/src/ns.mk
+    NS_OBJ="fontset.o fringe.o image.o"
+!   NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o"
+  fi
+  CFLAGS="$tmp_CFLAGS"
+  CPPFLAGS="$tmp_CPPFLAGS"
+--- 1582,1588 ----
+    fi
+    ns_frag=$srcdir/src/ns.mk
+    NS_OBJ="fontset.o fringe.o image.o"
+!   NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o"
+  fi
+  CFLAGS="$tmp_CFLAGS"
+  CPPFLAGS="$tmp_CPPFLAGS"
+*************** case "$opsys" in
+*** 3416,3422 ****
+     ## 0x690 is the total size of 30 segment load commands (at 56
+     ## each); under Cocoa 31 commands are required.
+     if test "$HAVE_NS" = "yes"; then
+!      libs_nsgui="-framework AppKit"
+       headerpad_extra=6C8
+     else
+       libs_nsgui=
+--- 3416,3422 ----
+     ## 0x690 is the total size of 30 segment load commands (at 56
+     ## each); under Cocoa 31 commands are required.
+     if test "$HAVE_NS" = "yes"; then
+!      libs_nsgui="-framework AppKit -framework Carbon"
+       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 \
+!   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 \
+!   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->code == KEY_NS_PUT_WORKING_TEXT)
+              obj = Fcons (intern ("ns-put-working-text"), Qnil);
+!           else
+              obj = Fcons (intern ("ns-unput-working-text"), Qnil);
+  	  kbd_fetch_ptr = event + 1;
+            if (used_mouse_menu)
+              *used_mouse_menu = 1;
+--- 3915,3924 ----
+          {
+            if (event->code == KEY_NS_PUT_WORKING_TEXT)
+              obj = Fcons (intern ("ns-put-working-text"), Qnil);
+!           else if (event->code == KEY_NS_UNPUT_WORKING_TEXT)
+              obj = Fcons (intern ("ns-unput-working-text"), Qnil);
++ 	  else if (event->code == KEY_NS_PUT_MARKED_TEXT)
++ 	    obj = Fcons (intern ("ns-put-marked-text"), event->arg);
+  	  kbd_fetch_ptr = event + 1;
+            if (used_mouse_menu)
+              *used_mouse_menu = 1;
+*************** keys_of_keyboard (void)
+*** 12332,12337 ****
+--- 12334,12341 ----
+  			    "ns-put-working-text");
+    initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",
+  			    "ns-unput-working-text");
++   initial_define_lispy_key (Vspecial_event_map, "ns-put-marked-text",
++ 			    "ns-put-marked-text");
+    /* 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 <taiichi2 at mac.com>.
++ */
++ 
++ #include "config.h"
++ 
++ #ifdef NS_IMPL_COCOA
++ 
++ #include <math.h>
++ #include <sys/types.h>
++ #include <time.h>
++ #include <signal.h>
++ #include <unistd.h>
++ 
++ #include <Carbon/Carbon.h>
++ 
++ #include "lisp.h"
++ #include "blockinput.h"
++ 
++ enum output_method
++ {
++   output_initial,
++   output_termcap,
++   output_x_window,
++   output_msdos_raw,
++   output_w32,
++   output_mac,
++   output_ns
++ } output_method;
++ 
++ #include "termhooks.h"
++ #include "keyboard.h"
++ #include "buffer.h"
++ 
++ //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 ("mac-input-source-is-ascii-capable", 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 ("mac-get-input-source-list", 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 < 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 ("mac-get-current-input-source", 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 ("mac-toggle-input-source", 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 ("default-input-method"));
++   if (STRINGP (dim) && strcmp(SDATA (dim), "MacOSX") == 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) && modifiers == XINT (m))
++ 	if (NILP (k)
++ 	    || (NUMBERP (k) && 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 ("mac-keys-passed-to-system");
++   staticpro (&Qmac_keys_passed_to_system);
++ 
++   DEFVAR_LISP ("mac-use-input-method-on-system", 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 (&Smac_input_source_is_ascii_capable);
++   defsubr (&Smac_get_input_source_list);
++   defsubr (&Smac_get_current_input_source);
++   defsubr (&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 ("ns-shift-key-mask", Vns_shift_key_mask,
++                doc: /* Shift key mask defined in system. */);
++   Vns_shift_key_mask = make_number (NSShiftKeyMask);
++ 
++   DEFVAR_LISP ("ns-control-key-mask", Vns_control_key_mask,
++                doc: /* Control key mask defined in system. */);
++   Vns_control_key_mask = make_number (NSControlKeyMask);
++ 
++   DEFVAR_LISP ("ns-alternate-key-mask", Vns_alternate_key_mask,
++                doc: /* Alternate key mask defined in system. */);
++   Vns_alternate_key_mask = make_number (NSAlternateKeyMask);
++ 
++   DEFVAR_LISP ("ns-command-key-mask", Vns_command_key_mask,
++                doc: /* Command key mask defined in system. */);
++   Vns_command_key_mask = make_number (NSCommandKeyMask);
++ 
++ 
+    defsubr (&Sns_read_file_name);
+    defsubr (&Sns_get_resource);
+    defsubr (&Sns_set_resource);
+*************** be used as the image of the icon represe
+*** 2766,2771 ****
+--- 2783,2792 ----
+    defsubr (&Sx_show_tip);
+    defsubr (&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<<28)|(0<<16)|12)
+  #define KEY_NS_TOGGLE_TOOLBAR          ((1<<28)|(0<<16)|13)
+  #define KEY_NS_SHOW_PREFS              ((1<<28)|(0<<16)|14)
++ #define KEY_MAC_CHANGE_INPUT_METHOD    ((1<<28)|(0<<16)|15)
++ #define KEY_NS_PUT_MARKED_TEXT         ((1<<28)|(0<<16)|16)
+  
+  /* could use list to store these, but rest of emacs has a big infrastructure
+     for managing a table of bitmap "records" */
+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: @"AppleSelectedInputSourcesChangedNotification" 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 (@"notification: '%@'", [notification name]);
+  }
+  
++ - (void)changeInputMethod: (NSNotification *)notification
++ {
++ 
++   struct frame *emacsframe = SELECTED_FRAME ();
++ 
++   if (mac_store_change_input_method_event())
++     {
++       emacs_event->kind = NS_NONKEY_EVENT;
++       emacs_event->code = KEY_MAC_CHANGE_INPUT_METHOD;
++       emacs_event->modifiers = 0;
++       EV_TRAILER ((id)nil);
++     }
++ }
+  
+  - (void)sendEvent: (NSEvent *)theEvent
+  /* --------------------------------------------------------------------------
+*************** ns_term_shutdown (int sig)
+*** 4857,4863 ****
+               code, fnKeysym, flags, emacs_event->modifiers);
+  
+        /* if it was a function key or had modifiers, pass it directly to emacs */
+!       if (fnKeysym || (emacs_event->modifiers
+                         && (emacs_event->modifiers != shift_modifier)
+                         && [[theEvent charactersIgnoringModifiers] length] > 0))
+  /*[[theEvent characters] length] */
+--- 4872,4879 ----
+               code, fnKeysym, flags, emacs_event->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->modifiers
+                         && (emacs_event->modifiers != shift_modifier)
+                         && [[theEvent charactersIgnoringModifiers] length] > 0))
+  /*[[theEvent characters] length] */
+*************** ns_term_shutdown (int sig)
+*** 4872,4879 ****
+                ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
+  
+            emacs_event->code = code;
+!           EV_TRAILER (theEvent);
+!           return;
+          }
+      }
+  
+--- 4888,4905 ----
+                ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
+  
+            emacs_event->code = code;
+! 	  /* The function mac_pass_key_to_system decides 
+! 	     whether it is passed directly to emacs or not. */
+! 	  if (emacs_event->kind == NON_ASCII_KEYSTROKE_EVENT
+! 	      || !mac_pass_key_to_system (code, flags
+! 					  & (NSShiftKeyMask
+! 					     | NSControlKeyMask
+! 					     | NSAlternateKeyMask
+! 					     | NSCommandKeyMask)))
+! 	    {
+! 	      EV_TRAILER (theEvent);
+! 	      return;
+! 	    }
+          }
+      }
+  
+*************** ns_term_shutdown (int sig)
+*** 4966,4975 ****
+      NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length],
+             selRange.length, selRange.location);
+  
+-   if (workingText != nil)
+-     [self deleteWorkingText];
+    if ([str length] == 0)
+!     return;
+  
+    if (!emacs_event)
+      return;
+--- 4992,5010 ----
+      NSLog (@"setMarkedText '%@' len =%d range %d from %d", 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->kind = NS_TEXT_EVENT;
+!   emacs_event->code = KEY_NS_PUT_WORKING_TEXT;
+    EV_TRAILER ((id)nil);
+  }
+  
+--- 5014,5022 ----
+    ns_working_text = build_string ([workingText UTF8String]);
+  
+    emacs_event->kind = NS_TEXT_EVENT;
+!   emacs_event->code = KEY_NS_PUT_MARKED_TEXT;
+!   emacs_event->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 (@"firstRectForCharRange request");
+  
+    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->phys_cursor.x);
+    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->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 (@"firstRectForCharRange request");
++     
++   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->phys_cursor.x);
+    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->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 ("mac-in-echo-area", Vmac_in_echo_area,
++                doc: /* state of cursor in echo area. */);
++   Vmac_in_echo_area = Qnil;
++ 
+    /* Tell emacs about this window system. */
+    Fprovide (intern ("ns"), 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
+*************** is not used)."
+*** 127,132 ****
+--- 127,133 ----
+  	       (cons (logior (lsh 0 16)  12) 'ns-new-frame)
+  	       (cons (logior (lsh 0 16)  13) 'ns-toggle-toolbar)
+  	       (cons (logior (lsh 0 16)  14) 'ns-show-prefs)
++ 	       (cons (logior (lsh 0 16)  15) 'mac-change-input-method)
+  	       ))))
+      (set-terminal-parameter frame 'x-setup-function-keys t)))
+  
+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
 *************** The properties returned may include `top
-*** 317,322 ****
---- 317,323 ----
-  	     (cons (logior (lsh 0 16)  12) 'ns-new-frame)
-  	     (cons (logior (lsh 0 16)  13) 'ns-toggle-toolbar)
-  	     (cons (logior (lsh 0 16)  14) 'ns-show-prefs)
-+ 	     (cons (logior (lsh 0 16)  15) 'mac-change-input-method)
-  	     (cons (logior (lsh 1 16)  32) 'f1)
-               (cons (logior (lsh 1 16)  33) 'f2)
-               (cons (logior (lsh 1 16)  34) 'f3)
+*** 173,178 ****
+--- 173,179 ----
+  (define-key global-map [ns-new-frame] 'make-frame)
+  (define-key global-map [ns-toggle-toolbar] 'ns-toggle-toolbar)
+  (define-key global-map [ns-show-prefs] 'customize)
++ (define-key global-map [mac-change-input-method] 'mac-change-input-method)
+  
+  
+  ;; Set up a number of aliases and other layers to pretend we're using
 *************** The properties returned may include `top
-*** 549,562 ****
+*** 259,272 ****
   ;; editing window.)
   
   (defface ns-working-text-face
@@ -27,7 +571,7 @@
   (defvar ns-working-text)		; nsterm.m
   
   ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
---- 550,579 ----
+--- 260,289 ----
   ;; editing window.)
   
   (defface ns-working-text-face
@@ -58,9 +602,48 @@
   (defvar ns-working-text)		; nsterm.m
   
   ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
+*************** When text is in th echo area, this just 
+*** 274,290 ****
+  (defun ns-in-echo-area ()
+    "Whether, for purposes of inserting working composition text, the minibuffer
+  is currently being used."
+!   (or isearch-mode
+!       (and cursor-in-echo-area (current-message))
+!       ;; Overlay strings are not shown in some cases.
+!       (get-char-property (point) 'invisible)
+!       (and (not (bobp))
+! 	   (or (and (get-char-property (point) 'display)
+! 		    (eq (get-char-property (1- (point)) 'display)
+! 			(get-char-property (point) 'display)))
+! 	       (and (get-char-property (point) 'composition)
+! 		    (eq (get-char-property (1- (point)) 'composition)
+! 			(get-char-property (point) 'composition)))))))
+  
+  ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
+  ;; always returns nil for some reason.  If this WASN'T the case, we could
+--- 291,309 ----
+  (defun ns-in-echo-area ()
+    "Whether, for purposes of inserting working composition text, the minibuffer
+  is currently being used."
+!   (setq mac-in-echo-area 
+! 	(or isearch-mode
+! 	    (and cursor-in-echo-area (current-message))
+! 	    ;; Overlay strings are not shown in some cases.
+! 	    (get-char-property (point) 'invisible)
+! 	    (and (not (bobp))
+! 		 (or (and (get-char-property (point) 'display)
+! 			  (eq (get-char-property (1- (point)) 'display)
+! 			      (get-char-property (point) 'display)))
+! 		     (and (get-char-property (point) 'composition)
+! 			  (eq (get-char-property (1- (point)) 'composition)
+! 			      (get-char-property (point) 'composition)))))))
+!   mac-in-echo-area)
+  
+  ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
+  ;; always returns nil for some reason.  If this WASN'T the case, we could
 *************** is currently being used."
-*** 583,588 ****
---- 600,606 ----
+*** 293,298 ****
+--- 312,318 ----
   (defun ns-put-working-text ()
     (interactive)
     (if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text)))
@@ -69,7 +652,7 @@
     (interactive)
     (ns-delete-working-text))
 *************** The overlay is assigned the face `ns-wor
-*** 604,622 ****
+*** 314,332 ****
   (defun ns-echo-working-text ()
     "Echo contents of `ns-working-text' in message display area.
   See `ns-insert-working-text'."
@@ -89,7 +672,7 @@
     (cond
      ((and (overlayp ns-working-overlay)
            ;; Still alive?
---- 622,700 ----
+--- 334,414 ----
   (defun ns-echo-working-text ()
     "Echo contents of `ns-working-text' in message display area.
   See `ns-insert-working-text'."
@@ -122,20 +705,22 @@
 ! `ns-working-text-face' and `ns-marked-text-face'."
 !   (ns-delete-working-text)
 !   (let ((start (point)))
-!     (put-text-property pos len 'face 'ns-working-text-face ns-working-text)
-!     (insert ns-working-text)
-!     (if (= len 0)
-!         (overlay-put (setq ns-working-overlay
-!                            (make-overlay start (point) (current-buffer) nil t))
-!                      'face 'ns-working-text-face)
-!       (overlay-put (setq ns-working-overlay
-!                          (make-overlay start (point) (current-buffer) nil t))
-!                    'face 'ns-unmarked-text-face)
-!       (overlay-put (setq ns-marked-overlay 
-!                          (make-overlay (+ start pos) (+ start pos len)
-!                                        (current-buffer) nil t))
-!                    'face 'ns-marked-text-face))
-!     (goto-char (+ start pos))))
+!     (if (<= pos (length ns-working-text))
+!       (progn
+! 	(put-text-property pos len 'face 'ns-working-text-face ns-working-text)
+! 	(insert ns-working-text)
+! 	(if (= len 0)
+! 	    (overlay-put (setq ns-working-overlay
+! 			       (make-overlay start (point) (current-buffer) nil t))
+! 			 'face 'ns-working-text-face)
+! 	  (overlay-put (setq ns-working-overlay
+! 			     (make-overlay start (point) (current-buffer) nil t))
+! 		       'face 'ns-unmarked-text-face)
+! 	  (overlay-put (setq ns-marked-overlay 
+! 			     (make-overlay (+ start pos) (+ start pos len)
+! 					   (current-buffer) nil t))
+! 		       'face 'ns-marked-text-face))
+! 	(goto-char (+ start pos))))))
 !     
 ! (defun ns-echo-marked-text (pos len)
 !   "Echo contents of `ns-working-text' in message display area.
@@ -148,7 +733,7 @@
 !       (setq msglen (length msg)))
 !     (setq ns-working-overlay (length ns-working-text))
 !     (setq msg (concat msg ns-working-text))
-!     (if (> len 0)
+!     (if (= len 0)
 !         (put-text-property msglen (+ msglen ns-working-overlay)
 !                            'face 'ns-working-text-face msg)
 !       (put-text-property msglen (+ msglen ns-working-overlay)
@@ -169,9 +754,9 @@
     (cond
      ((and (overlayp ns-working-overlay)
            ;; Still alive?
-*************** the operating system.")
-*** 1267,1272 ****
---- 1345,1771 ----
+*************** See the documentation of `create-fontset
+*** 931,936 ****
+--- 1013,1438 ----
   (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
   
   
@@ -278,7 +863,7 @@
 +     ("com.apple.inputmethod.TCIM.Jianyi"
 +      (title . "速")
 +      (cursor-color)
-+      (Cursor-type))
++      (cursor-type))
 +     ("com.apple.inputmethod.TCIM.Dayi"
 +      (title . "易")
 +      (cursor-color)
@@ -515,8 +1100,7 @@
 +       (progn
 + 	(setq default-input-method "MacOSX")
 + 	(add-hook 'minibuffer-setup-hook 'mac-change-language-to-us)
-+ 	(mac-translate-from-yen-to-backslash)
-+ 	(mac-add-key-passed-to-system 'shift))
++ 	(mac-translate-from-yen-to-backslash))
 +     (setq default-input-method nil)))
 + 
 + ;;
@@ -598,553 +1182,5 @@
 + 
   (provide 'ns-win)
   
-  ;; arch-tag: eb138a45-4e2e-4d68-b1c9-a39665731644
-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/Makefile.in src/Makefile.in
-*** ../emacs-23.3-0-lion/src/Makefile.in	2011-12-05 16:49:13.000000000 +0900
---- src/Makefile.in	2012-01-13 08:53:57.000000000 +0900
-*************** ns_appresdir=@ns_appresdir@/
-*** 545,551 ****
-  ns_appsrc=@ns_appsrc@
-  /* Object files for NeXTstep */
-  NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
-! 	fontset.o fringe.o image.o
-  #endif  /* HAVE_NS */
-  
-  #ifdef HAVE_WINDOW_SYSTEM
---- 545,551 ----
-  ns_appsrc=@ns_appsrc@
-  /* Object files for NeXTstep */
-  NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
-! 	fontset.o fringe.o image.o macim.o
-  #endif  /* HAVE_NS */
-  
-  #ifdef HAVE_WINDOW_SYSTEM
-*************** obj=    dispnew.o frame.o scroll.o xdisp
-*** 583,589 ****
-  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 \
-!   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 $(FONT_DRIVERS)
-  
---- 583,589 ----
-  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 \
-!   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 $(FONT_DRIVERS)
-  
-*************** nsterm.o: nsterm.m blockinput.h atimer.h
-*** 1168,1173 ****
---- 1168,1174 ----
-    termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \
-    $(INTERVALS_H) process.h coding.h lisp.h $(config_h)
-  nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h lisp.h $(config_h)
-+ macim.o: macim.m lisp.h blockinput.h termhooks.h keyboard.h buffer.h $(config_h)
-  process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
-     commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
-     blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/keyboard.c src/keyboard.c
-*** ../emacs-23.3-0-lion/src/keyboard.c	2011-12-05 16:49:13.000000000 +0900
---- src/keyboard.c	2012-01-13 08:53:57.000000000 +0900
-*************** kbd_buffer_get_event (kbp, used_mouse_me
-*** 4243,4250 ****
-          {
-            if (event->code == KEY_NS_PUT_WORKING_TEXT)
-              obj = Fcons (intern ("ns-put-working-text"), Qnil);
-!           else
-              obj = Fcons (intern ("ns-unput-working-text"), Qnil);
-  	  kbd_fetch_ptr = event + 1;
-            if (used_mouse_menu)
-              *used_mouse_menu = 1;
---- 4243,4252 ----
-          {
-            if (event->code == KEY_NS_PUT_WORKING_TEXT)
-              obj = Fcons (intern ("ns-put-working-text"), Qnil);
-!           else if (event->code == KEY_NS_UNPUT_WORKING_TEXT)
-              obj = Fcons (intern ("ns-unput-working-text"), Qnil);
-+ 	  else if (event->code == KEY_NS_PUT_MARKED_TEXT)
-+ 	    obj = Fcons (intern ("ns-put-marked-text"), event->arg);
-  	  kbd_fetch_ptr = event + 1;
-            if (used_mouse_menu)
-              *used_mouse_menu = 1;
-*************** keys_of_keyboard ()
-*** 12611,12616 ****
---- 12613,12620 ----
-  			    "ns-put-working-text");
-    initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",
-  			    "ns-unput-working-text");
-+   initial_define_lispy_key (Vspecial_event_map, "ns-put-marked-text",
-+ 			    "ns-put-marked-text");
-    /* 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 -p -N -x '*.o' ../emacs-23.3-0-lion/src/macim.m src/macim.m
-*** ../emacs-23.3-0-lion/src/macim.m	1970-01-01 09:00:00.000000000 +0900
---- src/macim.m	2012-01-13 08:53:57.000000000 +0900
-***************
-*** 0 ****
---- 1,178 ----
-+ /* Implementation of Input Method Extension for MacOS X.
-+    Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
-+    Taiichi Hashimoto <taiichi2 at mac.com>.
-+ */
-+ 
-+ #include "config.h"
-+ 
-+ #ifdef NS_IMPL_COCOA
-+ 
-+ #include <math.h>
-+ #include <sys/types.h>
-+ #include <time.h>
-+ #include <signal.h>
-+ #include <unistd.h>
-+ 
-+ #include <Carbon/Carbon.h>
-+ 
-+ #include "lisp.h"
-+ #include "blockinput.h"
-+ 
-+ enum output_method
-+ {
-+   output_initial,
-+   output_termcap,
-+   output_x_window,
-+   output_msdos_raw,
-+   output_w32,
-+   output_mac,
-+   output_ns
-+ } output_method;
-+ 
-+ #include "termhooks.h"
-+ #include "keyboard.h"
-+ #include "buffer.h"
-+ 
-+ extern Lisp_Object Qcurrent_input_method;
-+ extern int cursor_in_echo_area;
-+ static Lisp_Object Qmac_keys_passed_to_system;
-+ static Lisp_Object Vmac_use_input_method_on_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 ("mac-input-source-is-ascii-capable", Fmac_input_source_is_ascii_capable,
-+        Smac_input_source_is_ascii_capable, 0, 0, 0,
-+        doc: /* Is current input source ascii capable? */)
-+      ()
-+ {
-+   TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
-+   CFBooleanRef ret = TISGetInputSourceProperty(is, kTISPropertyInputSourceIsASCIICapable);
-+   
-+   return CFBooleanGetValue(ret)? Qt : Qnil;
-+ }
-+ 
-+ DEFUN ("mac-get-input-source-list", Fmac_get_input_source_list,
-+        Smac_get_input_source_list, 0, 0, 0,
-+        doc: /* get input source list on MacOSX */)
-+      ()
-+ {
-+   NSArray *is_list = (NSArray *)TISCreateInputSourceList(NULL, false);
-+   int list_size = [is_list count];
-+   Lisp_Object list[list_size];
-+   int i;
-+ 
-+   for (i = 0; i < list_size; i++) {
-+     TISInputSourceRef is = [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 ("mac-get-current-input-source", Fmac_get_current_input_source,
-+        Smac_get_current_input_source, 0, 0, 0,
-+        doc: /* get current input source on MacOSX */)
-+      ()
-+ {
-+   TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
-+   NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
-+ 
-+   return make_string([id UTF8String],
-+ 		     [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
-+ }
-+ 
-+ DEFUN ("mac-toggle-input-source", 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(locale);
-+     }
-+   if (is) TISSelectInputSource(is);
-+ 
-+   return arg;
-+ }
-+ 
-+ int
-+ mac_store_change_input_method_event ()
-+ {
-+   Lisp_Object dim;
-+   int ret = FALSE;
-+   
-+   dim = Fsymbol_value (intern ("default-input-method"));
-+   if (STRINGP (dim) && strcmp(SDATA (dim), "MacOSX") == 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) && modifiers == XINT (m))
-+ 	if (NILP (k)
-+ 	    || (NUMBERP (k) && code == XINT (k)))
-+ 	  return TRUE;
-+     }
-+   
-+   return FALSE;
-+ }
-+ 
-+ int
-+ mac_pass_key_directly_to_emacs ()
-+ {
-+ 
-+   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 (current_buffer->read_only))
-+ 	return TRUE;
-+     }
-+ 
-+   return FALSE;
-+ }
-+ 
-+ 
-+ void mac_init_input_method ()
-+ {
-+   Qmac_keys_passed_to_system = intern ("mac-keys-passed-to-system");
-+   staticpro (&Qmac_keys_passed_to_system);
-+ 
-+   DEFVAR_LISP ("mac-use-input-method-on-system", &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 (&Smac_input_source_is_ascii_capable);
-+   defsubr (&Smac_get_input_source_list);
-+   defsubr (&Smac_get_current_input_source);
-+   defsubr (&Smac_toggle_input_source);
-+ }
-+ #endif
-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/nsfns.m src/nsfns.m
-*** ../emacs-23.3-0-lion/src/nsfns.m	2011-12-05 16:49:13.000000000 +0900
---- src/nsfns.m	2012-01-13 08:53:57.000000000 +0900
-*************** Lisp_Object Fx_open_connection (Lisp_Obj
-*** 103,108 ****
---- 103,113 ----
-  
-  extern BOOL ns_in_resize;
-  
-+ /* key masks */
-+ static Lisp_Object Vns_shift_key_mask;
-+ static Lisp_Object Vns_control_key_mask;
-+ static Lisp_Object Vns_alternate_key_mask;
-+ static Lisp_Object Vns_command_key_mask;
-  
-  /* ==========================================================================
-  
-*************** be used as the image of the icon represe
-*** 2632,2637 ****
---- 2637,2660 ----
-                 doc: /* Toolkit version for NS Windowing.  */);
-    Vns_version_string = ns_appkit_version_str ();
-  
-+ 
-+   DEFVAR_LISP ("ns-shift-key-mask", &Vns_shift_key_mask,
-+                doc: /* Shift key mask defined in system. */);
-+   Vns_shift_key_mask = make_number (NSShiftKeyMask);
-+ 
-+   DEFVAR_LISP ("ns-control-key-mask", &Vns_control_key_mask,
-+                doc: /* Control key mask defined in system. */);
-+   Vns_control_key_mask = make_number (NSControlKeyMask);
-+ 
-+   DEFVAR_LISP ("ns-alternate-key-mask", &Vns_alternate_key_mask,
-+                doc: /* Alternate key mask defined in system. */);
-+   Vns_alternate_key_mask = make_number (NSAlternateKeyMask);
-+ 
-+   DEFVAR_LISP ("ns-command-key-mask", &Vns_command_key_mask,
-+                doc: /* Command key mask defined in system. */);
-+   Vns_command_key_mask = make_number (NSCommandKeyMask);
-+ 
-+ 
-    defsubr (&Sns_read_file_name);
-    defsubr (&Sns_get_resource);
-    defsubr (&Sns_set_resource);
-*************** be used as the image of the icon represe
-*** 2676,2681 ****
---- 2699,2708 ----
-    defsubr (&Sx_show_tip);
-    defsubr (&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 -p -N -x '*.o' ../emacs-23.3-0-lion/src/nsterm.h src/nsterm.h
-*** ../emacs-23.3-0-lion/src/nsterm.h	2011-12-05 16:49:13.000000000 +0900
---- src/nsterm.h	2012-01-13 08:53:57.000000000 +0900
-*************** typedef unsigned int NSUInteger;
-*** 365,370 ****
---- 365,372 ----
-  #define KEY_NS_NEW_FRAME               ((1<<28)|(0<<16)|12)
-  #define KEY_NS_TOGGLE_TOOLBAR          ((1<<28)|(0<<16)|13)
-  #define KEY_NS_SHOW_PREFS              ((1<<28)|(0<<16)|14)
-+ #define KEY_MAC_CHANGE_INPUT_METHOD    ((1<<28)|(0<<16)|15)
-+ #define KEY_NS_PUT_MARKED_TEXT         ((1<<28)|(0<<16)|16)
-  
-  /* could use list to store these, but rest of emacs has a big infrastructure
-     for managing a table of bitmap "records" */
-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/nsterm.m src/nsterm.m
-*** ../emacs-23.3-0-lion/src/nsterm.m	2011-12-05 16:50:06.000000000 +0900
---- src/nsterm.m	2012-01-13 08:53:57.000000000 +0900
-*************** ns_term_init (Lisp_Object display_name)
-*** 3730,3735 ****
---- 3730,3738 ----
-    /*   [[NSNotificationCenter defaultCenter] addObserver: NSApp
-                                           selector: @selector (logNotification:)
-                                               name: nil object: nil]; */
-+   [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
-+ 					selector: @selector (changeInputMethod:)
-+ 						   name: @"AppleSelectedInputSourcesChangedNotification" object: nil];
-  
-    dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
-    bzero (dpyinfo, sizeof (struct ns_display_info));
-*************** ns_term_shutdown (int sig)
-*** 3935,3940 ****
---- 3938,3955 ----
-      NSLog (@"notification: '%@'", [notification name]);
-  }
-  
-+ - (void)changeInputMethod: (NSNotification *)notification
-+ {
-+ 
-+   struct frame *emacsframe = SELECTED_FRAME ();
-+ 
-+   if (mac_store_change_input_method_event())
-+     {
-+       emacs_event->kind = NS_NONKEY_EVENT;
-+       emacs_event->code = KEY_MAC_CHANGE_INPUT_METHOD;
-+       EV_TRAILER ((id)nil);
-+     }
-+ }
-  
-  - (void)sendEvent: (NSEvent *)theEvent
-  /* --------------------------------------------------------------------------
-*************** ns_term_shutdown (int sig)
-*** 4488,4510 ****
-               code, fnKeysym, flags, emacs_event->modifiers);
-  
-        /* if it was a function key or had modifiers, pass it directly to emacs */
-!       if (fnKeysym || (emacs_event->modifiers
-!                        && [[theEvent charactersIgnoringModifiers] length] > 0))
-! /*[[theEvent characters] length] */
-!         {
-!           emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
-!           if (code < 0x20)
-!             code |= (1<<28)|(3<<16);
-!           else if (code == 0x7f)
-!             code |= (1<<28)|(3<<16);
-!           else if (!fnKeysym)
-!             emacs_event->kind = code > 0xFF
-!               ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
-  
-!           emacs_event->code = code;
-!           EV_TRAILER (theEvent);
-!           return;
-!         }
-      }
-  
-    /* if we get here we should send the key for input manager processing */
---- 4503,4540 ----
-               code, fnKeysym, flags, emacs_event->modifiers);
-  
-        /* if it was a function key or had modifiers, pass it directly to emacs */
-!       /* The function mac_pass_key_directly_to_emacs check special case 
-!          to pass it directly to emacs, such as passwd, read-only buffer, etc. */
-  
-!         if (mac_pass_key_directly_to_emacs ()
-! 	    || fnKeysym
-! 	    || (emacs_event->modifiers
-! 		&& [[theEvent charactersIgnoringModifiers] length] > 0))
-! 	  {
-! 	    emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
-! 	    if (code < 0x20)
-! 	      code |= (1<<28)|(3<<16);
-! 	    else if (code == 0x7f)
-! 	      code |= (1<<28)|(3<<16);
-! 	    else if (!fnKeysym)
-! 	      emacs_event->kind = code > 0xFF
-! 		? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
-! 	    
-! 	    emacs_event->code = code;
-! 
-! 	    /* The function mac_pass_key_to_system decides whether it is 
-! 	       passed directly to emacs or not. */
-! 	    if (emacs_event->kind == NON_ASCII_KEYSTROKE_EVENT
-! 		|| !mac_pass_key_to_system (code, flags
-! 					    & (NSShiftKeyMask
-! 					       | NSControlKeyMask
-! 					       | NSAlternateKeyMask
-! 					       | NSCommandKeyMask)))
-! 	      {
-! 		EV_TRAILER (theEvent);
-! 		return;
-! 	      }
-! 	  }
-      }
-  
-    /* if we get here we should send the key for input manager processing */
-*************** ns_term_shutdown (int sig)
-*** 4594,4603 ****
-      NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length],
-             selRange.length, selRange.location);
-  
--   if (workingText != nil)
--     [self deleteWorkingText];
-    if ([str length] == 0)
-!     return;
-  
-    if (!emacs_event)
-      return;
---- 4624,4642 ----
-      NSLog (@"setMarkedText '%@' len =%d range %d from %d", 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)
-*** 4607,4613 ****
-    ns_working_text = build_string ([workingText UTF8String]);
-  
-    emacs_event->kind = NS_TEXT_EVENT;
-!   emacs_event->code = KEY_NS_PUT_WORKING_TEXT;
-    EV_TRAILER ((id)nil);
-  }
-  
---- 4646,4654 ----
-    ns_working_text = build_string ([workingText UTF8String]);
-  
-    emacs_event->kind = NS_TEXT_EVENT;
-!   emacs_event->code = KEY_NS_PUT_MARKED_TEXT;
-!   emacs_event->arg = Fcons (make_number (selRange.location),
-! 			    Fcons (make_number (selRange.length), Qnil));
-    EV_TRAILER ((id)nil);
-  }
-  
-*************** ns_term_shutdown (int sig)
-*** 4662,4676 ****
-  {
-    NSRect rect;
-    NSPoint pt;
-!   struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
-    if (NS_KEYLOG)
-      NSLog (@"firstRectForCharRange request");
-  
-    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->phys_cursor.x);
-    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
-!                                        +FRAME_LINE_HEIGHT (emacsframe));
-  
-    pt = [self convertPoint: pt toView: nil];
-    pt = [[self window] convertBaseToScreen: pt];
---- 4703,4725 ----
-  {
-    NSRect rect;
-    NSPoint pt;
-!   //  struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
-!   struct window *win;
-    if (NS_KEYLOG)
-      NSLog (@"firstRectForCharRange request");
-+     
-+   if (NILP (Feval (Fcons (intern ("ns-in-echo-area"), Qnil))))
-+     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->phys_cursor.x);
-    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
-!                                        +FRAME_LINE_HEIGHT (emacsframe)+2);
-  
-    pt = [self convertPoint: pt toView: nil];
-    pt = [[self window] convertBaseToScreen: pt];
-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/s/darwin.h src/s/darwin.h
-*** ../emacs-23.3-0-lion/src/s/darwin.h	2011-12-05 16:49:29.000000000 +0900
---- src/s/darwin.h	2012-01-13 08:53:57.000000000 +0900
-*************** along with GNU Emacs.  If not, see <http
-*** 163,169 ****
-  /* Definitions for how to compile & link.  */
-  
-  #ifdef HAVE_NS
-! #define LIBS_NSGUI -framework AppKit
-  #define SYSTEM_PURESIZE_EXTRA 200000
-  #define HEADERPAD_EXTRA 6C8
-  #else /* !HAVE_NS */
---- 163,169 ----
-  /* Definitions for how to compile & link.  */
-  
-  #ifdef HAVE_NS
-! #define LIBS_NSGUI -framework AppKit -framework Carbon
-  #define SYSTEM_PURESIZE_EXTRA 200000
-  #define HEADERPAD_EXTRA 6C8
-  #else /* !HAVE_NS */
+  ;;; ns-win.el ends here
+

Deleted: trunk/dports/aqua/emacs-app/files/patch-macemacsjp-jpfont.diff
===================================================================
--- trunk/dports/aqua/emacs-app/files/patch-macemacsjp-jpfont.diff	2012-06-15 08:24:00 UTC (rev 94318)
+++ trunk/dports/aqua/emacs-app/files/patch-macemacsjp-jpfont.diff	2012-06-15 11:58:20 UTC (rev 94319)
@@ -1,30 +0,0 @@
-diff -pr ../emacs-23.3/src/nsfont.m src/nsfont.m
-*** ../emacs-23.3/src/nsfont.m	2011-01-09 02:45:14.000000000 +0900
---- src/nsfont.m	2011-03-21 17:11:01.000000000 +0900
-*************** nsfont_open (FRAME_PTR f, Lisp_Object fo
-*** 846,853 ****
-        lrint (hshrink * [sfont ascender] + expand * hd/2);
-      /* [sfont descender] is usually negative.  Use floor to avoid
-         clipping descenders. */
-!     font_info->max_bounds.descent =
-!       -lrint (floor(hshrink* [sfont descender] - expand*hd/2));
-      font_info->height =
-        font_info->max_bounds.ascent + font_info->max_bounds.descent;
-      font_info->max_bounds.width = lrint (font_info->width);
---- 846,861 ----
-        lrint (hshrink * [sfont ascender] + expand * hd/2);
-      /* [sfont descender] is usually negative.  Use floor to avoid
-         clipping descenders. */
-!     if ([sfont mostCompatibleStringEncoding] == 0x80000001) {
-!       /* If the font is Japanese (Mac OS) encoding, change descender to 2 times.
-!          Because most of Japanese font's decender, such as Hiragino, is 
-!          too short. */
-!       font_info->max_bounds.descent = 
-!         -lrint (floor(hshrink* [sfont descender] * 2 - expand*hd/2));
-!     } else {
-!       font_info->max_bounds.descent = 
-!         -lrint (floor(hshrink* [sfont descender] - expand*hd/2));
-!     }
-      font_info->height =
-        font_info->max_bounds.ascent + font_info->max_bounds.descent;
-      font_info->max_bounds.width = lrint (font_info->width);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120615/e70751ab/attachment-0001.html>


More information about the macports-changes mailing list