svnno****@sourc*****
svnno****@sourc*****
2009年 5月 25日 (月) 15:43:25 JST
Revision: 556 http://svn.sourceforge.jp/view?root=macemacsjp&view=rev&rev=556 Author: taiichi Date: 2009-05-25 15:43:25 +0900 (Mon, 25 May 2009) Log Message: ----------- Modified Paths: -------------- inline_patch/trunk/ChangeLog inline_patch/trunk/emacs-inline.patch -------------- next part -------------- Modified: inline_patch/trunk/ChangeLog =================================================================== --- inline_patch/trunk/ChangeLog 2009-05-02 05:07:20 UTC (rev 555) +++ inline_patch/trunk/ChangeLog 2009-05-25 06:43:25 UTC (rev 556) @@ -1,3 +1,13 @@ +2009-05-25 HASHIMOTO Taiichi <taiic****@mac*****> + + * lisp/term/ns-win.el: Emacs23ÉÎD + * src/Makefile.in: + * src/s/darwin.h: + * src/macim.c: mac-ignore-shortcut Ì®ìª âµ¢D + * src/nsfns.m: + * src/nsterm.h: + * src/nsterm.m: + 2008-06-29 HASHIMOTO Taiichi <taiic****@mac*****> * default-input-method ª "MacOSX" ÌÆ«ÌÝCIM̯úðÆéæ¤É Modified: inline_patch/trunk/emacs-inline.patch =================================================================== --- inline_patch/trunk/emacs-inline.patch 2009-05-02 05:07:20 UTC (rev 555) +++ inline_patch/trunk/emacs-inline.patch 2009-05-25 06:43:25 UTC (rev 556) @@ -1,48 +1,28 @@ -diff -p -N -r -x '*.orig' ../emacs/lisp/loadup.el lisp/loadup.el -*** ../emacs/lisp/loadup.el 2008-01-07 11:44:35.000000000 +0900 ---- lisp/loadup.el 2008-06-29 19:49:33.000000000 +0900 -*************** -*** 209,214 **** ---- 209,217 ---- - (if (fboundp 'atan) ; preload some constants and - (progn ; floating pt. functions if we have float support. - (load "emacs-lisp/float-sup"))) -+ (if (eq system-type 'darwin) -+ (progn -+ (load "term/mac-im"))) - (message "%s" (garbage-collect)) +diff -p -N -r -x '*.orig' ../emacs23-20090519-0/lisp/term/ns-win.el lisp/term/ns-win.el +*** ../emacs23-20090519-0/lisp/term/ns-win.el 2009-05-19 21:44:10.000000000 +0900 +--- lisp/term/ns-win.el 2009-05-22 23:08:10.000000000 +0900 +*************** The properties returned may include `top +*** 333,338 **** +--- 333,339 ---- + (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) +*************** Note, tranparency works better on Tiger +*** 1268,1273 **** +--- 1269,1489 ---- + (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system)) - (load "vc-hooks") -diff -p -N -r -x '*.orig' ../emacs/lisp/term/mac-im.el lisp/term/mac-im.el -*** ../emacs/lisp/term/mac-im.el 1970-01-01 09:00:00.000000000 +0900 ---- lisp/term/mac-im.el 2008-06-29 19:49:33.000000000 +0900 -*************** -*** 0 **** ---- 1,230 ---- -+ ;; mac-im.el --- Input Method for Mac OS X -*-coding: iso-2022-7bit;-*- + ++ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ++ ;; ++ ;; Implementation of Input Method Extension for MacOS X ++ ;; written by Taiichi Hashimoto <taiic****@mac*****> ++ ;; + -+ ;; Copyright (C) 2005, 2006, 2007, 2008 -+ ;; HASHIMOTO Taiichi <taiic****@mac*****> -+ ;; Keywords: input method, Mac OS X -+ -+ ;; This file is part of GNU Emacs. -+ -+ ;; GNU Emacs is free software; you can redistribute it and/or modify -+ ;; it under the terms of the GNU General Public License as published by -+ ;; the Free Software Foundation; either version 3, or (at your option) -+ ;; any later version. -+ -+ ;; GNU Emacs is distributed in the hope that it will be useful, -+ ;; but WITHOUT ANY WARRANTY; without even the implied warranty of -+ ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ ;; GNU General Public License for more details. -+ -+ ;; You should have received a copy of the GNU General Public License -+ ;; along with GNU Emacs; see the file COPYING. If not, write to the -+ ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ ;; Boston, MA 02110-1301, USA. -+ -+ + ;; + ;; Variables and functions to change a input method + ;; @@ -50,19 +30,19 @@ + '((0 (title . "") + (cursor-color) + (cursor-type)) -+ (1 (title . "$B$"(B") ++ (1 (title . "ã") + (cursor-color) + (cursor-type)) -+ (2 (title . "$BHK(B") ++ (2 (title . "ç¹") + (cursor-color) + (cursor-type)) -+ (3 (title . "$(C0!(B") ++ (3 (title . "ê°") + (cursor-color) + (cursor-type)) + (7 (title . "Cy") + (cursor-color) + (cursor-type)) -+ (25 (title . "$B4J(B") ++ (25 (title . "ç°¡") + (cursor-color) + (cursor-type)) + (29 (title . "EU") @@ -146,11 +126,11 @@ + (interactive) + (mac-toggle-input-method nil)) + -+ (defun mac-handle-input-method-change (event) ++ (defun mac-handle-input-method-change () + "Function run when a input method change." -+ (interactive "e") ++ (interactive) + -+ (let ((lang (car (cadr event)))) ++ (let ((lang (mac-get-current-key-script))) + + (if (and (not current-input-method) (> lang 0)) + (if isearch-mode @@ -177,7 +157,7 @@ + (define-minor-mode mac-input-method-mode + "Use input methods on MacOSX." + :init-value nil -+ :group 'mac ++ :group 'ns + :global t + + (if mac-input-method-mode @@ -249,259 +229,109 @@ + (define-key function-key-map [134219941] [?\M-\\]) + (define-key function-key-map [201328805] [?\C-\M-\\]) + ) -diff -p -N -r -x '*.orig' ../emacs/lisp/term/mac-win.el lisp/term/mac-win.el -*** ../emacs/lisp/term/mac-win.el 2008-04-24 12:07:36.000000000 +0900 ---- lisp/term/mac-win.el 2008-06-29 19:49:33.000000000 +0900 -*************** either in the current buffer or in the e -*** 2097,2105 **** - (concat msg active-input-string))) - (setq msg active-input-string)) - (message "%s" msg) - (overlay-put mac-ts-active-input-overlay 'before-string nil)) - (move-overlay mac-ts-active-input-overlay -! (point) (point) (current-buffer)) - (overlay-put mac-ts-active-input-overlay 'before-string - active-input-string)) - (mac-unread-string (funcall decode-fun confirmed coding))) ---- 2097,2115 ---- - (concat msg active-input-string))) - (setq msg active-input-string)) - (message "%s" msg) -+ (overlay-put mac-ts-active-input-overlay 'face nil) - (overlay-put mac-ts-active-input-overlay 'before-string nil)) -+ (overlay-put mac-ts-active-input-overlay 'face nil) -+ (let ((overlays (overlays-in (point) (point))) -+ (face nil)) -+ (while overlays -+ (setq face (overlay-get (car overlays) 'face)) -+ (and face -+ (overlay-put mac-ts-active-input-overlay 'face face)) -+ (setq overlays (cdr overlays)))) - (move-overlay mac-ts-active-input-overlay -! (point) (+ (point) (length active-input-string)) -! (current-buffer)) - (overlay-put mac-ts-active-input-overlay 'before-string - active-input-string)) - (mac-unread-string (funcall decode-fun confirmed coding))) -diff -p -N -r -x '*.orig' ../emacs/src/Makefile.in src/Makefile.in -*** ../emacs/src/Makefile.in 2008-04-07 15:36:07.000000000 +0900 ---- src/Makefile.in 2008-06-29 19:49:33.000000000 +0900 -*************** CYGWIN_OBJ = sheap.o -*** 575,581 **** ++ ++ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ++ + (provide 'ns-win) - #ifdef HAVE_CARBON - mac = $(dot)$(dot)/mac/ -! MAC_OBJ = mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o fringe.o image.o mactoolbox.o - emacsapp = $(PWD)/$(mac)Emacs.app/ - emacsappsrc = ${srcdir}/../mac/Emacs.app/ - #endif ---- 575,581 ---- + ;; arch-tag: eb138a45-4e2e-4d68-b1c9-a39665731644 +diff -p -N -r -x '*.orig' ../emacs23-20090519-0/src/Makefile.in src/Makefile.in +*** ../emacs23-20090519-0/src/Makefile.in 2009-05-19 21:44:12.000000000 +0900 +--- src/Makefile.in 2009-05-19 21:44:46.000000000 +0900 +*************** ns_appresdir=@ns_appresdir@/ +*** 522,528 **** + 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_CARBON - mac = $(dot)$(dot)/mac/ -! MAC_OBJ = mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o fringe.o image.o mactoolbox.o macim.o - emacsapp = $(PWD)/$(mac)Emacs.app/ - emacsappsrc = ${srcdir}/../mac/Emacs.app/ - #endif + #ifdef HAVE_WINDOW_SYSTEM +--- 522,528 ---- + 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 -*** 602,608 **** - in case they are needed there. */ - SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \ +*** 560,566 **** + SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ -! mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o \ - w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \ - w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o + fontset.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) ---- 602,608 ---- - in case they are needed there. */ - SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \ +--- 560,566 ---- + SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ -! mac.o macterm.o macfns.o macmenu.o macselect.o macim.o fontset.o \ - w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \ - w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o + fontset.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) -*************** macselect.o: blockinput.h atimer.h systi -*** 1290,1295 **** ---- 1290,1299 ---- - mactoolbox.o: blockinput.h atimer.h systime.h macterm.h macgui.h frame.h \ - charset.h coding.h ccl.h dispextern.h fontset.h termhooks.h buffer.h \ - window.h keyboard.h $(config_h) -+ macim.o: blockinput.h atimer.h systime.h syssignal.h macterm.h macgui.h \ -+ frame.h charset.h ccl.h dispextern.h fontset.h termhooks.h termopts.h \ -+ termchar.h gnu.h disptab.h buffer.h window.h keyboard.h $(INTERVAL_SRC) \ -+ process.h coding.h $(config_h) - - ${emacsapp}Contents/Resources/English.lproj: - mkdir -p $@ -diff -p -N -r -x '*.orig' ../emacs/src/keyboard.c src/keyboard.c -*** ../emacs/src/keyboard.c 2008-02-26 01:04:54.000000000 +0900 ---- src/keyboard.c 2008-06-29 19:49:33.000000000 +0900 -*************** Lisp_Object Qmouse_click; -*** 532,537 **** ---- 532,540 ---- - #if defined (WINDOWSNT) || defined (MAC_OS) - Lisp_Object Qlanguage_change; - #endif -+ #if defined (MAC_OSX) -+ Lisp_Object Qmac_change_input_method; -+ #endif - Lisp_Object Qdrag_n_drop; - Lisp_Object Qsave_session; - #ifdef MAC_OS -*************** kbd_buffer_get_event (kbp, used_mouse_me -*** 4163,4168 **** ---- 4166,4180 ---- - kbd_fetch_ptr = event + 1; - } - #endif -+ #if defined (MAC_OSX) -+ else if (event->kind == MAC_CHANGE_INPUT_METHOD_EVENT) -+ { -+ /* Make an event (mac-change-input-method (KEY_SCRIPT)). */ -+ obj = Fcons (make_number (event->code), Qnil); -+ obj = Fcons (Qmac_change_input_method, Fcons (obj, Qnil)); -+ kbd_fetch_ptr = event + 1; -+ } -+ #endif - else if (event->kind == SAVE_SESSION_EVENT) - { - obj = Fcons (Qsave_session, Qnil); -*************** syms_of_keyboard () -*** 11214,11219 **** ---- 11226,11235 ---- - Qlanguage_change = intern ("language-change"); - staticpro (&Qlanguage_change); - #endif -+ #if defined (MAC_OSX) -+ Qmac_change_input_method = intern ("mac-change-input-method"); -+ staticpro (&Qmac_change_input_method); -+ #endif - Qdrag_n_drop = intern ("drag-n-drop"); - staticpro (&Qdrag_n_drop); - -diff -p -N -r -x '*.orig' ../emacs/src/macim.c src/macim.c -*** ../emacs/src/macim.c 1970-01-01 09:00:00.000000000 +0900 ---- src/macim.c 2008-06-29 22:23:33.000000000 +0900 +*************** nsterm.o: nsterm.m blockinput.h atimer.h +*** 1135,1140 **** +--- 1135,1142 ---- + termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \ + $(INTERVALS_H) process.h coding.h $(config_h) + nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h $(config_h) ++ macim.o: macim.c 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 -p -N -r -x '*.orig' ../emacs23-20090519-0/src/macim.c src/macim.c +*** ../emacs23-20090519-0/src/macim.c 1970-01-01 09:00:00.000000000 +0900 +--- src/macim.c 2009-05-25 15:24:21.000000000 +0900 *************** *** 0 **** ---- 1,267 ---- -+ /* Implementation of Inline Input Method for MacOS X. -+ Copyright (C) 2004, 2005, 2006, 2007, 2008 -+ Taiichi Hashimoto <taiic****@mac*****>. +--- 1,166 ---- ++ /* Implementation of Input Method Extension for MacOS X. ++ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 ++ Taiichi Hashimoto <taiic****@mac*****>. ++ */ + -+ This file is part of GNU Emacs. ++ #include "config.h" + -+ GNU Emacs is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3, or (at your option) -+ any later version. ++ #ifdef NS_IMPL_COCOA + -+ GNU Emacs is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. ++ #include <math.h> ++ #include <sys/types.h> ++ #include <time.h> ++ #include <signal.h> ++ #include <unistd.h> + -+ You should have received a copy of the GNU General Public License -+ along with GNU Emacs; see the file COPYING. If not, write to -+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -+ Boston, MA 02110-1301, USA. */ ++ #include <Carbon/Carbon.h> + -+ #include <config.h> -+ #include <signal.h> -+ #include <stdio.h> -+ #include <stdlib.h> + #include "lisp.h" -+ #include "charset.h" + #include "blockinput.h" + -+ #include "macterm.h" ++ enum output_method ++ { ++ output_initial, ++ output_termcap, ++ output_x_window, ++ output_msdos_raw, ++ output_w32, ++ output_mac, ++ output_ns ++ } output_method; + -+ #ifndef MAC_OSX -+ #include <alloca.h> -+ #endif -+ -+ #ifdef MAC_OSX -+ #undef mktime -+ #undef DEBUG -+ #undef free -+ #undef malloc -+ #undef realloc -+ /* Macros max and min defined in lisp.h conflict with those in -+ precompiled header Carbon.h. */ -+ #undef max -+ #undef min -+ #undef init_process -+ #include <Carbon/Carbon.h> -+ #undef free -+ #define free unexec_free -+ #undef malloc -+ #define malloc unexec_malloc -+ #undef realloc -+ #define realloc unexec_realloc -+ #undef min -+ #define min(a, b) ((a) < (b) ? (a) : (b)) -+ #undef max -+ #define max(a, b) ((a) > (b) ? (a) : (b)) -+ #undef init_process -+ #define init_process emacs_init_process -+ /* USE_CARBON_EVENTS determines if the Carbon Event Manager is used to -+ obtain events from the event queue. If set to 0, WaitNextEvent is -+ used instead. */ -+ #define USE_CARBON_EVENTS 1 -+ #else /* not MAC_OSX */ -+ #include <Quickdraw.h> -+ #include <ToolUtils.h> -+ #include <Sound.h> -+ #include <Events.h> -+ #include <Script.h> -+ #include <Resources.h> -+ #include <Fonts.h> -+ #include <TextUtils.h> -+ #include <LowMem.h> -+ #include <Controls.h> -+ #if defined (__MRC__) || (__MSL__ >= 0x6000) -+ #include <ControlDefinitions.h> -+ #endif -+ #include <Gestalt.h> -+ -+ #if __profile__ -+ #include <profiler.h> -+ #endif -+ #endif /* not MAC_OSX */ -+ -+ #include "systty.h" -+ #include "systime.h" -+ #include "atimer.h" -+ #include "keymap.h" -+ -+ #include <ctype.h> -+ #include <errno.h> -+ #include <setjmp.h> -+ #include <sys/stat.h> -+ -+ #include "keyboard.h" -+ #include "frame.h" -+ #include "dispextern.h" -+ #include "fontset.h" + #include "termhooks.h" -+ #include "termopts.h" -+ #include "termchar.h" -+ #include "gnu.h" -+ #include "disptab.h" ++ #include "keyboard.h" + #include "buffer.h" -+ #include "window.h" -+ #include "intervals.h" -+ #include "composite.h" -+ #include "coding.h" + -+ #ifdef USE_CARBON_EVENTS && defined (MAC_OSX) && USE_TSM + + extern Lisp_Object Qcurrent_input_method; ++ extern int cursor_in_echo_area; + static Lisp_Object Qmac_ignore_shortcut; -+ int mac_pass_key_to_system_on_read_only_buffer; + -+ void init_input_method (); -+ int mac_store_change_input_method_event (unsigned long timestamp); ++ void mac_init_input_method (); ++ int mac_pass_key_to_system (int code, UInt32 modifiers); ++ int mac_store_change_input_method_event (); + + DEFUN ("mac-set-key-script", Fmac_set_key_script, + Smac_set_key_script, 1, 1, 0, @@ -546,167 +376,187 @@ + + + int -+ mac_store_change_input_method_event (unsigned long timestamp) ++ mac_store_change_input_method_event () + { + Lisp_Object cim, him, dim; + static SInt16 last_key_script = -1; -+ SInt16 current_key_script, count = 0; ++ SInt16 current_key_script; ++ int ret = FALSE; + -+ BLOCK_INPUT; -+ + dim = Fsymbol_value (intern ("default-input-method")); + -+ if (STRINGP (dim) && strcmp(SDATA (dim), "MacOSX") == 0) { -+ current_key_script = GetScriptManagerVariable (smKeyScript); ++ if (STRINGP (dim) && strcmp(SDATA (dim), "MacOSX") == 0) ++ { ++ current_key_script = GetScriptManagerVariable (smKeyScript); + -+ cim = Fsymbol_value (Qcurrent_input_method); -+ him = Fcar_safe (intern ("input-method-history")); ++ cim = Fsymbol_value (Qcurrent_input_method); ++ him = Fcar_safe (intern ("input-method-history")); + -+ if (NILP (cim) || NILP (him) || -+ (STRINGP (cim) && !strcmp(SDATA (cim), "MacOSX")) -+ || (STRINGP (him) && !strcmp(SDATA (him), "MacOSX"))) -+ { -+ if (last_key_script != current_key_script -+ || (current_key_script && NILP (cim)) -+ || (!current_key_script && !NILP (cim))) -+ { -+ struct input_event event; -+ -+ EVENT_INIT (event); -+ event.kind = MAC_CHANGE_INPUT_METHOD_EVENT; -+ event.arg = Qnil; -+ event.code = current_key_script; -+ event.timestamp = timestamp; -+ kbd_buffer_store_event (&event); -+ count++; -+ } -+ -+ last_key_script = current_key_script; -+ } -+ else -+ if (current_key_script) KeyScript (smKeyRoman); -+ } ++ if (NILP (cim) || NILP (him) || ++ (STRINGP (cim) && !strcmp(SDATA (cim), "MacOSX")) ++ || (STRINGP (him) && !strcmp(SDATA (him), "MacOSX"))) ++ { ++ if (last_key_script != current_key_script ++ || (current_key_script && NILP (cim)) ++ || (!current_key_script && !NILP (cim))) ++ { ++ ret = TRUE; ++ } ++ last_key_script = current_key_script; ++ } ++ else ++ if (current_key_script) KeyScript (smKeyRoman); ++ } + -+ UNBLOCK_INPUT; -+ -+ return count; ++ return ret; + } + + + int + mac_pass_key_to_system (int code, UInt32 modifiers) + { -+ Lisp_Object buf = Qnil; + SInt16 current_key_script; ++ Lisp_Object keys = Fsymbol_value (Qmac_ignore_shortcut); ++ Lisp_Object m, k; + -+ buf = Fsymbol_value (intern ("mac-ts-active-input-buf")); + current_key_script = GetScriptManagerVariable (smKeyScript); -+ ++ + if (current_key_script + && (this_command_key_count || cursor_in_echo_area)) + return FALSE; + else if (current_key_script -+ && !mac_pass_key_to_system_on_read_only_buffer -+ && !NILP (current_buffer->read_only) -+ && code != 0x20) ++ && !NILP (current_buffer->read_only)) + return FALSE; -+ else if (!Flength (buf)) -+ { -+ Fsymbol_value (Qcurrent_input_method); -+ Lisp_Object keys = Fsymbol_value (Qmac_ignore_shortcut); -+ 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 FALSE; -+ } -+ return TRUE; -+ } + else -+ return TRUE; ++ 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 FALSE; ++ } ++ ++ return TRUE; + } + + -+ void init_input_method () ++ void mac_init_input_method () + { + Qmac_ignore_shortcut = intern ("mac-ignore-shortcut"); + staticpro (&Qmac_ignore_shortcut); + -+ DEFVAR_BOOL ("mac-pass-key-to-system-on-read-only-buffer", -+ &mac_pass_key_to_system_on_read_only_buffer, -+ doc: /* If nil, don't pass key to system when buffer is read-only. */); -+ mac_pass_key_to_system_on_read_only_buffer = 0; -+ + defsubr (&Smac_set_key_script); + defsubr (&Smac_get_current_key_script); + defsubr (&Smac_get_last_key_script); -+ + } + + #endif +diff -p -N -r -x '*.orig' ../emacs23-20090519-0/src/nsfns.m src/nsfns.m +*** ../emacs23-20090519-0/src/nsfns.m 2009-05-19 21:44:12.000000000 +0900 +--- src/nsfns.m 2009-05-19 21:44:46.000000000 +0900 +*************** be used as the image of the icon represe +*** 2710,2715 **** +--- 2710,2719 ---- + defsubr (&Sx_show_tip); + defsubr (&Sx_hide_tip); + ++ #ifdef NS_IMPL_COCOA ++ mac_init_input_method (); ++ #endif + -diff -p -N -r -x '*.orig' ../emacs/src/mactoolbox.c src/mactoolbox.c -*** ../emacs/src/mactoolbox.c 2008-04-24 12:07:38.000000000 +0900 ---- src/mactoolbox.c 2008-06-29 19:49:33.000000000 +0900 -*************** XTread_socket (sd, expected, hold_quit) -*** 4142,4148 **** - #if TARGET_API_MAC_CARBON - if (!(mapped_modifiers - & ~(mac_pass_command_to_system ? cmdKey : 0) -! & ~(mac_pass_control_to_system ? controlKey : 0))) - goto OTHER; - else - #endif ---- 4142,4150 ---- - #if TARGET_API_MAC_CARBON - if (!(mapped_modifiers - & ~(mac_pass_command_to_system ? cmdKey : 0) -! & ~(mac_pass_control_to_system ? controlKey : 0)) -! && mac_pass_key_to_system (er.message & charCodeMask, -! modifiers)) - goto OTHER; - else - #endif -*************** XTread_socket (sd, expected, hold_quit) -*** 4203,4208 **** ---- 4205,4211 ---- - } - count++; - } -+ count += mac_store_change_input_method_event (timestamp); - } + /* used only in fontset.c */ + check_window_system_func = check_ns; - /* If the focus was just given to an autoraising frame, -*************** mac_toolbox_initialize () -*** 6610,6615 **** ---- 6613,6619 ---- - #endif - #if USE_MAC_TSM - init_tsm (); -+ init_input_method(); - #endif +diff -p -N -r -x '*.orig' ../emacs23-20090519-0/src/nsterm.h src/nsterm.h +*** ../emacs23-20090519-0/src/nsterm.h 2009-05-19 21:44:12.000000000 +0900 +--- src/nsterm.h 2009-05-19 21:44:46.000000000 +0900 +*************** typedef unsigned long NSUInteger; +*** 357,362 **** +--- 357,363 ---- + #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) + + /* could use list to store these, but rest of emacs has a big infrastructure + for managing a table of bitmap "records" */ +diff -p -N -r -x '*.orig' ../emacs23-20090519-0/src/nsterm.m src/nsterm.m +*** ../emacs23-20090519-0/src/nsterm.m 2009-05-19 21:44:12.000000000 +0900 +--- src/nsterm.m 2009-05-25 15:23:24.000000000 +0900 +*************** ns_term_init (Lisp_Object display_name) +*** 3820,3825 **** +--- 3820,3828 ---- + /* [[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) +*** 4026,4031 **** +--- 4029,4046 ---- + NSLog (@"notification: '%@'", [notification name]); } -diff -p -N -r -x '*.orig' ../emacs/src/termhooks.h src/termhooks.h -*** ../emacs/src/termhooks.h 2008-01-08 13:29:50.000000000 +0900 ---- src/termhooks.h 2008-06-29 19:49:33.000000000 +0900 -*************** enum event_kind -*** 265,270 **** ---- 265,274 ---- - language is changed by the - user. */ - #endif -+ #if defined (MAC_OSX) -+ MAC_CHANGE_INPUT_METHOD_EVENT,/* A MAC_CHANGE_INPUT_METHOD_EVENT is generated -+ for changing input method on MacOSX. */ ++ - (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 + /* -------------------------------------------------------------------------- +*************** extern void update_window_cursor (struct +*** 4594,4599 **** +--- 4609,4625 ---- + EV_TRAILER (theEvent); + return; + } ++ ++ #ifdef NS_IMPL_COCOA ++ if (!mac_pass_key_to_system (code, flags)) ++ { ++ emacs_event->kind = code > 0xFF ++ ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; ++ emacs_event->code = code; ++ EV_TRAILER (theEvent); ++ return; ++ } + #endif - SCROLL_BAR_CLICK_EVENT, /* .code gives the number of the mouse button - that was clicked. - .modifiers holds the state of the modifier + } + + /* if we get here we should send the key for input manager processing */ +diff -p -N -r -x '*.orig' ../emacs23-20090519-0/src/s/darwin.h src/s/darwin.h +*** ../emacs23-20090519-0/src/s/darwin.h 2009-05-19 21:44:12.000000000 +0900 +--- src/s/darwin.h 2009-05-19 21:44:46.000000000 +0900 +*************** along with GNU Emacs. If not, see <http +*** 145,151 **** + /* 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 */ +--- 145,151 ---- + /* 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 */