Ticket #33375: 0001-Updated-emacs-app-devel-to-a-recent-Emacs24-snapshot.patch

File 0001-Updated-emacs-app-devel-to-a-recent-Emacs24-snapshot.patch, 60.3 KB (added by dave@…, 13 years ago)
  • aqua/emacs-app-devel/Portfile

    From d7cb78d35bc7be1406c10c1ff48954397e3aa92e Mon Sep 17 00:00:00 2001
    From: Dave Abrahams <dave@boostpro.com>
    Date: Mon, 27 Feb 2012 12:10:52 -0500
    Subject: [PATCH] Updated emacs-app-devel to a recent Emacs24 snapshot
    
    ---
     aqua/emacs-app-devel/Portfile                      |  113 ++-
     aqua/emacs-app-devel/files/patch-clang.diff        |   33 +
     .../emacs-app-devel/files/patch-fix-title-bar.diff |   14 +
     aqua/emacs-app-devel/files/patch-fullscreen.diff   |  222 ++++
     .../files/patch-lion-fullscreen.diff               |   54 +
     .../files/patch-macemacsjp-inline.diff             | 1110 ++++++++++++++++++++
     .../files/patch-macemacsjp-jpfont.diff             |   30 +
     aqua/emacs-app-devel/files/patch-src_emacs.c.diff  |   37 +
     aqua/emacs-app-devel/files/patch-srgb.diff         |   15 +
     9 files changed, 1606 insertions(+), 22 deletions(-)
     create mode 100644 aqua/emacs-app-devel/files/patch-clang.diff
     create mode 100644 aqua/emacs-app-devel/files/patch-fix-title-bar.diff
     create mode 100644 aqua/emacs-app-devel/files/patch-fullscreen.diff
     create mode 100644 aqua/emacs-app-devel/files/patch-lion-fullscreen.diff
     create mode 100644 aqua/emacs-app-devel/files/patch-macemacsjp-inline.diff
     create mode 100644 aqua/emacs-app-devel/files/patch-macemacsjp-jpfont.diff
     create mode 100644 aqua/emacs-app-devel/files/patch-src_emacs.c.diff
     create mode 100644 aqua/emacs-app-devel/files/patch-srgb.diff
    
    diff --git a/aqua/emacs-app-devel/Portfile b/aqua/emacs-app-devel/Portfile
    index 7feaf17..b584af9 100644
    a b  
     1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
    12# $Id: Portfile 60082 2009-11-01 13:40:22Z css@macports.org $
    23
    34PortSystem 1.0
    45
    56name            emacs-app-devel
    6 version         20091101
     7version         20120227
    78
    89categories      aqua editors
    910maintainers     css
    10 description     The GNU Emacs text editor, recent CVS development version
    11 long_description \
    12    GNU Emacs is a self-documenting, customizable, extensible real-time \
    13    display editor. Users new to Emacs will be able to use basic        \
    14    features fairly rapidly by studying the tutorial and using the      \
    15    self-documentation features. Emacs also has an extensive            \
    16    interactive manual browser. It is easily extensible since its       \
    17    editing commands are written in Lisp. This port uses the CVS version\
    18    of the code from a recent date, which includes the NextStep (aqua)  \
    19    option
    20 
    21 platforms       darwin freebsd
     11
     12description         The GNU Emacs text editor (Cocoa version)
     13
     14long_description    GNU Emacs is a self-documenting, customizable, extensible  \
     15                    real-time display editor. This is a port of the latest GNU \
     16                    Emacs source to the OpenStep (or NeXTstep) APIs, as        \
     17                    implemented by Cocoa on OS X. It differs from Carbon ports \
     18                    of GNU Emacs in that it makes a more concerted attempt     \
     19                    from the ground up to follow OS X desktop and UI conventions.
     20
     21# Note that this distribution can support GNUstep as well, but that
     22# configuration is untested at this time.
     23
     24homepage            http://www.gnu.org/software/emacs/
     25platforms           darwin
     26license             GPL-3+
     27
    2228homepage        http://www.gnu.org/software/emacs/emacs.html
     29master_sites    http://repo.or.cz/w/emacs.git/snapshot
     30distfiles       dc198438fa4fb9c1c0f9f3e8e94836f93f9ee8ef.tar.gz
     31
     32checksums           md5     2c7ebbe3bbcc30b2164b1402995ad6f3 \
     33                    sha1    c41ef837c8dfc3b693e980a1ad23430543b5d977
    2334
    24 fetch.type      cvs
    25 cvs.root        :pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs
    26 cvs.date        2009-11-01
    27 cvs.module      emacs
    28 worksrcdir      emacs
     35worksrcdir     emacs
     36
     37pre-configure {
     38    system "cd ${worksrcpath}; sh ./autogen.sh"
     39}
     40
     41depends_lib     port:ncurses \
     42                port:texinfo
    2943
    30 configure.args  --with-ns --without-x --without-dbus
    31 depends_lib     port:ncurses
    3244use_parallel_build      yes
    3345
     46patchfiles          patch-src_emacs.c.diff \
     47                    patch-srgb.diff
     48
     49# if {${configure.compiler} == "clang"} {
     50#     patchfiles-append   patch-clang.diff
     51# }
     52
     53post-patch {
     54    reinplace "s|__PREFIX__|${prefix}|" ${worksrcpath}/src/emacs.c
     55}
     56
     57configure.args      --with-ns --without-x --without-dbus
     58
     59depends_build   port:autoconf \
     60                port:automake
     61
     62use_parallel_build  yes
     63
    3464destroot {
    3565        system "cd ${worksrcpath} && make install"     
    3666        xinstall -m 755 -d ${destroot}${applications_dir}
    destroot { 
    4171}
    4272
    4373post-destroot {
    44         reinplace "s|__PREFIX__|${prefix}|g" \
    45                 ${destroot}${applications_dir}/Emacs.app/Contents/Resources/site-lisp/site-start.el
     74    reinplace "s|__PREFIX__|${prefix}|g" \
     75        ${destroot}${applications_dir}/Emacs.app/Contents/Resources/site-lisp/site-start.el
     76}
     77
     78# patch-fullscreen.diff
     79#   http://gist.github.com/291150
     80#   http://www.sanityinc.com/full-screen-support-for-cocoa-emacs-on-osx
     81variant fullscreen description {Add fullscreen patch} {
     82    patchfiles-append   patch-fullscreen.diff
    4683}
     84
     85# inline and font patches are fetched from MacEmacsJP.
     86#   http://svn.sourceforge.jp/svnroot/macemacsjp/inline_patch/trunk/
     87#   revision 574.
     88# patch-macemacsjp-inline.diff <= emacs-inline.patch
     89# patch-macemacsjp-jpfont.diff <= font.patch
     90#
     91# These currently don't apply to Emacs24, and I don't have the expertise to update them
     92# variant inline description {Add inline patch from MacEmacsJP} {
     93#     patchfiles-append   patch-macemacsjp-inline.diff
     94# }
     95
     96# variant jpfont description {Add Japanese font patch from MacEmacsJP} {
     97#     patchfiles-append   patch-macemacsjp-jpfont.diff
     98# }
     99
     100# variant patches requires fullscreen inline jpfont description {Add all patches: fullscreen, inline and jpfont} {}
     101
     102platform darwin 11 {
     103   # patchfiles-append    patch-fix-title-bar.diff
     104   # patch-lion-fullscreen.diff
     105   #   https://github.com/downloads/typester/emacs/emacs-23-lion-fullscreen-test.patch
     106   if {[variant_isset fullscreen]} {
     107       patchfiles-append   patch-lion-fullscreen.diff
     108   }
     109   configure.cflags-append   -fno-pie -O2
     110   configure.ldflags-append  -fno-pie
     111}
     112
     113livecheck.type      md5
     114livecheck.url       http://repo.or.cz/w/emacs.git/snapshot/master.tar.gz
     115livecheck.md5       2c7ebbe3bbcc30b2164b1402995ad6f3
  • new file aqua/emacs-app-devel/files/patch-clang.diff

    diff --git a/aqua/emacs-app-devel/files/patch-clang.diff b/aqua/emacs-app-devel/files/patch-clang.diff
    new file mode 100644
    index 0000000..32ea6b5
    - +  
     1--- src/nsfont.m~       2011-10-05 22:55:46.000000000 +0900
     2+++ src/nsfont.m        2011-10-05 23:03:53.000000000 +0900
     3@@ -1286,7 +1286,7 @@
     4       }
     5 
     6     CGContextRestoreGState (gcontext);
     7-    return;
     8+    return 0;
     9   }
     10 #endif  /* NS_IMPL_COCOA */
     11 
     12--- src/nsimage.m~      2011-01-09 02:45:14.000000000 +0900
     13+++ src/nsimage.m       2011-10-05 23:14:17.000000000 +0900
     14@@ -325,7 +325,7 @@
     15 
     16 /* Set color for a bitmap image (see initFromSkipXBM).  Note that the alpha
     17    is used as a mask, so we just memset the entire array. */
     18-- setXBMColor: (NSColor *)color
     19+- (void) setXBMColor: (NSColor *)color
     20 {
     21   NSSize s = [self size];
     22   int len = (int) s.width * s.height;
     23--- src/nsterm.m~       2011-10-05 22:55:46.000000000 +0900
     24+++ src/nsterm.m        2011-10-05 22:59:43.000000000 +0900
     25@@ -5494,7 +5494,7 @@
     26   NSTRACE (performDragOperation);
     27 
     28   if (!emacs_event)
     29-    return;
     30+    return NO;
     31 
     32   position = [self convertPoint: [sender draggingLocation] fromView: nil];
     33   x = lrint (position.x);  y = lrint (position.y);
  • new file aqua/emacs-app-devel/files/patch-fix-title-bar.diff

    diff --git a/aqua/emacs-app-devel/files/patch-fix-title-bar.diff b/aqua/emacs-app-devel/files/patch-fix-title-bar.diff
    new file mode 100644
    index 0000000..f36fc33
    - +  
     1--- src/ChangeLog.orig  2011-07-23 12:31:39.000000000 -0400
     2+++ src/ChangeLog       2011-07-23 12:31:39.000000000 -0400
     3--- src/nsterm.m.orig   2011-07-23 12:31:39.000000000 -0400
     4+++ src/nsterm.m        2011-07-23 12:31:39.000000000 -0400
     5@@ -5106,7 +5106,8 @@
     6 
     7   win = [[EmacsWindow alloc]
     8             initWithContentRect: r
     9-                      styleMask: (NSResizableWindowMask |
     10+                      styleMask: (NSTitledWindowMask |
     11+                                  NSResizableWindowMask |
     12                                   NSMiniaturizableWindowMask |
     13                                   NSClosableWindowMask)
     14                         backing: NSBackingStoreBuffered
  • new file aqua/emacs-app-devel/files/patch-fullscreen.diff

    diff --git a/aqua/emacs-app-devel/files/patch-fullscreen.diff b/aqua/emacs-app-devel/files/patch-fullscreen.diff
    new file mode 100644
    index 0000000..c87d5bb
    - +  
     1--- lisp/term/ns-win.el.orig    2011-01-29 15:01:48.000000000 -0500
     2+++ lisp/term/ns-win.el 2011-01-29 15:01:52.000000000 -0500
     3@@ -930,6 +930,10 @@
     4 (add-to-list 'frame-creation-function-alist '(ns . x-create-frame-with-faces))
     5 (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
     6 
     7+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
     8+(defun ns-toggle-fullscreen ()
     9+  (interactive)
     10+  (ns-toggle-fullscreen-internal))
     11 
     12 (provide 'ns-win)
     13 
     14--- src/nsfns.m.orig    2011-01-29 15:01:48.000000000 -0500
     15+++ src/nsfns.m 2011-01-29 15:01:52.000000000 -0500
     16@@ -2599,6 +2599,34 @@
     17 
     18 #endif
     19 
     20+DEFUN ("ns-toggle-fullscreen-internal", Fns_toggle_fullscreen_internal, Sns_toggle_fullscreen_internal,
     21+       0, 0, 0,
     22+       doc: /* Toggle fulscreen mode */)
     23+    ()
     24+{
     25+    struct frame *f = SELECTED_FRAME();
     26+    EmacsWindow *window = ns_get_window(f);
     27+
     28+    EmacsWindow *new_window = [window toggleFullscreen];
     29+    FRAME_NS_WINDOW(f) = new_window;
     30+
     31+    NSRect r = [new_window contentRectForFrameRect:[new_window frame]];
     32+    int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(f, r.size.width);
     33+    int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, r.size.height);
     34+
     35+    change_frame_size (f, rows, cols, 0, 1, 0); /* pretend, delay, safe */
     36+    FRAME_PIXEL_WIDTH (f) = (int)r.size.width;
     37+    FRAME_PIXEL_HEIGHT (f) = (int)r.size.height;
     38+
     39+    f->border_width = [new_window frame].size.width - r.size.width;
     40+    FRAME_NS_TITLEBAR_HEIGHT (f) =
     41+        [new_window frame].size.height - r.size.height;
     42+
     43+    [[new_window delegate] windowDidMove:nil];
     44+
     45+    return Qnil;
     46+}
     47+
     48 
     49 /* ==========================================================================
     50 
     51@@ -2684,6 +2712,8 @@
     52   defsubr (&Sx_show_tip);
     53   defsubr (&Sx_hide_tip);
     54 
     55+  defsubr (&Sns_toggle_fullscreen_internal);
     56+
     57   /* used only in fontset.c */
     58   check_window_system_func = check_ns;
     59 
     60--- src/nsterm.h.orig   2011-01-29 15:01:48.000000000 -0500
     61+++ src/nsterm.h        2011-01-29 15:01:52.000000000 -0500
     62@@ -95,8 +95,25 @@
     63 {
     64   NSPoint grabOffset;
     65 }
     66+
     67+-(EmacsWindow *)toggleFullscreen;
     68+
     69+@end
     70+
     71+/* 10.5 or below is not supported [NSWindow setStyleMask:], so require content swap hack */
     72+@interface EmacsFullWindow : EmacsWindow {
     73+    EmacsWindow *normalWindow;
     74+}
     75+
     76+-(id)initWithNormalWindow:(EmacsWindow *)window;
     77+-(EmacsWindow *)getNormalWindow;
     78+
     79 @end
     80 
     81+// dummy for 10.5-
     82+#define NSApplicationPresentationDefault 0
     83+#define NSApplicationPresentationAutoHideDock (1 <<  0)
     84+#define NSApplicationPresentationAutoHideMenuBar (1 <<  2)
     85 
     86 /* ==========================================================================
     87 
     88--- src/nsterm.m.orig   2011-01-29 15:01:48.000000000 -0500
     89+++ src/nsterm.m        2011-01-29 15:01:52.000000000 -0500
     90@@ -685,6 +685,13 @@
     91 /*debug_lock--; */
     92             }
     93 
     94+          if (view) {
     95+              EmacsFullWindow *win = [view window];
     96+              if ([win isKindOfClass:[EmacsFullWindow class]]) {
     97+                  [[win getNormalWindow] orderOut:nil];
     98+              }
     99+          }
     100+
     101           if (view)
     102 #ifdef NS_IMPL_GNUSTEP
     103             r ? [view lockFocusInRect: u] : [view lockFocus];
     104@@ -1130,8 +1137,14 @@
     105   f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f);
     106   compute_fringe_widths (f, 0);
     107 
     108-  pixelwidth =  FRAME_TEXT_COLS_TO_PIXEL_WIDTH   (f, cols);
     109-  pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
     110+  if ([window isKindOfClass:[EmacsFullWindow class]]) {
     111+      pixelwidth = [[window screen] frame].size.width;
     112+      pixelheight = [[window screen] frame].size.height;
     113+  }
     114+  else {
     115+      pixelwidth =  FRAME_TEXT_COLS_TO_PIXEL_WIDTH   (f, cols);
     116+      pixelheight = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
     117+  }
     118 
     119   /* If we have a toolbar, take its height into account. */
     120   if (tb)
     121@@ -1196,7 +1209,7 @@
     122   change_frame_size (f, rows, cols, 0, 1, 0); /* pretend, delay, safe */
     123   FRAME_PIXEL_WIDTH (f) = pixelwidth;
     124   FRAME_PIXEL_HEIGHT (f) = pixelheight;
     125-/*  SET_FRAME_GARBAGED (f); // this short-circuits expose call in drawRect */
     126+  /*  SET_FRAME_GARBAGED (f); // this short-circuits expose call in drawRect */
     127 
     128   mark_window_cursors_off (XWINDOW (f->root_window));
     129   cancel_mouse_face (f);
     130@@ -5589,6 +5602,59 @@
     131 
     132 @implementation EmacsWindow
     133 
     134+-(NSWindow *)toggleFullscreen {
     135+    BOOL isFullscreen = [[self className] isEqualToString:@"EmacsFullWindow"];
     136+    NSWindow *win;
     137+
     138+    if (isFullscreen) {
     139+        EmacsFullWindow *f = (EmacsFullWindow *)self;
     140+        EmacsWindow *w = [f getNormalWindow];
     141+
     142+        [w setContentView:[f contentView]];
     143+        [w makeKeyAndOrderFront:nil];
     144+
     145+        [f close];
     146+
     147+        win = w;
     148+
     149+        if ([[self screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) {
     150+            if ([NSApp respondsToSelector:@selector(setPresentationOptions:)]) {
     151+                [NSApp setPresentationOptions:NSApplicationPresentationDefault];
     152+            }
     153+            else {
     154+                [NSMenu setMenuBarVisible:YES];
     155+            }
     156+        }
     157+    }
     158+    else {
     159+        [self deminiaturize:nil];
     160+
     161+        if ([[self screen] isEqual:[[NSScreen screens] objectAtIndex:0]]) {
     162+            if ([NSApp respondsToSelector:@selector(setPresentationOptions:)]) {
     163+                [NSApp setPresentationOptions:NSApplicationPresentationAutoHideDock | NSApplicationPresentationAutoHideMenuBar];
     164+            }
     165+            else {
     166+                [NSMenu setMenuBarVisible:NO];
     167+            }
     168+        }
     169+
     170+        [self orderOut:nil];
     171+
     172+        EmacsFullWindow *f = [[EmacsFullWindow alloc] initWithNormalWindow:self];
     173+        EmacsView *view = (EmacsView *)[self delegate];
     174+        [f setDelegate:view];
     175+        [f makeFirstResponder:view];
     176+        [f setContentView:[self contentView]];
     177+        [f setContentSize:[[self screen] frame].size];
     178+        [f setTitle:[self title]];
     179+        [f makeKeyAndOrderFront:nil];
     180+
     181+        win = f;
     182+    }
     183+
     184+    return win;
     185+}
     186+
     187 /* called only on resize clicks by special case in EmacsApp-sendEvent */
     188 - (void)mouseDown: (NSEvent *)theEvent
     189 {
     190@@ -5647,6 +5713,32 @@
     191 
     192 @end /* EmacsWindow */
     193 
     194+@implementation EmacsFullWindow
     195+
     196+-(BOOL)canBecomeKeyWindow {
     197+    return YES;
     198+}
     199+
     200+-(id)initWithNormalWindow:(EmacsWindow *)window {
     201+    self = [super initWithContentRect:[window contentRectForFrameRect:[[window screen] frame]]
     202+                            styleMask:NSBorderlessWindowMask
     203+                              backing:NSBackingStoreBuffered
     204+                                defer:YES];
     205+    if (self) {
     206+        normalWindow = window;
     207+        [self setAcceptsMouseMovedEvents: YES];
     208+        [self useOptimizedDrawing: YES];
     209+    }
     210+
     211+    return self;
     212+}
     213+
     214+-(EmacsWindow *)getNormalWindow {
     215+    return normalWindow;
     216+}
     217+
     218+@end /* EmacsFullWindow */
     219+
     220 
     221 /* ==========================================================================
     222 
  • new file aqua/emacs-app-devel/files/patch-lion-fullscreen.diff

    diff --git a/aqua/emacs-app-devel/files/patch-lion-fullscreen.diff b/aqua/emacs-app-devel/files/patch-lion-fullscreen.diff
    new file mode 100644
    index 0000000..dce8cbb
    - +  
     1--- src/nsterm.m.old    2011-11-25 22:36:38.000000000 +0900
     2+++ src/nsterm.m        2011-11-25 22:59:56.000000000 +0900
     3@@ -5182,6 +5182,7 @@
     4   [win setAcceptsMouseMovedEvents: YES];
     5   [win setDelegate: self];
     6   [win useOptimizedDrawing: YES];
     7+  [win setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
     8 
     9   sz.width = FRAME_COLUMN_WIDTH (f);
     10   sz.height = FRAME_LINE_HEIGHT (f);
     11@@ -5671,6 +5672,43 @@
     12   cols = c;
     13 }
     14 
     15+- (NSApplicationPresentationOptions)window:(NSWindow *)window willUseFullScreenPresentationOptions:(NSApplicationPresentationOptions)proposedOptions {
     16+    return proposedOptions | NSApplicationPresentationAutoHideToolbar;
     17+}
     18+
     19+- (NSSize)window:(NSWindow *)window willUseFullScreenContentSize:(NSSize)proposedSize {
     20+    NSRect r = NSMakeRect(0.f, 0.f, proposedSize.width, proposedSize.height);
     21+    int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, r.size.width);
     22+    int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, r.size.height);
     23+
     24+    change_frame_size (emacsframe, rows, cols, 0, 1, 0); /* pretend, delay, safe */
     25+    FRAME_PIXEL_WIDTH (emacsframe) = (int)r.size.width;
     26+    FRAME_PIXEL_HEIGHT (emacsframe) = (int)r.size.height;
     27+
     28+    emacsframe->border_width = [window frame].size.width - r.size.width;
     29+    FRAME_NS_TITLEBAR_HEIGHT (emacsframe) = 0;
     30+
     31+    return proposedSize;
     32+}
     33+
     34+- (void)windowDidExitFullScreen:(NSNotification *)notification {
     35+    NSWindow* window = [notification object];
     36+
     37+    NSRect r = [window contentRectForFrameRect:[window frame]];
     38+    int cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS(emacsframe, r.size.width);
     39+    int rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(emacsframe, r.size.height);
     40+
     41+    change_frame_size (emacsframe, rows, cols, 0, 1, 0); /* pretend, delay, safe */
     42+    FRAME_PIXEL_WIDTH (emacsframe) = (int)r.size.width;
     43+    FRAME_PIXEL_HEIGHT (emacsframe) = (int)r.size.height;
     44+
     45+    emacsframe->border_width = [window frame].size.width - r.size.width;
     46+    FRAME_NS_TITLEBAR_HEIGHT (emacsframe) =
     47+        [window frame].size.height - r.size.height;
     48+
     49+    [[window delegate] windowDidMove:nil];
     50+}
     51+
     52 @end  /* EmacsView */
     53 
     54 
  • new file aqua/emacs-app-devel/files/patch-macemacsjp-inline.diff

    diff --git a/aqua/emacs-app-devel/files/patch-macemacsjp-inline.diff b/aqua/emacs-app-devel/files/patch-macemacsjp-inline.diff
    new file mode 100644
    index 0000000..ecbbacc
    - +  
     1diff -r -p -x '*.elc' ../emacs-23.2.94-0/lisp/term/ns-win.el lisp/term/ns-win.el
     2*** ../emacs-23.2.94-0/lisp/term/ns-win.el      2011-01-27 05:35:09.000000000 +0900
     3--- lisp/term/ns-win.el 2011-02-28 13:08:01.000000000 +0900
     4*************** The properties returned may include `top
     5*** 317,322 ****
     6--- 317,323 ----
     7             (cons (logior (lsh 0 16)  12) 'ns-new-frame)
     8             (cons (logior (lsh 0 16)  13) 'ns-toggle-toolbar)
     9             (cons (logior (lsh 0 16)  14) 'ns-show-prefs)
     10+            (cons (logior (lsh 0 16)  15) 'mac-change-input-method)
     11             (cons (logior (lsh 1 16)  32) 'f1)
     12               (cons (logior (lsh 1 16)  33) 'f2)
     13               (cons (logior (lsh 1 16)  34) 'f3)
     14*************** The properties returned may include `top
     15*** 549,562 ****
     16  ;; editing window.)
     17 
     18  (defface ns-working-text-face
     19!   '((t :underline t))
     20    "Face used to highlight working text during compose sequence insert."
     21    :group 'ns)
     22 
     23  (defvar ns-working-overlay nil
     24    "Overlay used to highlight working text during compose sequence insert.
     25  When text is in th echo area, this just stores the length of the working text.")
     26 
     27  (defvar ns-working-text)              ; nsterm.m
     28 
     29  ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
     30--- 550,579 ----
     31  ;; editing window.)
     32 
     33  (defface ns-working-text-face
     34!   '((((background dark)) :underline "gray80")
     35!     (t :underline "gray20"))
     36    "Face used to highlight working text during compose sequence insert."
     37    :group 'ns)
     38 
     39+ (defface ns-marked-text-face
     40+   '((((background dark)) :underline "gray80")
     41+     (t :underline "gray20"))
     42+   "Face used to highlight marked text during compose sequence insert."
     43+   :group 'ns)
     44+
     45+ (defface ns-unmarked-text-face
     46+   '((((background dark)) :underline "gray20")
     47+     (t :underline "gray80"))
     48+   "Face used to highlight marked text during compose sequence insert."
     49+   :group 'ns)
     50+
     51  (defvar ns-working-overlay nil
     52    "Overlay used to highlight working text during compose sequence insert.
     53  When text is in th echo area, this just stores the length of the working text.")
     54 
     55+ (defvar ns-marked-overlay nil
     56+   "Overlay used to highlight marked text during compose sequence insert.")
     57+
     58  (defvar ns-working-text)              ; nsterm.m
     59 
     60  ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
     61*************** is currently being used."
     62*** 583,588 ****
     63--- 600,606 ----
     64  (defun ns-put-working-text ()
     65    (interactive)
     66    (if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text)))
     67+
     68  (defun ns-unput-working-text ()
     69    (interactive)
     70    (ns-delete-working-text))
     71*************** The overlay is assigned the face `ns-wor
     72*** 604,622 ****
     73  (defun ns-echo-working-text ()
     74    "Echo contents of `ns-working-text' in message display area.
     75  See `ns-insert-working-text'."
     76-   (ns-delete-working-text)
     77    (let* ((msg (current-message))
     78!        (msglen (length msg))
     79!        message-log-max)
     80      (setq ns-working-overlay (length ns-working-text))
     81      (setq msg (concat msg ns-working-text))
     82      (put-text-property msglen (+ msglen ns-working-overlay)
     83!                      'face 'ns-working-text-face msg)
     84      (message "%s" msg)))
     85 
     86  (defun ns-delete-working-text()
     87!   "Delete working text and clear `ns-working-overlay'."
     88    (interactive)
     89    (cond
     90     ((and (overlayp ns-working-overlay)
     91           ;; Still alive?
     92--- 622,700 ----
     93  (defun ns-echo-working-text ()
     94    "Echo contents of `ns-working-text' in message display area.
     95  See `ns-insert-working-text'."
     96    (let* ((msg (current-message))
     97!          (msglen (length msg))
     98!          message-log-max)
     99!     (if (integerp ns-working-overlay)
     100!       (progn
     101!         (setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
     102!         (setq msglen (length msg))))
     103      (setq ns-working-overlay (length ns-working-text))
     104      (setq msg (concat msg ns-working-text))
     105      (put-text-property msglen (+ msglen ns-working-overlay)
     106!                       'face 'ns-working-text-face msg)
     107!      (message "%s" msg)))
     108!
     109! (defun ns-put-marked-text (event)
     110!   (interactive "e")
     111!
     112!   (let ((pos (nth 1 event))
     113!       (len (nth 2 event)))
     114!     (if (ns-in-echo-area)
     115!       (ns-echo-marked-text pos len)
     116!       (ns-insert-marked-text pos len))))
     117!
     118! (defun ns-insert-marked-text (pos len)
     119!   "Insert contents of `ns-working-text' as UTF-8 string and mark with
     120! `ns-working-overlay' and `ns-marked-overlay'.  Any previously existing
     121! working text is cleared first. The overlay is assigned the faces
     122! `ns-working-text-face' and `ns-marked-text-face'."
     123!   (ns-delete-working-text)
     124!   (let ((start (point)))
     125!     (put-text-property pos len 'face 'ns-working-text-face ns-working-text)
     126!     (insert ns-working-text)
     127!     (if (= len 0)
     128!         (overlay-put (setq ns-working-overlay
     129!                            (make-overlay start (point) (current-buffer) nil t))
     130!                      'face 'ns-working-text-face)
     131!       (overlay-put (setq ns-working-overlay
     132!                          (make-overlay start (point) (current-buffer) nil t))
     133!                    'face 'ns-unmarked-text-face)
     134!       (overlay-put (setq ns-marked-overlay
     135!                          (make-overlay (+ start pos) (+ start pos len)
     136!                                        (current-buffer) nil t))
     137!                    'face 'ns-marked-text-face))
     138!     (goto-char (+ start pos))))
     139!     
     140! (defun ns-echo-marked-text (pos len)
     141!   "Echo contents of `ns-working-text' in message display area.
     142! See `ns-insert-working-text'."
     143!   (let* ((msg (current-message))
     144!          (msglen (length msg))
     145!          message-log-max)
     146!     (when (integerp ns-working-overlay)
     147!       (setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
     148!       (setq msglen (length msg)))
     149!     (setq ns-working-overlay (length ns-working-text))
     150!     (setq msg (concat msg ns-working-text))
     151!     (if (> len 0)
     152!         (put-text-property msglen (+ msglen ns-working-overlay)
     153!                            'face 'ns-working-text-face msg)
     154!       (put-text-property msglen (+ msglen ns-working-overlay)
     155!                          'face 'ns-unmarked-text-face msg)
     156!       (put-text-property (+ msglen pos) (+ msglen pos len)
     157!                          'face 'ns-marked-text-face msg))
     158      (message "%s" msg)))
     159 
     160  (defun ns-delete-working-text()
     161!   "Delete working text and clear `ns-working-overlay' and `ns-marked-overlay'."
     162    (interactive)
     163+   (when (and (overlayp ns-marked-overlay)
     164+            ;; Still alive
     165+            (overlay-buffer ns-marked-overlay))
     166+     (with-current-buffer (overlay-buffer ns-marked-overlay)
     167+       (delete-overlay ns-marked-overlay)))
     168+   (setq ns-marked-overlay nil)
     169    (cond
     170     ((and (overlayp ns-working-overlay)
     171           ;; Still alive?
     172*************** the operating system.")
     173*** 1267,1272 ****
     174--- 1345,1731 ----
     175  (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
     176 
     177 
     178+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     179+ ;;
     180+ ;; Implementation of Input Method Extension for MacOS X
     181+ ;; written by Taiichi Hashimoto <taiichi2@mac.com>
     182+ ;;
     183+
     184+ (defvar mac-input-method-parameters
     185+   '(
     186+     ("com.apple.inputmethod.Kotoeri.Roman"
     187+      (title . "A")
     188+      (cursor-color)
     189+      (cursor-type))
     190+     ("com.apple.inputmethod.Kotoeri.Japanese"
     191+      (title . "あ")
     192+      (cursor-color)
     193+      (cursor-type))
     194+     ("com.apple.inputmethod.Kotoeri.Japanese.Katakana"
     195+      (title . "ア")
     196+      (cursor-color)
     197+      (cursor-type))
     198+     ("com.apple.inputmethod.Kotoeri.Japanese.FullWidthRoman"
     199+      (title . "A")
     200+      (cursor-color)
     201+      (cursor-type))
     202+     ("com.apple.inputmethod.Kotoeri.Japanese.HalfWidthKana"
     203+      (title . "ア")
     204+      (cursor-color)
     205+      (cursor-type))
     206+     ("com.apple.inputmethod.kotoeri.Ainu"
     207+      (title . "アイヌ")
     208+      (cursor-color)
     209+      (cursor-type))
     210+     ("com.apple.inputmethod.Korean.2SetKorean"
     211+      (title . "가2")
     212+      (cursor-color)
     213+      (cursor-type))
     214+     ("com.apple.inputmethod.Korean.3SetKorean"
     215+      (title . "가3")
     216+      (cursor-color)
     217+      (cursor-type))
     218+     ("com.apple.inputmethod.Korean.390Sebulshik"
     219+      (title . "가5")
     220+      (cursor-color)
     221+      (cursor-type))
     222+     ("com.apple.inputmethod.Korean.GongjinCheongRomaja"
     223+      (title . "가G")
     224+      (cursor-color)
     225+      (cursor-type))
     226+     ("com.apple.inputmethod.Korean.HNCRomaja"
     227+      (title . "가H")
     228+      (cursor-color)
     229+      (cursor-type))
     230+     ("com.apple.inputmethod.Tamil.AnjalIM"
     231+      (title . "Anjal")
     232+      (cursor-color)
     233+      (cursor-type))
     234+     ("com.apple.inputmethod.Tamil.Tamil99"
     235+      (title . "Tamil")
     236+      (cursor-color)
     237+      (cursor-type))
     238+     ("com.apple.inputmethod.VietnameseIM.VietnameseSimpleTelex"
     239+      (title . "ST")
     240+      (cursor-color)
     241+      (cursor-type))
     242+     ("com.apple.inputmethod.VietnameseIM.VietnameseTelex"
     243+      (title . "TX")
     244+      (cursor-color)
     245+      (cursor-type))
     246+     ("com.apple.inputmethod.VietnameseIM.VietnameseVNI"
     247+      (title . "VN")
     248+      (cursor-color)
     249+      (cursor-type))
     250+     ("com.apple.inputmethod.VietnameseIM.VietnameseVIQR"
     251+      (title . "VQ")
     252+      (cursor-color)
     253+      (cursor-type))
     254+     ("com.apple.inputmethod.SCIM.ITABC"
     255+      (title . "拼")
     256+      (cursor-color)
     257+      (cursor-type))
     258+     ("com.apple.inputmethod.SCIM.WBX"
     259+      (title . "型")
     260+      (cursor-color)
     261+      (cursor-type))
     262+     ("com.apple.inputmethod.SCIM.WBH"
     263+      (title . "画")
     264+      (cursor-color)
     265+      (cursor-type))
     266+     ("com.apple.inputmethod.TCIM.Zhuyin"
     267+      (title . "注")
     268+      (cursor-color)
     269+      (cursor-type))
     270+     ("com.apple.inputmethod.TCIM.Pinyin"
     271+      (title . "拼")
     272+      (cursor-color)
     273+      (cursor-type))
     274+     ("com.apple.inputmethod.TCIM.Cangjie"
     275+      (title . "倉")
     276+      (cursor-color)
     277+      (cursor-type))
     278+     ("com.apple.inputmethod.TCIM.Jianyi"
     279+      (title . "速")
     280+      (cursor-color)
     281+      (Cursor-type))
     282+     ("com.apple.inputmethod.TCIM.Dayi"
     283+      (title . "易")
     284+      (cursor-color)
     285+      (cursor-type))
     286+     ("com.apple.inputmethod.TCIM.Hanin"
     287+      (title . "漢")
     288+      (cursor-color)
     289+      (cursor-type))
     290+     ("com.google.inputmethod.Japanese.Roman"
     291+      (title . "G")
     292+      (cursor-color)
     293+      (cursor-type))
     294+     ("com.google.inputmethod.Japanese.base"
     295+      (title . "ぐ")
     296+      (cursor-color)
     297+      (cursor-type))
     298+     ("com.google.inputmethod.Japanese.Katakana"
     299+      (title . "グ")
     300+      (cursor-color)
     301+      (cursor-type))
     302+     ("com.google.inputmethod.Japanese.FullWidthRoman"
     303+      (title . "G")
     304+      (cursor-color)
     305+      (cursor-type))
     306+     ("com.google.inputmethod.Japanese.HalfWidthKana"
     307+      (title . "グ")
     308+      (cursor-color)
     309+      (cursor-type))
     310+     ("jp.monokakido.inputmethod.Kawasemi.Roman"
     311+      (title . "K")
     312+      (cursor-color)
     313+      (cursor-type))
     314+     ("jp.monokakido.inputmethod.Kawasemi.Japanese"
     315+      (title . "か")
     316+      (cursor-color)
     317+      (cursor-type))
     318+     ("jp.monokakido.inputmethod.Kawasemi.Japanese.Katakana"
     319+      (title . "カ")
     320+      (cursor-color)
     321+      (cursor-type))
     322+     ("jp.monokakido.inputmethod.Kawasemi.Japanese.FullWidthRoman"
     323+      (title . "K")
     324+      (cursor-color)
     325+      (cursor-type))
     326+     ("jp.monokakido.inputmethod.Kawasemi.Japanese.HalfWidthKana"
     327+      (title . "カ")
     328+      (cursor-color)
     329+      (cursor-type))
     330+     ("jp.monokakido.inputmethod.Kawasemi.Japanese.HalfWidthRoman"
     331+      (title . "_K")
     332+      (cursor-color)
     333+      (cursor-type))
     334+     ("jp.monokakido.inputmethod.Kawasemi.Japanese.Code"
     335+      (title . "C")
     336+      (cursor-color)
     337+      (cursor-type))
     338+     ("com.justsystems.inputmethod.atok22.Roman"
     339+      (title . "A")
     340+      (cursor-color)
     341+      (cursor-type))
     342+     ("com.justsystems.inputmethod.atok22.Japanese"
     343+      (title . "あ")
     344+      (cursor-color)
     345+      (cursor-type))
     346+     ("com.justsystems.inputmethod.atok22.Japanese.Katakana"
     347+      (title . "ア")
     348+      (cursor-color)
     349+      (cursor-type))
     350+     ("com.justsystems.inputmethod.atok22.Japanese.FullWidthRoman"
     351+      (title . "英")
     352+      (cursor-color)
     353+      (cursor-type))
     354+     ("com.justsystems.inputmethod.atok22.Japanese.HalfWidthEiji"
     355+      (title . "半英")
     356+      (cursor-color)
     357+      (cursor-type))
     358+     )
     359+   "Alist of Mac script code vs parameters for input method on MacOSX.")
     360+
     361+
     362+ (defun mac-get-input-method-parameter (is key)
     363+   "Function to get a parameter of a input method."
     364+   (interactive)
     365+   (assq key (cdr (assoc is mac-input-method-parameters))))
     366+
     367+ (defun mac-get-input-method-title (&optional input-source)
     368+   "Return input method title of input source.
     369+    If input-source is nil, return one of current frame."
     370+   (if input-source
     371+       (cdr (mac-get-input-method-parameter input-source 'title))
     372+     current-input-method-title))
     373+
     374+ (defun mac-get-cursor-type (&optional input-source)
     375+   "Return cursor type of input source.
     376+    If input-source is nil, return one of current frame."
     377+   (if input-source
     378+       (or (cdr (mac-get-input-method-parameter input-source 'cursor-type))
     379+         (cdr (assq 'cursor-type default-frame-alist))
     380+         cursor-type)
     381+     (cdr (assq 'cursor-type (frame-parameters (selected-frame))))))
     382+
     383+ (defun mac-get-cursor-color (&optional input-source)
     384+   "Return cursor color of input source.
     385+    If input-source is nil, return one of current frame."
     386+   (if input-source
     387+       (or (cdr (mac-get-input-method-parameter input-source 'cursor-color))
     388+         (cdr (assq 'cursor-color default-frame-alist)))
     389+     (cdr (assq 'cursor-color (frame-parameters (selected-frame))))))
     390+
     391+
     392+ (defun mac-set-input-method-parameter (is key value)
     393+   "Function to set a parameter of a input method."
     394+   (let* ((is-param (assoc is mac-input-method-parameters))
     395+          (param (assq key is-param)))
     396+     (if is-param
     397+       (if param
     398+           (setcdr param value)
     399+         (setcdr is-param (cons (cons key value) (cdr is-param))))
     400+       (setq mac-input-method-parameters
     401+           (cons (list is (cons key value))
     402+                 mac-input-method-parameters)))))
     403+
     404+
     405+ (defun mac-input-method-update (is)
     406+   "Funtion to update parameters of a input method."
     407+   (interactive)
     408+
     409+   (let ((title (mac-get-input-method-title is))
     410+         (type (mac-get-cursor-type is))
     411+         (color (mac-get-cursor-color is)))
     412+     (if (and title (not (equal title (mac-get-input-method-title))))
     413+       (setq current-input-method-title title))
     414+     (if (and type (not (equal type (mac-get-cursor-type))))
     415+       (setq cursor-type type))
     416+     (if (and color (not (equal color (mac-get-cursor-color))))
     417+       (set-cursor-color color))
     418+     (force-mode-line-update)
     419+     (if isearch-mode (isearch-update))))
     420+
     421+
     422+ (defun mac-toggle-input-method (&optional arg)
     423+   "Function to toggle input method on MacOSX."
     424+   (interactive)
     425+   
     426+   (if arg
     427+       (progn
     428+       (make-local-variable 'input-method-function)
     429+       (setq inactivate-current-input-method-function 'mac-toggle-input-method)
     430+       (setq input-method-function nil)
     431+       (setq describe-current-input-method-function nil)
     432+       (mac-toggle-input-source t))
     433+     (kill-local-variable 'input-method-function)
     434+     (setq describe-current-input-method-function nil)
     435+     (mac-toggle-input-source nil)))
     436+
     437+
     438+ (defun mac-change-language-to-us ()
     439+   "Function to change language to us."
     440+   (interactive)
     441+   (mac-toggle-input-method nil))
     442+
     443+
     444+ (defun mac-handle-input-method-change ()
     445+   "Function run when a input method change."
     446+   (interactive)
     447+
     448+   (if (equal default-input-method "MacOSX")
     449+       (let ((input-source (mac-get-current-input-source))
     450+         (ascii-capable (mac-input-source-is-ascii-capable)))
     451+       
     452+       (cond ((and (not current-input-method) (not ascii-capable))
     453+              (set-input-method "MacOSX"))
     454+             ((and (equal current-input-method "MacOSX") ascii-capable)
     455+              (toggle-input-method nil)))
     456+       (mac-input-method-update input-source))))
     457+
     458+ ;;
     459+ ;; Emacs input method for input method on MacOSX.
     460+ ;;
     461+ (register-input-method "MacOSX" "MacOSX" 'mac-toggle-input-method
     462+                      "Mac" "Input Method on MacOSX System")
     463+
     464+
     465+ ;;
     466+ ;; Minor mode of using input methods on MacOS X
     467+ ;;
     468+ (define-minor-mode mac-input-method-mode
     469+   "Use input methods on MacOSX."
     470+   :init-value nil
     471+   :group 'ns
     472+   :global t
     473+
     474+   (if mac-input-method-mode
     475+       (progn
     476+       (setq default-input-method "MacOSX")
     477+       (add-hook 'minibuffer-setup-hook 'mac-change-language-to-us)
     478+       (mac-translate-from-yen-to-backslash)
     479+       (mac-add-key-passed-to-system 'shift))
     480+     (setq default-input-method nil)))
     481+
     482+ ;;
     483+ ;; Valiable and functions to pass key(shortcut) to system.
     484+ ;;
     485+ (defvar mac-keys-passed-to-system nil
     486+   "A list of keys passed to system on MacOSX.")
     487+
     488+ (defun mac-add-key-passed-to-system (key)
     489+   (let ((shift   '(shift shft))
     490+       (control '(control ctrl ctl))
     491+       (option  '(option opt alternate alt))
     492+       (command '(command cmd)))
     493+
     494+     (add-to-list 'mac-keys-passed-to-system
     495+                (cond ((symbolp key)
     496+                       (cond ((memq key shift)
     497+                              (cons ns-shift-key-mask nil))
     498+                             ((memq key control)
     499+                              (cons ns-control-key-mask nil))
     500+                             ((memq key option)
     501+                              (cons ns-alternate-key-mask nil))
     502+                             ((memq key command)
     503+                              (cons ns-command-key-mask nil))
     504+                             (t (cons nil nil))))
     505+                      ((numberp key) (cons 0 key))
     506+                      ((listp key)
     507+                       (let ((l key) (k nil) (m 0))
     508+                         (while l
     509+                           (cond ((memq (car l) shift)
     510+                                  (setq m (logior m ns-shift-key-mask)))
     511+                                 ((memq (car l) control)
     512+                                  (setq m (logior m ns-control-key-mask)))
     513+                                 ((memq (car l) option)
     514+                                  (setq m (logior m ns-alternate-key-mask)))
     515+                                 ((memq (car l) command)
     516+                                      (setq m (logior m ns-command-key-mask)))
     517+                                 ((numberp (car l))
     518+                                  (if (not k) (setq k (car l)))))
     519+                           (setq l (cdr l)))
     520+                         (cons m k)))
     521+                      (t (cons nil nil))))))
     522+
     523+
     524+ ;;
     525+ ;; Entry Emacs event for inline input method on MacOSX.
     526+ ;;
     527+ (define-key special-event-map
     528+   [mac-change-input-method] 'mac-handle-input-method-change)
     529+       
     530+ ;;
     531+ ;; Convert yen to backslash for JIS keyboard.
     532+ ;;
     533+ (defun mac-translate-from-yen-to-backslash ()
     534+   ;; Convert yen to backslash for JIS keyboard.
     535+   (interactive)
     536+
     537+   (define-key global-map [165] nil)
     538+   (define-key global-map [2213] nil)
     539+   (define-key global-map [3420] nil)
     540+   (define-key global-map [67109029] nil)
     541+   (define-key global-map [67111077] nil)
     542+   (define-key global-map [8388773] nil)
     543+   (define-key global-map [134219941] nil)
     544+   (define-key global-map [75497596] nil)
     545+   (define-key global-map [201328805] nil)
     546+   (define-key function-key-map [165] [?\\])
     547+   (define-key function-key-map [2213] [?\\]) ;; for Intel
     548+   (define-key function-key-map [3420] [?\\]) ;; for PowerPC
     549+   (define-key function-key-map [67109029] [?\C-\\])
     550+   (define-key function-key-map [67111077] [?\C-\\])
     551+   (define-key function-key-map [8388773] [?\M-\\])
     552+   (define-key function-key-map [134219941] [?\M-\\])
     553+   (define-key function-key-map [75497596] [?\C-\M-\\])
     554+   (define-key function-key-map [201328805] [?\C-\M-\\])
     555+ )
     556+
     557+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     558+
     559  (provide 'ns-win)
     560 
     561  ;; arch-tag: eb138a45-4e2e-4d68-b1c9-a39665731644
     562diff -r -p -N -x '*.o' ../emacs-23.2.94-0/src/Makefile.in src/Makefile.in
     563*** ../emacs-23.2.94-0/src/Makefile.in  2011-01-09 02:45:14.000000000 +0900
     564--- src/Makefile.in     2011-02-15 22:24:06.000000000 +0900
     565*************** ns_appresdir=@ns_appresdir@/
     566*** 545,551 ****
     567  ns_appsrc=@ns_appsrc@
     568  /* Object files for NeXTstep */
     569  NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
     570!       fontset.o fringe.o image.o
     571  #endif  /* HAVE_NS */
     572 
     573  #ifdef HAVE_WINDOW_SYSTEM
     574--- 545,551 ----
     575  ns_appsrc=@ns_appsrc@
     576  /* Object files for NeXTstep */
     577  NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
     578!       fontset.o fringe.o image.o macim.o
     579  #endif  /* HAVE_NS */
     580 
     581  #ifdef HAVE_WINDOW_SYSTEM
     582*************** obj=    dispnew.o frame.o scroll.o xdisp
     583*** 583,589 ****
     584  SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
     585    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
     586    fontset.o dbusbind.o \
     587!   nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
     588    w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
     589    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS)
     590 
     591--- 583,589 ----
     592  SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
     593    xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
     594    fontset.o dbusbind.o \
     595!   nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o\
     596    w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
     597    w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS)
     598 
     599*************** nsterm.o: nsterm.m blockinput.h atimer.h
     600*** 1168,1173 ****
     601--- 1168,1174 ----
     602    termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \
     603    $(INTERVALS_H) process.h coding.h lisp.h $(config_h)
     604  nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h lisp.h $(config_h)
     605+ macim.o: macim.m lisp.h blockinput.h termhooks.h keyboard.h buffer.h $(config_h)
     606  process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
     607     commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
     608     blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
     609diff -r -p -N -x '*.o' ../emacs-23.2.94-0/src/keyboard.c src/keyboard.c
     610*** ../emacs-23.2.94-0/src/keyboard.c   2011-01-29 05:22:59.000000000 +0900
     611--- src/keyboard.c      2011-02-15 22:24:06.000000000 +0900
     612*************** kbd_buffer_get_event (kbp, used_mouse_me
     613*** 4243,4250 ****
     614          {
     615            if (event->code == KEY_NS_PUT_WORKING_TEXT)
     616              obj = Fcons (intern ("ns-put-working-text"), Qnil);
     617!           else
     618              obj = Fcons (intern ("ns-unput-working-text"), Qnil);
     619          kbd_fetch_ptr = event + 1;
     620            if (used_mouse_menu)
     621              *used_mouse_menu = 1;
     622--- 4243,4252 ----
     623          {
     624            if (event->code == KEY_NS_PUT_WORKING_TEXT)
     625              obj = Fcons (intern ("ns-put-working-text"), Qnil);
     626!           else if (event->code == KEY_NS_UNPUT_WORKING_TEXT)
     627              obj = Fcons (intern ("ns-unput-working-text"), Qnil);
     628+         else if (event->code == KEY_NS_PUT_MARKED_TEXT)
     629+           obj = Fcons (intern ("ns-put-marked-text"), event->arg);
     630          kbd_fetch_ptr = event + 1;
     631            if (used_mouse_menu)
     632              *used_mouse_menu = 1;
     633*************** keys_of_keyboard ()
     634*** 12611,12616 ****
     635--- 12613,12620 ----
     636                            "ns-put-working-text");
     637    initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",
     638                            "ns-unput-working-text");
     639+   initial_define_lispy_key (Vspecial_event_map, "ns-put-marked-text",
     640+                           "ns-put-marked-text");
     641    /* Here we used to use `ignore-event' which would simple set prefix-arg to
     642       current-prefix-arg, as is done in `handle-switch-frame'.
     643       But `handle-switch-frame is not run from the special-map.
     644diff -r -p -N -x '*.o' ../emacs-23.2.94-0/src/macim.m src/macim.m
     645*** ../emacs-23.2.94-0/src/macim.m      1970-01-01 09:00:00.000000000 +0900
     646--- src/macim.m 2011-02-28 10:27:05.000000000 +0900
     647***************
     648*** 0 ****
     649--- 1,178 ----
     650+ /* Implementation of Input Method Extension for MacOS X.
     651+    Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
     652+    Taiichi Hashimoto <taiichi2@mac.com>.
     653+ */
     654+
     655+ #include "config.h"
     656+
     657+ #ifdef NS_IMPL_COCOA
     658+
     659+ #include <math.h>
     660+ #include <sys/types.h>
     661+ #include <time.h>
     662+ #include <signal.h>
     663+ #include <unistd.h>
     664+
     665+ #include <Carbon/Carbon.h>
     666+
     667+ #include "lisp.h"
     668+ #include "blockinput.h"
     669+
     670+ enum output_method
     671+ {
     672+   output_initial,
     673+   output_termcap,
     674+   output_x_window,
     675+   output_msdos_raw,
     676+   output_w32,
     677+   output_mac,
     678+   output_ns
     679+ } output_method;
     680+
     681+ #include "termhooks.h"
     682+ #include "keyboard.h"
     683+ #include "buffer.h"
     684+
     685+ extern Lisp_Object Qcurrent_input_method;
     686+ extern int cursor_in_echo_area;
     687+ static Lisp_Object Qmac_keys_passed_to_system;
     688+ static Lisp_Object Vmac_use_input_method_on_system;
     689+
     690+ void mac_init_input_method ();
     691+ int mac_pass_key_to_system (int code, int modifiers);
     692+ int mac_pass_key_directly_to_emacs ();
     693+ int mac_store_change_input_method_event ();
     694+
     695+ DEFUN ("mac-input-source-is-ascii-capable", Fmac_input_source_is_ascii_capable,
     696+        Smac_input_source_is_ascii_capable, 0, 0, 0,
     697+        doc: /* Is current input source ascii capable? */)
     698+      ()
     699+ {
     700+   TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
     701+   CFBooleanRef ret = TISGetInputSourceProperty(is, kTISPropertyInputSourceIsASCIICapable);
     702+   
     703+   return CFBooleanGetValue(ret)? Qt : Qnil;
     704+ }
     705+
     706+ DEFUN ("mac-get-input-source-list", Fmac_get_input_source_list,
     707+        Smac_get_input_source_list, 0, 0, 0,
     708+        doc: /* get input source list on MacOSX */)
     709+      ()
     710+ {
     711+   NSArray *is_list = (NSArray *)TISCreateInputSourceList(NULL, false);
     712+   int list_size = [is_list count];
     713+   Lisp_Object list[list_size];
     714+   int i;
     715+
     716+   for (i = 0; i < list_size; i++) {
     717+     TISInputSourceRef is = [is_list objectAtIndex:i];
     718+     NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
     719+     list[i] = make_string([id UTF8String],
     720+                         [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
     721+   }
     722+
     723+   return Flist(list_size, list);
     724+ }
     725+
     726+ DEFUN ("mac-get-current-input-source", Fmac_get_current_input_source,
     727+        Smac_get_current_input_source, 0, 0, 0,
     728+        doc: /* get current input source on MacOSX */)
     729+      ()
     730+ {
     731+   TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
     732+   NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
     733+
     734+   return make_string([id UTF8String],
     735+                    [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
     736+ }
     737+
     738+ DEFUN ("mac-toggle-input-source", Fmac_toggle_input_source,
     739+        Smac_toggle_input_source, 1, 1, 0,
     740+        doc: /* toggle input source on MacOSX */)
     741+      (arg)
     742+      Lisp_Object arg;
     743+ {
     744+   TISInputSourceRef is = NULL;
     745+
     746+   if (NILP (arg))
     747+     {
     748+       is = TISCopyCurrentASCIICapableKeyboardInputSource();
     749+     }
     750+   else
     751+     {
     752+       NSString *locale = [[NSLocale currentLocale] localeIdentifier];
     753+       is = TISCopyInputSourceForLanguage(locale);
     754+     }
     755+   if (is) TISSelectInputSource(is);
     756+
     757+   return arg;
     758+ }
     759+
     760+ int
     761+ mac_store_change_input_method_event ()
     762+ {
     763+   Lisp_Object dim;
     764+   int ret = FALSE;
     765+   
     766+   dim = Fsymbol_value (intern ("default-input-method"));
     767+   if (STRINGP (dim) && strcmp(SDATA (dim), "MacOSX") == 0)
     768+     {
     769+       ret = TRUE;
     770+     }
     771+
     772+   return ret;
     773+ }
     774+
     775+ int
     776+ mac_pass_key_to_system (int code, int modifiers)
     777+ {
     778+   Lisp_Object keys = Fsymbol_value (Qmac_keys_passed_to_system);
     779+   Lisp_Object m, k;
     780+
     781+   while (!NILP (keys))
     782+     {
     783+       m = XCAR (XCAR (keys));
     784+       k = XCDR (XCAR (keys));
     785+       keys = XCDR (keys);
     786+
     787+       if (NUMBERP (m) && modifiers == XINT (m))
     788+       if (NILP (k)
     789+           || (NUMBERP (k) && code == XINT (k)))
     790+         return TRUE;
     791+     }
     792+   
     793+   return FALSE;
     794+ }
     795+
     796+ int
     797+ mac_pass_key_directly_to_emacs ()
     798+ {
     799+
     800+   if (NILP (Fmac_input_source_is_ascii_capable()))
     801+     {
     802+       if (NILP (Vmac_use_input_method_on_system)
     803+         || this_command_key_count
     804+         || cursor_in_echo_area
     805+         || !NILP (current_buffer->read_only))
     806+       return TRUE;
     807+     }
     808+
     809+   return FALSE;
     810+ }
     811+
     812+
     813+ void mac_init_input_method ()
     814+ {
     815+   Qmac_keys_passed_to_system = intern ("mac-keys-passed-to-system");
     816+   staticpro (&Qmac_keys_passed_to_system);
     817+
     818+   DEFVAR_LISP ("mac-use-input-method-on-system", &Vmac_use_input_method_on_system,
     819+                doc: /* If it is non-nil, use input method on system. */);
     820+   Vmac_use_input_method_on_system = Qt;
     821+
     822+   defsubr (&Smac_input_source_is_ascii_capable);
     823+   defsubr (&Smac_get_input_source_list);
     824+   defsubr (&Smac_get_current_input_source);
     825+   defsubr (&Smac_toggle_input_source);
     826+ }
     827+ #endif
     828diff -r -p -N -x '*.o' ../emacs-23.2.94-0/src/nsfns.m src/nsfns.m
     829*** ../emacs-23.2.94-0/src/nsfns.m      2011-01-09 02:45:14.000000000 +0900
     830--- src/nsfns.m 2011-02-15 22:24:06.000000000 +0900
     831*************** Lisp_Object Fx_open_connection (Lisp_Obj
     832*** 103,108 ****
     833--- 103,113 ----
     834 
     835  extern BOOL ns_in_resize;
     836 
     837+ /* key masks */
     838+ static Lisp_Object Vns_shift_key_mask;
     839+ static Lisp_Object Vns_control_key_mask;
     840+ static Lisp_Object Vns_alternate_key_mask;
     841+ static Lisp_Object Vns_command_key_mask;
     842 
     843  /* ==========================================================================
     844 
     845*************** be used as the image of the icon represe
     846*** 2632,2637 ****
     847--- 2637,2660 ----
     848                 doc: /* Toolkit version for NS Windowing.  */);
     849    Vns_version_string = ns_appkit_version_str ();
     850 
     851+
     852+   DEFVAR_LISP ("ns-shift-key-mask", &Vns_shift_key_mask,
     853+                doc: /* Shift key mask defined in system. */);
     854+   Vns_shift_key_mask = make_number (NSShiftKeyMask);
     855+
     856+   DEFVAR_LISP ("ns-control-key-mask", &Vns_control_key_mask,
     857+                doc: /* Control key mask defined in system. */);
     858+   Vns_control_key_mask = make_number (NSControlKeyMask);
     859+
     860+   DEFVAR_LISP ("ns-alternate-key-mask", &Vns_alternate_key_mask,
     861+                doc: /* Alternate key mask defined in system. */);
     862+   Vns_alternate_key_mask = make_number (NSAlternateKeyMask);
     863+
     864+   DEFVAR_LISP ("ns-command-key-mask", &Vns_command_key_mask,
     865+                doc: /* Command key mask defined in system. */);
     866+   Vns_command_key_mask = make_number (NSCommandKeyMask);
     867+
     868+
     869    defsubr (&Sns_read_file_name);
     870    defsubr (&Sns_get_resource);
     871    defsubr (&Sns_set_resource);
     872*************** be used as the image of the icon represe
     873*** 2676,2681 ****
     874--- 2699,2708 ----
     875    defsubr (&Sx_show_tip);
     876    defsubr (&Sx_hide_tip);
     877 
     878+ #ifdef NS_IMPL_COCOA
     879+   mac_init_input_method ();
     880+ #endif
     881+
     882    /* used only in fontset.c */
     883    check_window_system_func = check_ns;
     884 
     885diff -r -p -N -x '*.o' ../emacs-23.2.94-0/src/nsterm.h src/nsterm.h
     886*** ../emacs-23.2.94-0/src/nsterm.h     2011-01-09 02:45:14.000000000 +0900
     887--- src/nsterm.h        2011-02-15 22:24:06.000000000 +0900
     888*************** typedef unsigned int NSUInteger;
     889*** 365,370 ****
     890--- 365,372 ----
     891  #define KEY_NS_NEW_FRAME               ((1<<28)|(0<<16)|12)
     892  #define KEY_NS_TOGGLE_TOOLBAR          ((1<<28)|(0<<16)|13)
     893  #define KEY_NS_SHOW_PREFS              ((1<<28)|(0<<16)|14)
     894+ #define KEY_MAC_CHANGE_INPUT_METHOD    ((1<<28)|(0<<16)|15)
     895+ #define KEY_NS_PUT_MARKED_TEXT         ((1<<28)|(0<<16)|16)
     896 
     897  /* could use list to store these, but rest of emacs has a big infrastructure
     898     for managing a table of bitmap "records" */
     899diff -r -p -N -x '*.o' ../emacs-23.2.94-0/src/nsterm.m src/nsterm.m
     900*** ../emacs-23.2.94-0/src/nsterm.m     2011-02-09 08:46:22.000000000 +0900
     901--- src/nsterm.m        2011-02-15 22:24:06.000000000 +0900
     902*************** ns_term_init (Lisp_Object display_name)
     903*** 3730,3735 ****
     904--- 3730,3738 ----
     905    /*   [[NSNotificationCenter defaultCenter] addObserver: NSApp
     906                                           selector: @selector (logNotification:)
     907                                               name: nil object: nil]; */
     908+   [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
     909+                                       selector: @selector (changeInputMethod:)
     910+                                                  name: @"AppleSelectedInputSourcesChangedNotification" object: nil];
     911 
     912    dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
     913    bzero (dpyinfo, sizeof (struct ns_display_info));
     914*************** ns_term_shutdown (int sig)
     915*** 3935,3940 ****
     916--- 3938,3955 ----
     917      NSLog (@"notification: '%@'", [notification name]);
     918  }
     919 
     920+ - (void)changeInputMethod: (NSNotification *)notification
     921+ {
     922+
     923+   struct frame *emacsframe = SELECTED_FRAME ();
     924+
     925+   if (mac_store_change_input_method_event())
     926+     {
     927+       emacs_event->kind = NS_NONKEY_EVENT;
     928+       emacs_event->code = KEY_MAC_CHANGE_INPUT_METHOD;
     929+       EV_TRAILER ((id)nil);
     930+     }
     931+ }
     932 
     933  - (void)sendEvent: (NSEvent *)theEvent
     934  /* --------------------------------------------------------------------------
     935*************** ns_term_shutdown (int sig)
     936*** 4488,4510 ****
     937               code, fnKeysym, flags, emacs_event->modifiers);
     938 
     939        /* if it was a function key or had modifiers, pass it directly to emacs */
     940!       if (fnKeysym || (emacs_event->modifiers
     941!                        && [[theEvent charactersIgnoringModifiers] length] > 0))
     942! /*[[theEvent characters] length] */
     943!         {
     944!           emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
     945!           if (code < 0x20)
     946!             code |= (1<<28)|(3<<16);
     947!           else if (code == 0x7f)
     948!             code |= (1<<28)|(3<<16);
     949!           else if (!fnKeysym)
     950!             emacs_event->kind = code > 0xFF
     951!               ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
     952 
     953!           emacs_event->code = code;
     954!           EV_TRAILER (theEvent);
     955!           return;
     956!         }
     957      }
     958 
     959    /* if we get here we should send the key for input manager processing */
     960--- 4503,4540 ----
     961               code, fnKeysym, flags, emacs_event->modifiers);
     962 
     963        /* if it was a function key or had modifiers, pass it directly to emacs */
     964!       /* The function mac_pass_key_directly_to_emacs check special case
     965!          to pass it directly to emacs, such as passwd, read-only buffer, etc. */
     966 
     967!         if (mac_pass_key_directly_to_emacs ()
     968!           || fnKeysym
     969!           || (emacs_event->modifiers
     970!               && [[theEvent charactersIgnoringModifiers] length] > 0))
     971!         {
     972!           emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
     973!           if (code < 0x20)
     974!             code |= (1<<28)|(3<<16);
     975!           else if (code == 0x7f)
     976!             code |= (1<<28)|(3<<16);
     977!           else if (!fnKeysym)
     978!             emacs_event->kind = code > 0xFF
     979!               ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
     980!           
     981!           emacs_event->code = code;
     982!
     983!           /* The function mac_pass_key_to_system decides whether it is
     984!              passed directly to emacs or not. */
     985!           if (emacs_event->kind == NON_ASCII_KEYSTROKE_EVENT
     986!               || !mac_pass_key_to_system (code, flags
     987!                                           & (NSShiftKeyMask
     988!                                              | NSControlKeyMask
     989!                                              | NSAlternateKeyMask
     990!                                              | NSCommandKeyMask)))
     991!             {
     992!               EV_TRAILER (theEvent);
     993!               return;
     994!             }
     995!         }
     996      }
     997 
     998    /* if we get here we should send the key for input manager processing */
     999*************** ns_term_shutdown (int sig)
     1000*** 4594,4603 ****
     1001      NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length],
     1002             selRange.length, selRange.location);
     1003 
     1004-   if (workingText != nil)
     1005-     [self deleteWorkingText];
     1006    if ([str length] == 0)
     1007!     return;
     1008 
     1009    if (!emacs_event)
     1010      return;
     1011--- 4624,4642 ----
     1012      NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length],
     1013             selRange.length, selRange.location);
     1014 
     1015    if ([str length] == 0)
     1016!     {
     1017!       [self deleteWorkingText];
     1018!       return;
     1019!     }
     1020!   else
     1021!     {
     1022!       if (workingText != nil) {
     1023!       [workingText release];
     1024!       workingText = nil;
     1025!       processingCompose = NO;
     1026!       }
     1027!     }
     1028 
     1029    if (!emacs_event)
     1030      return;
     1031*************** ns_term_shutdown (int sig)
     1032*** 4607,4613 ****
     1033    ns_working_text = build_string ([workingText UTF8String]);
     1034 
     1035    emacs_event->kind = NS_TEXT_EVENT;
     1036!   emacs_event->code = KEY_NS_PUT_WORKING_TEXT;
     1037    EV_TRAILER ((id)nil);
     1038  }
     1039 
     1040--- 4646,4654 ----
     1041    ns_working_text = build_string ([workingText UTF8String]);
     1042 
     1043    emacs_event->kind = NS_TEXT_EVENT;
     1044!   emacs_event->code = KEY_NS_PUT_MARKED_TEXT;
     1045!   emacs_event->arg = Fcons (make_number (selRange.location),
     1046!                           Fcons (make_number (selRange.length), Qnil));
     1047    EV_TRAILER ((id)nil);
     1048  }
     1049 
     1050*************** ns_term_shutdown (int sig)
     1051*** 4662,4676 ****
     1052  {
     1053    NSRect rect;
     1054    NSPoint pt;
     1055!   struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
     1056    if (NS_KEYLOG)
     1057      NSLog (@"firstRectForCharRange request");
     1058 
     1059    rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
     1060    rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
     1061    pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
     1062    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
     1063!                                        +FRAME_LINE_HEIGHT (emacsframe));
     1064 
     1065    pt = [self convertPoint: pt toView: nil];
     1066    pt = [[self window] convertBaseToScreen: pt];
     1067--- 4703,4725 ----
     1068  {
     1069    NSRect rect;
     1070    NSPoint pt;
     1071!   //  struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
     1072!   struct window *win;
     1073    if (NS_KEYLOG)
     1074      NSLog (@"firstRectForCharRange request");
     1075+     
     1076+   if (NILP (Feval (Fcons (intern ("ns-in-echo-area"), Qnil))))
     1077+     win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
     1078+   else if (WINDOWP (echo_area_window))
     1079+     win = XWINDOW (echo_area_window);
     1080+   else
     1081+     win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
     1082 
     1083    rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
     1084    rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
     1085    pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
     1086    pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
     1087!                                        +FRAME_LINE_HEIGHT (emacsframe)+2);
     1088 
     1089    pt = [self convertPoint: pt toView: nil];
     1090    pt = [[self window] convertBaseToScreen: pt];
     1091diff -r -p -N -x '*.o' ../emacs-23.2.94-0/src/s/darwin.h src/s/darwin.h
     1092*** ../emacs-23.2.94-0/src/s/darwin.h   2011-01-09 02:45:14.000000000 +0900
     1093--- src/s/darwin.h      2011-02-15 22:24:06.000000000 +0900
     1094*************** along with GNU Emacs.  If not, see <http
     1095*** 163,169 ****
     1096  /* Definitions for how to compile & link.  */
     1097 
     1098  #ifdef HAVE_NS
     1099! #define LIBS_NSGUI -framework AppKit
     1100  #define SYSTEM_PURESIZE_EXTRA 200000
     1101  #define HEADERPAD_EXTRA 6C8
     1102  #else /* !HAVE_NS */
     1103--- 163,169 ----
     1104  /* Definitions for how to compile & link.  */
     1105 
     1106  #ifdef HAVE_NS
     1107! #define LIBS_NSGUI -framework AppKit -framework Carbon
     1108  #define SYSTEM_PURESIZE_EXTRA 200000
     1109  #define HEADERPAD_EXTRA 6C8
     1110  #else /* !HAVE_NS */
  • new file aqua/emacs-app-devel/files/patch-macemacsjp-jpfont.diff

    diff --git a/aqua/emacs-app-devel/files/patch-macemacsjp-jpfont.diff b/aqua/emacs-app-devel/files/patch-macemacsjp-jpfont.diff
    new file mode 100644
    index 0000000..dc5efc3
    - +  
     1diff -pr ../emacs-23.3/src/nsfont.m src/nsfont.m
     2*** ../emacs-23.3/src/nsfont.m  2011-01-09 02:45:14.000000000 +0900
     3--- src/nsfont.m        2011-03-21 17:11:01.000000000 +0900
     4*************** nsfont_open (FRAME_PTR f, Lisp_Object fo
     5*** 846,853 ****
     6        lrint (hshrink * [sfont ascender] + expand * hd/2);
     7      /* [sfont descender] is usually negative.  Use floor to avoid
     8         clipping descenders. */
     9!     font_info->max_bounds.descent =
     10!       -lrint (floor(hshrink* [sfont descender] - expand*hd/2));
     11      font_info->height =
     12        font_info->max_bounds.ascent + font_info->max_bounds.descent;
     13      font_info->max_bounds.width = lrint (font_info->width);
     14--- 846,861 ----
     15        lrint (hshrink * [sfont ascender] + expand * hd/2);
     16      /* [sfont descender] is usually negative.  Use floor to avoid
     17         clipping descenders. */
     18!     if ([sfont mostCompatibleStringEncoding] == 0x80000001) {
     19!       /* If the font is Japanese (Mac OS) encoding, change descender to 2 times.
     20!          Because most of Japanese font's decender, such as Hiragino, is
     21!          too short. */
     22!       font_info->max_bounds.descent =
     23!         -lrint (floor(hshrink* [sfont descender] * 2 - expand*hd/2));
     24!     } else {
     25!       font_info->max_bounds.descent =
     26!         -lrint (floor(hshrink* [sfont descender] - expand*hd/2));
     27!     }
     28      font_info->height =
     29        font_info->max_bounds.ascent + font_info->max_bounds.descent;
     30      font_info->max_bounds.width = lrint (font_info->width);
  • new file aqua/emacs-app-devel/files/patch-src_emacs.c.diff

    diff --git a/aqua/emacs-app-devel/files/patch-src_emacs.c.diff b/aqua/emacs-app-devel/files/patch-src_emacs.c.diff
    new file mode 100644
    index 0000000..4b00e06
    - +  
     1--- src/emacs.c.orig    2011-01-09 02:45:14.000000000 +0900
     2+++ src/emacs.c 2011-09-09 23:13:44.000000000 +0900
     3@@ -23,6 +23,8 @@
     4 #include <signal.h>
     5 #include <errno.h>
     6 #include <stdio.h>
     7+#include <stdlib.h>
     8+#include <string.h>
     9 
     10 #include <sys/types.h>
     11 #include <sys/file.h>
     12@@ -754,6 +754,25 @@
     13 #ifdef DARWIN_OS
     14   if (!initialized)
     15     unexec_init_emacs_zone ();
     16+
     17+  /* Imaxima won't work properly if PATH does not contain the
     18+     MacPorts directory. The following code is a workaround to
     19+     avoid this problem. */
     20+  {
     21+    char *oldpath = getenv("PATH");
     22+    if (!oldpath) {oldpath = "";}
     23+    size_t oldpathsize = strlen(oldpath) + 1;
     24+    if (!strstr(oldpath, "__PREFIX__/bin")) {
     25+      char *newpath;
     26+      size_t newpathsize = oldpathsize + strlen("__PREFIX__/bin:");
     27+      if ((newpath = (char *)malloc(newpathsize)) != NULL) {
     28+        strlcpy(newpath, "__PREFIX__/bin:", newpathsize);
     29+        strlcat(newpath, oldpath, newpathsize);
     30+        setenv("PATH", newpath, 1);
     31+        free(newpath);
     32+      }
     33+    }
     34+  }
     35 #endif
     36 
     37   sort_args (argc, argv);
  • new file aqua/emacs-app-devel/files/patch-srgb.diff

    diff --git a/aqua/emacs-app-devel/files/patch-srgb.diff b/aqua/emacs-app-devel/files/patch-srgb.diff
    new file mode 100644
    index 0000000..ccbffa3
    - +  
     1diff --git a/src/nsterm.m b/src/nsterm.m
     2index af1f21a..696dbdc 100644
     3--- src/nsterm.m
     4+++ src/nsterm.m
     5@@ -1389,7 +1389,7 @@ ns_get_color (const char *name, NSColor **col)
     6 
     7   if (r >= 0.0)
     8     {
     9-      *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0];
     10+      *col = [NSColor colorWithDeviceRed: r green: g blue: b alpha: 1.0];
     11       UNBLOCK_INPUT;
     12       return 0;
     13     }
     14
     15