• R/O
  • SSH
  • HTTPS

macemacsjp: Commit


Commit MetaInfo

Revision582 (tree)
Time2012-05-20 17:11:21
Authortaiichi

Log Message

new patch for emacs24

Change Summary

Incremental Difference

--- inline_patch/trunk/font.patch (revision 581)
+++ inline_patch/trunk/font.patch (nonexistent)
@@ -1,30 +0,0 @@
1-diff -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);
--- inline_patch/trunk/lion.patch (revision 581)
+++ inline_patch/trunk/lion.patch (nonexistent)
@@ -1,54 +0,0 @@
1-diff -r -p -N -x '*.o' ../emacs-23.3-0/src/nsterm.m src/nsterm.m
2-*** ../emacs-23.3-0/src/nsterm.m 2011-02-09 08:46:22.000000000 +0900
3---- src/nsterm.m 2011-12-05 16:50:06.000000000 +0900
4-*************** ns_term_shutdown (int sig)
5-*** 5106,5112 ****
6-
7- win = [[EmacsWindow alloc]
8- initWithContentRect: r
9-! styleMask: (NSResizableWindowMask |
10- NSMiniaturizableWindowMask |
11- NSClosableWindowMask)
12- backing: NSBackingStoreBuffered
13---- 5106,5113 ----
14-
15- win = [[EmacsWindow alloc]
16- initWithContentRect: r
17-! styleMask: (NSTitledWindowMask |
18-! NSResizableWindowMask |
19- NSMiniaturizableWindowMask |
20- NSClosableWindowMask)
21- backing: NSBackingStoreBuffered
22-diff -r -p -N -x '*.o' ../emacs-23.3-0/src/s/darwin.h src/s/darwin.h
23-*** ../emacs-23.3-0/src/s/darwin.h 2011-01-09 02:45:14.000000000 +0900
24---- src/s/darwin.h 2011-12-05 16:49:29.000000000 +0900
25-*************** along with GNU Emacs. If not, see <http
26-*** 181,187 ****
27- end of the header for adding load commands. Needed for dumping.
28- 0x690 is the total size of 30 segment load commands (at 56
29- each); under Cocoa 31 commands are required. */
30-! #define LD_SWITCH_SYSTEM_TEMACS -prebind LIBS_NSGUI -Xlinker -headerpad -Xlinker HEADERPAD_EXTRA
31-
32- #define C_SWITCH_SYSTEM_TEMACS -Dtemacs
33-
34---- 181,187 ----
35- end of the header for adding load commands. Needed for dumping.
36- 0x690 is the total size of 30 segment load commands (at 56
37- each); under Cocoa 31 commands are required. */
38-! #define LD_SWITCH_SYSTEM_TEMACS -fno-pie -prebind LIBS_NSGUI -Xlinker -headerpad -Xlinker HEADERPAD_EXTRA
39-
40- #define C_SWITCH_SYSTEM_TEMACS -Dtemacs
41-
42-diff -r -p -N -x '*.o' ../emacs-23.3-0/src/unexmacosx.c src/unexmacosx.c
43-*** ../emacs-23.3-0/src/unexmacosx.c 2011-01-09 02:45:14.000000000 +0900
44---- src/unexmacosx.c 2011-12-05 16:49:51.000000000 +0900
45-*************** copy_data_segment (struct load_command *
46-*** 822,827 ****
47---- 822,828 ----
48- }
49- else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
50- || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
51-+ || strncmp (sectp->sectname, "__got", 16) == 0
52- || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0
53- || strncmp (sectp->sectname, "__dyld", 16) == 0
54- || strncmp (sectp->sectname, "__const", 16) == 0
--- inline_patch/trunk/xcode4.patch (revision 581)
+++ inline_patch/trunk/xcode4.patch (nonexistent)
@@ -1,13 +0,0 @@
1-diff -rp ../emacs-23.3-0/src/unexmacosx.c src/unexmacosx.c
2-*** ../emacs-23.3-0/src/unexmacosx.c 2011-01-09 02:45:14.000000000 +0900
3---- src/unexmacosx.c 2011-03-15 09:30:50.000000000 +0900
4-*************** copy_data_segment (struct load_command *
5-*** 822,827 ****
6---- 822,828 ----
7- }
8- else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
9- || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
10-+ || strncmp (sectp->sectname, "__got", 16) == 0
11- || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0
12- || strncmp (sectp->sectname, "__dyld", 16) == 0
13- || strncmp (sectp->sectname, "__const", 16) == 0
--- inline_patch/trunk/emacs-inline.patch (revision 581)
+++ inline_patch/trunk/emacs-inline.patch (revision 582)
@@ -1,18 +1,562 @@
1-diff -r -p -x '*.elc' ../emacs-23.3-0-lion/lisp/term/ns-win.el lisp/term/ns-win.el
2-*** ../emacs-23.3-0-lion/lisp/term/ns-win.el 2011-12-05 16:49:13.000000000 +0900
3---- lisp/term/ns-win.el 2012-01-13 08:55:10.000000000 +0900
1+diff -N -p ../emacs-24.0.97/configure.in ./configure.in
2+*** ../emacs-24.0.97/configure.in 2012-05-17 11:19:50.000000000 +0900
3+--- ./configure.in 2012-05-20 17:01:19.000000000 +0900
4+*************** if test "${HAVE_NS}" = yes; then
5+*** 1582,1588 ****
6+ fi
7+ ns_frag=$srcdir/src/ns.mk
8+ NS_OBJ="fontset.o fringe.o image.o"
9+! NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o"
10+ fi
11+ CFLAGS="$tmp_CFLAGS"
12+ CPPFLAGS="$tmp_CPPFLAGS"
13+--- 1582,1588 ----
14+ fi
15+ ns_frag=$srcdir/src/ns.mk
16+ NS_OBJ="fontset.o fringe.o image.o"
17+! NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o"
18+ fi
19+ CFLAGS="$tmp_CFLAGS"
20+ CPPFLAGS="$tmp_CPPFLAGS"
21+*************** case "$opsys" in
22+*** 3416,3422 ****
23+ ## 0x690 is the total size of 30 segment load commands (at 56
24+ ## each); under Cocoa 31 commands are required.
25+ if test "$HAVE_NS" = "yes"; then
26+! libs_nsgui="-framework AppKit"
27+ headerpad_extra=6C8
28+ else
29+ libs_nsgui=
30+--- 3416,3422 ----
31+ ## 0x690 is the total size of 30 segment load commands (at 56
32+ ## each); under Cocoa 31 commands are required.
33+ if test "$HAVE_NS" = "yes"; then
34+! libs_nsgui="-framework AppKit -framework Carbon"
35+ headerpad_extra=6C8
36+ else
37+ libs_nsgui=
38+diff -r -N -p ../emacs-24.0.96/src/Makefile.in src/Makefile.in
39+*** ../emacs-24.0.96/src/Makefile.in 2012-04-08 12:03:02.000000000 +0900
40+--- src/Makefile.in 2012-05-03 22:23:59.000000000 +0900
41+*************** obj = $(base_obj) $(NS_OBJC_OBJ)
42+*** 350,356 ****
43+ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
44+ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
45+ fontset.o dbusbind.o \
46+! nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
47+ w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
48+ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
49+ w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
50+--- 350,356 ----
51+ SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
52+ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
53+ fontset.o dbusbind.o \
54+! nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o\
55+ w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
56+ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
57+ w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
58+diff -r -N -p ../emacs-24.0.96/src/keyboard.c src/keyboard.c
59+*** ../emacs-24.0.96/src/keyboard.c 2012-04-08 12:03:02.000000000 +0900
60+--- src/keyboard.c 2012-05-03 22:23:59.000000000 +0900
61+*************** kbd_buffer_get_event (KBOARD **kbp,
62+*** 3915,3922 ****
63+ {
64+ if (event->code == KEY_NS_PUT_WORKING_TEXT)
65+ obj = Fcons (intern ("ns-put-working-text"), Qnil);
66+! else
67+ obj = Fcons (intern ("ns-unput-working-text"), Qnil);
68+ kbd_fetch_ptr = event + 1;
69+ if (used_mouse_menu)
70+ *used_mouse_menu = 1;
71+--- 3915,3924 ----
72+ {
73+ if (event->code == KEY_NS_PUT_WORKING_TEXT)
74+ obj = Fcons (intern ("ns-put-working-text"), Qnil);
75+! else if (event->code == KEY_NS_UNPUT_WORKING_TEXT)
76+ obj = Fcons (intern ("ns-unput-working-text"), Qnil);
77++ else if (event->code == KEY_NS_PUT_MARKED_TEXT)
78++ obj = Fcons (intern ("ns-put-marked-text"), event->arg);
79+ kbd_fetch_ptr = event + 1;
80+ if (used_mouse_menu)
81+ *used_mouse_menu = 1;
82+*************** keys_of_keyboard (void)
83+*** 12332,12337 ****
84+--- 12334,12341 ----
85+ "ns-put-working-text");
86+ initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",
87+ "ns-unput-working-text");
88++ initial_define_lispy_key (Vspecial_event_map, "ns-put-marked-text",
89++ "ns-put-marked-text");
90+ /* Here we used to use `ignore-event' which would simple set prefix-arg to
91+ current-prefix-arg, as is done in `handle-switch-frame'.
92+ But `handle-switch-frame is not run from the special-map.
93+diff -r -N -p ../emacs-24.0.96/src/macim.m src/macim.m
94+*** ../emacs-24.0.96/src/macim.m 1970-01-01 09:00:00.000000000 +0900
95+--- src/macim.m 2012-05-03 22:23:59.000000000 +0900
96+***************
97+*** 0 ****
98+--- 1,177 ----
99++ /* Implementation of Input Method Extension for MacOS X.
100++ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
101++ Taiichi Hashimoto <taiichi2@mac.com>.
102++ */
103++
104++ #include "config.h"
105++
106++ #ifdef NS_IMPL_COCOA
107++
108++ #include <math.h>
109++ #include <sys/types.h>
110++ #include <time.h>
111++ #include <signal.h>
112++ #include <unistd.h>
113++
114++ #include <Carbon/Carbon.h>
115++
116++ #include "lisp.h"
117++ #include "blockinput.h"
118++
119++ enum output_method
120++ {
121++ output_initial,
122++ output_termcap,
123++ output_x_window,
124++ output_msdos_raw,
125++ output_w32,
126++ output_mac,
127++ output_ns
128++ } output_method;
129++
130++ #include "termhooks.h"
131++ #include "keyboard.h"
132++ #include "buffer.h"
133++
134++ //extern Lisp_Object Qcurrent_input_method;
135++ //extern int cursor_in_echo_area;
136++ static Lisp_Object Qmac_keys_passed_to_system;
137++
138++ void mac_init_input_method ();
139++ int mac_pass_key_to_system (int code, int modifiers);
140++ int mac_pass_key_directly_to_emacs ();
141++ int mac_store_change_input_method_event ();
142++
143++ DEFUN ("mac-input-source-is-ascii-capable", Fmac_input_source_is_ascii_capable, Smac_input_source_is_ascii_capable,
144++ 0, 0, 0,
145++ doc: /* Is current input source ascii capable? */)
146++ (void)
147++ {
148++ TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
149++ CFBooleanRef ret = TISGetInputSourceProperty(is, kTISPropertyInputSourceIsASCIICapable);
150++
151++ return CFBooleanGetValue(ret)? Qt : Qnil;
152++ }
153++
154++ DEFUN ("mac-get-input-source-list", Fmac_get_input_source_list, Smac_get_input_source_list,
155++ 0, 0, 0,
156++ doc: /* get input source list on MacOSX */)
157++ (void)
158++ {
159++ NSArray *is_list = (NSArray *)TISCreateInputSourceList(NULL, false);
160++ int list_size = [is_list count];
161++ Lisp_Object list[list_size];
162++ int i;
163++
164++ for (i = 0; i < list_size; i++) {
165++ TISInputSourceRef is = (TISInputSourceRef)[is_list objectAtIndex:i];
166++ NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
167++ list[i] = make_string([id UTF8String],
168++ [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
169++ }
170++
171++ return Flist(list_size, list);
172++ }
173++
174++ DEFUN ("mac-get-current-input-source", Fmac_get_current_input_source, Smac_get_current_input_source,
175++ 0, 0, 0,
176++ doc: /* get current input source on MacOSX */)
177++ (void)
178++ {
179++ TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
180++ NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
181++
182++ return make_string([id UTF8String],
183++ [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
184++ }
185++
186++ DEFUN ("mac-toggle-input-source", Fmac_toggle_input_source, Smac_toggle_input_source,
187++ 1, 1, 0,
188++ doc: /* toggle input source on MacOSX */)
189++ (arg)
190++ Lisp_Object arg;
191++ {
192++ TISInputSourceRef is = NULL;
193++
194++ if (NILP (arg))
195++ {
196++ is = TISCopyCurrentASCIICapableKeyboardInputSource();
197++ }
198++ else
199++ {
200++ NSString *locale = [[NSLocale currentLocale] localeIdentifier];
201++ is = TISCopyInputSourceForLanguage((CFStringRef)locale);
202++ }
203++ if (is) TISSelectInputSource(is);
204++
205++ return arg;
206++ }
207++
208++ int
209++ mac_store_change_input_method_event ()
210++ {
211++ Lisp_Object dim;
212++ int ret = FALSE;
213++
214++ dim = Fsymbol_value (intern ("default-input-method"));
215++ if (STRINGP (dim) && strcmp(SDATA (dim), "MacOSX") == 0)
216++ {
217++ ret = TRUE;
218++ }
219++
220++ return ret;
221++ }
222++
223++ int
224++ mac_pass_key_to_system (int code, int modifiers)
225++ {
226++ Lisp_Object keys = Fsymbol_value (Qmac_keys_passed_to_system);
227++ Lisp_Object m, k;
228++
229++ while (!NILP (keys))
230++ {
231++ m = XCAR (XCAR (keys));
232++ k = XCDR (XCAR (keys));
233++ keys = XCDR (keys);
234++
235++ if (NUMBERP (m) && modifiers == XINT (m))
236++ if (NILP (k)
237++ || (NUMBERP (k) && code == XINT (k)))
238++ return TRUE;
239++ }
240++
241++ return FALSE;
242++ }
243++
244++ int
245++ mac_pass_key_directly_to_emacs (void)
246++ {
247++
248++ if (NILP (Fmac_input_source_is_ascii_capable()))
249++ {
250++ if (NILP (Vmac_use_input_method_on_system)
251++ || this_command_key_count
252++ || cursor_in_echo_area
253++ || !NILP (BVAR (current_buffer, read_only)))
254++ return TRUE;
255++ }
256++
257++ return FALSE;
258++ }
259++
260++
261++ void mac_init_input_method (void)
262++ {
263++ Qmac_keys_passed_to_system = intern ("mac-keys-passed-to-system");
264++ staticpro (&Qmac_keys_passed_to_system);
265++
266++ DEFVAR_LISP ("mac-use-input-method-on-system", Vmac_use_input_method_on_system,
267++ doc: /* If it is non-nil, use input method on system. */);
268++ Vmac_use_input_method_on_system = Qt;
269++
270++ defsubr (&Smac_input_source_is_ascii_capable);
271++ defsubr (&Smac_get_input_source_list);
272++ defsubr (&Smac_get_current_input_source);
273++ defsubr (&Smac_toggle_input_source);
274++ }
275++ #endif
276+diff -r -N -p ../emacs-24.0.96/src/nsfns.m src/nsfns.m
277+*** ../emacs-24.0.96/src/nsfns.m 2012-04-08 12:03:02.000000000 +0900
278+--- src/nsfns.m 2012-05-04 00:05:24.000000000 +0900
279+*************** static ptrdiff_t image_cache_refcount;
280+*** 111,117 ****
281+
282+ ========================================================================== */
283+
284+-
285+ void
286+ check_ns (void)
287+ {
288+--- 111,116 ----
289+*************** be used as the image of the icon represe
290+*** 2722,2727 ****
291+--- 2721,2744 ----
292+ doc: /* Toolkit version for NS Windowing. */);
293+ Vns_version_string = ns_appkit_version_str ();
294+
295++
296++ DEFVAR_LISP ("ns-shift-key-mask", Vns_shift_key_mask,
297++ doc: /* Shift key mask defined in system. */);
298++ Vns_shift_key_mask = make_number (NSShiftKeyMask);
299++
300++ DEFVAR_LISP ("ns-control-key-mask", Vns_control_key_mask,
301++ doc: /* Control key mask defined in system. */);
302++ Vns_control_key_mask = make_number (NSControlKeyMask);
303++
304++ DEFVAR_LISP ("ns-alternate-key-mask", Vns_alternate_key_mask,
305++ doc: /* Alternate key mask defined in system. */);
306++ Vns_alternate_key_mask = make_number (NSAlternateKeyMask);
307++
308++ DEFVAR_LISP ("ns-command-key-mask", Vns_command_key_mask,
309++ doc: /* Command key mask defined in system. */);
310++ Vns_command_key_mask = make_number (NSCommandKeyMask);
311++
312++
313+ defsubr (&Sns_read_file_name);
314+ defsubr (&Sns_get_resource);
315+ defsubr (&Sns_set_resource);
316+*************** be used as the image of the icon represe
317+*** 2766,2771 ****
318+--- 2783,2792 ----
319+ defsubr (&Sx_show_tip);
320+ defsubr (&Sx_hide_tip);
321+
322++ #ifdef NS_IMPL_COCOA
323++ mac_init_input_method ();
324++ #endif
325++
326+ /* used only in fontset.c */
327+ check_window_system_func = check_ns;
328+
329+diff -r -N -p ../emacs-24.0.96/src/nsterm.h src/nsterm.h
330+*** ../emacs-24.0.96/src/nsterm.h 2012-04-08 12:03:02.000000000 +0900
331+--- src/nsterm.h 2012-05-03 22:23:59.000000000 +0900
332+*************** typedef unsigned int NSUInteger;
333+*** 398,403 ****
334+--- 398,405 ----
335+ #define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12)
336+ #define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13)
337+ #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14)
338++ #define KEY_MAC_CHANGE_INPUT_METHOD ((1<<28)|(0<<16)|15)
339++ #define KEY_NS_PUT_MARKED_TEXT ((1<<28)|(0<<16)|16)
340+
341+ /* could use list to store these, but rest of emacs has a big infrastructure
342+ for managing a table of bitmap "records" */
343+diff -r -N -p ../emacs-24.0.96/src/nsterm.m src/nsterm.m
344+*** ../emacs-24.0.96/src/nsterm.m 2012-04-09 22:08:55.000000000 +0900
345+--- src/nsterm.m 2012-05-04 00:12:13.000000000 +0900
346+*************** ns_term_init (Lisp_Object display_name)
347+*** 4040,4045 ****
348+--- 4040,4048 ----
349+ /* [[NSNotificationCenter defaultCenter] addObserver: NSApp
350+ selector: @selector (logNotification:)
351+ name: nil object: nil]; */
352++ [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
353++ selector: @selector (changeInputMethod:)
354++ name: @"AppleSelectedInputSourcesChangedNotification" object: nil];
355+
356+ dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
357+ memset (dpyinfo, 0, sizeof (struct ns_display_info));
358+*************** ns_term_shutdown (int sig)
359+*** 4255,4260 ****
360+--- 4258,4276 ----
361+ NSLog (@"notification: '%@'", [notification name]);
362+ }
363+
364++ - (void)changeInputMethod: (NSNotification *)notification
365++ {
366++
367++ struct frame *emacsframe = SELECTED_FRAME ();
368++
369++ if (mac_store_change_input_method_event())
370++ {
371++ emacs_event->kind = NS_NONKEY_EVENT;
372++ emacs_event->code = KEY_MAC_CHANGE_INPUT_METHOD;
373++ emacs_event->modifiers = 0;
374++ EV_TRAILER ((id)nil);
375++ }
376++ }
377+
378+ - (void)sendEvent: (NSEvent *)theEvent
379+ /* --------------------------------------------------------------------------
380+*************** ns_term_shutdown (int sig)
381+*** 4857,4863 ****
382+ code, fnKeysym, flags, emacs_event->modifiers);
383+
384+ /* if it was a function key or had modifiers, pass it directly to emacs */
385+! if (fnKeysym || (emacs_event->modifiers
386+ && (emacs_event->modifiers != shift_modifier)
387+ && [[theEvent charactersIgnoringModifiers] length] > 0))
388+ /*[[theEvent characters] length] */
389+--- 4872,4879 ----
390+ code, fnKeysym, flags, emacs_event->modifiers);
391+
392+ /* if it was a function key or had modifiers, pass it directly to emacs */
393+! if (mac_pass_key_directly_to_emacs ()
394+! ||fnKeysym || (emacs_event->modifiers
395+ && (emacs_event->modifiers != shift_modifier)
396+ && [[theEvent charactersIgnoringModifiers] length] > 0))
397+ /*[[theEvent characters] length] */
398+*************** ns_term_shutdown (int sig)
399+*** 4872,4879 ****
400+ ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
401+
402+ emacs_event->code = code;
403+! EV_TRAILER (theEvent);
404+! return;
405+ }
406+ }
407+
408+--- 4888,4905 ----
409+ ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
410+
411+ emacs_event->code = code;
412+! /* The function mac_pass_key_to_system decides
413+! whether it is passed directly to emacs or not. */
414+! if (emacs_event->kind == NON_ASCII_KEYSTROKE_EVENT
415+! || !mac_pass_key_to_system (code, flags
416+! & (NSShiftKeyMask
417+! | NSControlKeyMask
418+! | NSAlternateKeyMask
419+! | NSCommandKeyMask)))
420+! {
421+! EV_TRAILER (theEvent);
422+! return;
423+! }
424+ }
425+ }
426+
427+*************** ns_term_shutdown (int sig)
428+*** 4966,4975 ****
429+ NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length],
430+ selRange.length, selRange.location);
431+
432+- if (workingText != nil)
433+- [self deleteWorkingText];
434+ if ([str length] == 0)
435+! return;
436+
437+ if (!emacs_event)
438+ return;
439+--- 4992,5010 ----
440+ NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length],
441+ selRange.length, selRange.location);
442+
443+ if ([str length] == 0)
444+! {
445+! [self deleteWorkingText];
446+! return;
447+! }
448+! else
449+! {
450+! if (workingText != nil) {
451+! [workingText release];
452+! workingText = nil;
453+! processingCompose = NO;
454+! }
455+! }
456+
457+ if (!emacs_event)
458+ return;
459+*************** ns_term_shutdown (int sig)
460+*** 4979,4985 ****
461+ ns_working_text = build_string ([workingText UTF8String]);
462+
463+ emacs_event->kind = NS_TEXT_EVENT;
464+! emacs_event->code = KEY_NS_PUT_WORKING_TEXT;
465+ EV_TRAILER ((id)nil);
466+ }
467+
468+--- 5014,5022 ----
469+ ns_working_text = build_string ([workingText UTF8String]);
470+
471+ emacs_event->kind = NS_TEXT_EVENT;
472+! emacs_event->code = KEY_NS_PUT_MARKED_TEXT;
473+! emacs_event->arg = Fcons (make_number (selRange.location),
474+! Fcons (make_number (selRange.length), Qnil));
475+ EV_TRAILER ((id)nil);
476+ }
477+
478+*************** ns_term_shutdown (int sig)
479+*** 5034,5048 ****
480+ {
481+ NSRect rect;
482+ NSPoint pt;
483+! struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
484+ if (NS_KEYLOG)
485+ NSLog (@"firstRectForCharRange request");
486+
487+ rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
488+ rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
489+ pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
490+ pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
491+! +FRAME_LINE_HEIGHT (emacsframe));
492+
493+ pt = [self convertPoint: pt toView: nil];
494+ pt = [[self window] convertBaseToScreen: pt];
495+--- 5071,5093 ----
496+ {
497+ NSRect rect;
498+ NSPoint pt;
499+! // struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
500+! struct window *win;
501+ if (NS_KEYLOG)
502+ NSLog (@"firstRectForCharRange request");
503++
504++ if (NILP (Vmac_in_echo_area))
505++ win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
506++ else if (WINDOWP (echo_area_window))
507++ win = XWINDOW (echo_area_window);
508++ else
509++ win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
510+
511+ rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
512+ rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
513+ pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
514+ pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
515+! +FRAME_LINE_HEIGHT (emacsframe)+2);
516+
517+ pt = [self convertPoint: pt toView: nil];
518+ pt = [[self window] convertBaseToScreen: pt];
519+*************** variable `x-use-underline-position-prope
520+*** 6764,6769 ****
521+--- 6809,6818 ----
522+ baseline level. The default value is nil. */);
523+ x_underline_at_descent_line = 0;
524+
525++ DEFVAR_LISP ("mac-in-echo-area", Vmac_in_echo_area,
526++ doc: /* state of cursor in echo area. */);
527++ Vmac_in_echo_area = Qnil;
528++
529+ /* Tell emacs about this window system. */
530+ Fprovide (intern ("ns"), Qnil);
531+ }
532+diff -r -N -p ../emacs-24.0.96/lisp/term/common-win.el lisp/term/common-win.el
533+*** ../emacs-24.0.96/lisp/term/common-win.el 2012-04-08 12:03:02.000000000 +0900
534+--- lisp/term/common-win.el 2012-05-03 22:23:59.000000000 +0900
535+*************** is not used)."
536+*** 127,132 ****
537+--- 127,133 ----
538+ (cons (logior (lsh 0 16) 12) 'ns-new-frame)
539+ (cons (logior (lsh 0 16) 13) 'ns-toggle-toolbar)
540+ (cons (logior (lsh 0 16) 14) 'ns-show-prefs)
541++ (cons (logior (lsh 0 16) 15) 'mac-change-input-method)
542+ ))))
543+ (set-terminal-parameter frame 'x-setup-function-keys t)))
544+
545+diff -r -N -p ../emacs-24.0.96/lisp/term/ns-win.el lisp/term/ns-win.el
546+*** ../emacs-24.0.96/lisp/term/ns-win.el 2012-04-08 12:03:02.000000000 +0900
547+--- lisp/term/ns-win.el 2012-05-03 23:57:14.000000000 +0900
4548 *************** 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)
549+*** 173,178 ****
550+--- 173,179 ----
551+ (define-key global-map [ns-new-frame] 'make-frame)
552+ (define-key global-map [ns-toggle-toolbar] 'ns-toggle-toolbar)
553+ (define-key global-map [ns-show-prefs] 'customize)
554++ (define-key global-map [mac-change-input-method] 'mac-change-input-method)
555+
556+
557+ ;; Set up a number of aliases and other layers to pretend we're using
14558 *************** The properties returned may include `top
15-*** 549,562 ****
559+*** 259,272 ****
16560 ;; editing window.)
17561
18562 (defface ns-working-text-face
@@ -27,7 +571,7 @@
27571 (defvar ns-working-text) ; nsterm.m
28572
29573 ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
30---- 550,579 ----
574+--- 260,289 ----
31575 ;; editing window.)
32576
33577 (defface ns-working-text-face
@@ -58,9 +602,48 @@
58602 (defvar ns-working-text) ; nsterm.m
59603
60604 ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
605+*************** When text is in th echo area, this just
606+*** 274,290 ****
607+ (defun ns-in-echo-area ()
608+ "Whether, for purposes of inserting working composition text, the minibuffer
609+ is currently being used."
610+! (or isearch-mode
611+! (and cursor-in-echo-area (current-message))
612+! ;; Overlay strings are not shown in some cases.
613+! (get-char-property (point) 'invisible)
614+! (and (not (bobp))
615+! (or (and (get-char-property (point) 'display)
616+! (eq (get-char-property (1- (point)) 'display)
617+! (get-char-property (point) 'display)))
618+! (and (get-char-property (point) 'composition)
619+! (eq (get-char-property (1- (point)) 'composition)
620+! (get-char-property (point) 'composition)))))))
621+
622+ ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
623+ ;; always returns nil for some reason. If this WASN'T the case, we could
624+--- 291,309 ----
625+ (defun ns-in-echo-area ()
626+ "Whether, for purposes of inserting working composition text, the minibuffer
627+ is currently being used."
628+! (setq mac-in-echo-area
629+! (or isearch-mode
630+! (and cursor-in-echo-area (current-message))
631+! ;; Overlay strings are not shown in some cases.
632+! (get-char-property (point) 'invisible)
633+! (and (not (bobp))
634+! (or (and (get-char-property (point) 'display)
635+! (eq (get-char-property (1- (point)) 'display)
636+! (get-char-property (point) 'display)))
637+! (and (get-char-property (point) 'composition)
638+! (eq (get-char-property (1- (point)) 'composition)
639+! (get-char-property (point) 'composition)))))))
640+! mac-in-echo-area)
641+
642+ ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
643+ ;; always returns nil for some reason. If this WASN'T the case, we could
61644 *************** is currently being used."
62-*** 583,588 ****
63---- 600,606 ----
645+*** 293,298 ****
646+--- 312,318 ----
64647 (defun ns-put-working-text ()
65648 (interactive)
66649 (if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text)))
@@ -69,7 +652,7 @@
69652 (interactive)
70653 (ns-delete-working-text))
71654 *************** The overlay is assigned the face `ns-wor
72-*** 604,622 ****
655+*** 314,332 ****
73656 (defun ns-echo-working-text ()
74657 "Echo contents of `ns-working-text' in message display area.
75658 See `ns-insert-working-text'."
@@ -89,7 +672,7 @@
89672 (cond
90673 ((and (overlayp ns-working-overlay)
91674 ;; Still alive?
92---- 622,700 ----
675+--- 334,414 ----
93676 (defun ns-echo-working-text ()
94677 "Echo contents of `ns-working-text' in message display area.
95678 See `ns-insert-working-text'."
@@ -122,20 +705,22 @@
122705 ! `ns-working-text-face' and `ns-marked-text-face'."
123706 ! (ns-delete-working-text)
124707 ! (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))))
708+! (if (<= pos (length ns-working-text))
709+! (progn
710+! (put-text-property pos len 'face 'ns-working-text-face ns-working-text)
711+! (insert ns-working-text)
712+! (if (= len 0)
713+! (overlay-put (setq ns-working-overlay
714+! (make-overlay start (point) (current-buffer) nil t))
715+! 'face 'ns-working-text-face)
716+! (overlay-put (setq ns-working-overlay
717+! (make-overlay start (point) (current-buffer) nil t))
718+! 'face 'ns-unmarked-text-face)
719+! (overlay-put (setq ns-marked-overlay
720+! (make-overlay (+ start pos) (+ start pos len)
721+! (current-buffer) nil t))
722+! 'face 'ns-marked-text-face))
723+! (goto-char (+ start pos))))))
139724 !
140725 ! (defun ns-echo-marked-text (pos len)
141726 ! "Echo contents of `ns-working-text' in message display area.
@@ -148,7 +733,7 @@
148733 ! (setq msglen (length msg)))
149734 ! (setq ns-working-overlay (length ns-working-text))
150735 ! (setq msg (concat msg ns-working-text))
151-! (if (> len 0)
736+! (if (= len 0)
152737 ! (put-text-property msglen (+ msglen ns-working-overlay)
153738 ! 'face 'ns-working-text-face msg)
154739 ! (put-text-property msglen (+ msglen ns-working-overlay)
@@ -169,9 +754,9 @@
169754 (cond
170755 ((and (overlayp ns-working-overlay)
171756 ;; Still alive?
172-*************** the operating system.")
173-*** 1267,1272 ****
174---- 1345,1771 ----
757+*************** See the documentation of `create-fontset
758+*** 931,936 ****
759+--- 1013,1438 ----
175760 (add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
176761
177762
@@ -278,7 +863,7 @@
278863 + ("com.apple.inputmethod.TCIM.Jianyi"
279864 + (title . "速")
280865 + (cursor-color)
281-+ (Cursor-type))
866++ (cursor-type))
282867 + ("com.apple.inputmethod.TCIM.Dayi"
283868 + (title . "易")
284869 + (cursor-color)
@@ -515,8 +1100,7 @@
5151100 + (progn
5161101 + (setq default-input-method "MacOSX")
5171102 + (add-hook 'minibuffer-setup-hook 'mac-change-language-to-us)
518-+ (mac-translate-from-yen-to-backslash)
519-+ (mac-add-key-passed-to-system 'shift))
1103++ (mac-translate-from-yen-to-backslash))
5201104 + (setq default-input-method nil)))
5211105 +
5221106 + ;;
@@ -598,553 +1182,5 @@
5981182 +
5991183 (provide 'ns-win)
6001184
601- ;; arch-tag: eb138a45-4e2e-4d68-b1c9-a39665731644
602-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/Makefile.in src/Makefile.in
603-*** ../emacs-23.3-0-lion/src/Makefile.in 2011-12-05 16:49:13.000000000 +0900
604---- src/Makefile.in 2012-01-13 08:53:57.000000000 +0900
605-*************** ns_appresdir=@ns_appresdir@/
606-*** 545,551 ****
607- ns_appsrc=@ns_appsrc@
608- /* Object files for NeXTstep */
609- NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
610-! fontset.o fringe.o image.o
611- #endif /* HAVE_NS */
612-
613- #ifdef HAVE_WINDOW_SYSTEM
614---- 545,551 ----
615- ns_appsrc=@ns_appsrc@
616- /* Object files for NeXTstep */
617- NS_OBJ= nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
618-! fontset.o fringe.o image.o macim.o
619- #endif /* HAVE_NS */
620-
621- #ifdef HAVE_WINDOW_SYSTEM
622-*************** obj= dispnew.o frame.o scroll.o xdisp
623-*** 583,589 ****
624- SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
625- xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
626- fontset.o dbusbind.o \
627-! nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
628- w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
629- w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS)
630-
631---- 583,589 ----
632- SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
633- xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
634- fontset.o dbusbind.o \
635-! nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o\
636- w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
637- w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o $(FONT_DRIVERS)
638-
639-*************** nsterm.o: nsterm.m blockinput.h atimer.h
640-*** 1168,1173 ****
641---- 1168,1174 ----
642- termopts.h termchar.h disptab.h buffer.h window.h keyboard.h \
643- $(INTERVALS_H) process.h coding.h lisp.h $(config_h)
644- nsselect.o: nsselect.m blockinput.h nsterm.h nsgui.h frame.h lisp.h $(config_h)
645-+ macim.o: macim.m lisp.h blockinput.h termhooks.h keyboard.h buffer.h $(config_h)
646- process.o: process.c process.h buffer.h window.h termhooks.h termopts.h \
647- commands.h syssignal.h systime.h systty.h syswait.h frame.h dispextern.h \
648- blockinput.h atimer.h charset.h coding.h ccl.h msdos.h composite.h \
649-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/keyboard.c src/keyboard.c
650-*** ../emacs-23.3-0-lion/src/keyboard.c 2011-12-05 16:49:13.000000000 +0900
651---- src/keyboard.c 2012-01-13 08:53:57.000000000 +0900
652-*************** kbd_buffer_get_event (kbp, used_mouse_me
653-*** 4243,4250 ****
654- {
655- if (event->code == KEY_NS_PUT_WORKING_TEXT)
656- obj = Fcons (intern ("ns-put-working-text"), Qnil);
657-! else
658- obj = Fcons (intern ("ns-unput-working-text"), Qnil);
659- kbd_fetch_ptr = event + 1;
660- if (used_mouse_menu)
661- *used_mouse_menu = 1;
662---- 4243,4252 ----
663- {
664- if (event->code == KEY_NS_PUT_WORKING_TEXT)
665- obj = Fcons (intern ("ns-put-working-text"), Qnil);
666-! else if (event->code == KEY_NS_UNPUT_WORKING_TEXT)
667- obj = Fcons (intern ("ns-unput-working-text"), Qnil);
668-+ else if (event->code == KEY_NS_PUT_MARKED_TEXT)
669-+ obj = Fcons (intern ("ns-put-marked-text"), event->arg);
670- kbd_fetch_ptr = event + 1;
671- if (used_mouse_menu)
672- *used_mouse_menu = 1;
673-*************** keys_of_keyboard ()
674-*** 12611,12616 ****
675---- 12613,12620 ----
676- "ns-put-working-text");
677- initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text",
678- "ns-unput-working-text");
679-+ initial_define_lispy_key (Vspecial_event_map, "ns-put-marked-text",
680-+ "ns-put-marked-text");
681- /* Here we used to use `ignore-event' which would simple set prefix-arg to
682- current-prefix-arg, as is done in `handle-switch-frame'.
683- But `handle-switch-frame is not run from the special-map.
684-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/macim.m src/macim.m
685-*** ../emacs-23.3-0-lion/src/macim.m 1970-01-01 09:00:00.000000000 +0900
686---- src/macim.m 2012-01-13 08:53:57.000000000 +0900
687-***************
688-*** 0 ****
689---- 1,178 ----
690-+ /* Implementation of Input Method Extension for MacOS X.
691-+ Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
692-+ Taiichi Hashimoto <taiichi2@mac.com>.
693-+ */
694-+
695-+ #include "config.h"
696-+
697-+ #ifdef NS_IMPL_COCOA
698-+
699-+ #include <math.h>
700-+ #include <sys/types.h>
701-+ #include <time.h>
702-+ #include <signal.h>
703-+ #include <unistd.h>
704-+
705-+ #include <Carbon/Carbon.h>
706-+
707-+ #include "lisp.h"
708-+ #include "blockinput.h"
709-+
710-+ enum output_method
711-+ {
712-+ output_initial,
713-+ output_termcap,
714-+ output_x_window,
715-+ output_msdos_raw,
716-+ output_w32,
717-+ output_mac,
718-+ output_ns
719-+ } output_method;
720-+
721-+ #include "termhooks.h"
722-+ #include "keyboard.h"
723-+ #include "buffer.h"
724-+
725-+ extern Lisp_Object Qcurrent_input_method;
726-+ extern int cursor_in_echo_area;
727-+ static Lisp_Object Qmac_keys_passed_to_system;
728-+ static Lisp_Object Vmac_use_input_method_on_system;
729-+
730-+ void mac_init_input_method ();
731-+ int mac_pass_key_to_system (int code, int modifiers);
732-+ int mac_pass_key_directly_to_emacs ();
733-+ int mac_store_change_input_method_event ();
734-+
735-+ DEFUN ("mac-input-source-is-ascii-capable", Fmac_input_source_is_ascii_capable,
736-+ Smac_input_source_is_ascii_capable, 0, 0, 0,
737-+ doc: /* Is current input source ascii capable? */)
738-+ ()
739-+ {
740-+ TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
741-+ CFBooleanRef ret = TISGetInputSourceProperty(is, kTISPropertyInputSourceIsASCIICapable);
742-+
743-+ return CFBooleanGetValue(ret)? Qt : Qnil;
744-+ }
745-+
746-+ DEFUN ("mac-get-input-source-list", Fmac_get_input_source_list,
747-+ Smac_get_input_source_list, 0, 0, 0,
748-+ doc: /* get input source list on MacOSX */)
749-+ ()
750-+ {
751-+ NSArray *is_list = (NSArray *)TISCreateInputSourceList(NULL, false);
752-+ int list_size = [is_list count];
753-+ Lisp_Object list[list_size];
754-+ int i;
755-+
756-+ for (i = 0; i < list_size; i++) {
757-+ TISInputSourceRef is = [is_list objectAtIndex:i];
758-+ NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
759-+ list[i] = make_string([id UTF8String],
760-+ [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
761-+ }
762-+
763-+ return Flist(list_size, list);
764-+ }
765-+
766-+ DEFUN ("mac-get-current-input-source", Fmac_get_current_input_source,
767-+ Smac_get_current_input_source, 0, 0, 0,
768-+ doc: /* get current input source on MacOSX */)
769-+ ()
770-+ {
771-+ TISInputSourceRef is = TISCopyCurrentKeyboardInputSource();
772-+ NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID);
773-+
774-+ return make_string([id UTF8String],
775-+ [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
776-+ }
777-+
778-+ DEFUN ("mac-toggle-input-source", Fmac_toggle_input_source,
779-+ Smac_toggle_input_source, 1, 1, 0,
780-+ doc: /* toggle input source on MacOSX */)
781-+ (arg)
782-+ Lisp_Object arg;
783-+ {
784-+ TISInputSourceRef is = NULL;
785-+
786-+ if (NILP (arg))
787-+ {
788-+ is = TISCopyCurrentASCIICapableKeyboardInputSource();
789-+ }
790-+ else
791-+ {
792-+ NSString *locale = [[NSLocale currentLocale] localeIdentifier];
793-+ is = TISCopyInputSourceForLanguage(locale);
794-+ }
795-+ if (is) TISSelectInputSource(is);
796-+
797-+ return arg;
798-+ }
799-+
800-+ int
801-+ mac_store_change_input_method_event ()
802-+ {
803-+ Lisp_Object dim;
804-+ int ret = FALSE;
805-+
806-+ dim = Fsymbol_value (intern ("default-input-method"));
807-+ if (STRINGP (dim) && strcmp(SDATA (dim), "MacOSX") == 0)
808-+ {
809-+ ret = TRUE;
810-+ }
811-+
812-+ return ret;
813-+ }
814-+
815-+ int
816-+ mac_pass_key_to_system (int code, int modifiers)
817-+ {
818-+ Lisp_Object keys = Fsymbol_value (Qmac_keys_passed_to_system);
819-+ Lisp_Object m, k;
820-+
821-+ while (!NILP (keys))
822-+ {
823-+ m = XCAR (XCAR (keys));
824-+ k = XCDR (XCAR (keys));
825-+ keys = XCDR (keys);
826-+
827-+ if (NUMBERP (m) && modifiers == XINT (m))
828-+ if (NILP (k)
829-+ || (NUMBERP (k) && code == XINT (k)))
830-+ return TRUE;
831-+ }
832-+
833-+ return FALSE;
834-+ }
835-+
836-+ int
837-+ mac_pass_key_directly_to_emacs ()
838-+ {
839-+
840-+ if (NILP (Fmac_input_source_is_ascii_capable()))
841-+ {
842-+ if (NILP (Vmac_use_input_method_on_system)
843-+ || this_command_key_count
844-+ || cursor_in_echo_area
845-+ || !NILP (current_buffer->read_only))
846-+ return TRUE;
847-+ }
848-+
849-+ return FALSE;
850-+ }
851-+
852-+
853-+ void mac_init_input_method ()
854-+ {
855-+ Qmac_keys_passed_to_system = intern ("mac-keys-passed-to-system");
856-+ staticpro (&Qmac_keys_passed_to_system);
857-+
858-+ DEFVAR_LISP ("mac-use-input-method-on-system", &Vmac_use_input_method_on_system,
859-+ doc: /* If it is non-nil, use input method on system. */);
860-+ Vmac_use_input_method_on_system = Qt;
861-+
862-+ defsubr (&Smac_input_source_is_ascii_capable);
863-+ defsubr (&Smac_get_input_source_list);
864-+ defsubr (&Smac_get_current_input_source);
865-+ defsubr (&Smac_toggle_input_source);
866-+ }
867-+ #endif
868-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/nsfns.m src/nsfns.m
869-*** ../emacs-23.3-0-lion/src/nsfns.m 2011-12-05 16:49:13.000000000 +0900
870---- src/nsfns.m 2012-01-13 08:53:57.000000000 +0900
871-*************** Lisp_Object Fx_open_connection (Lisp_Obj
872-*** 103,108 ****
873---- 103,113 ----
874-
875- extern BOOL ns_in_resize;
876-
877-+ /* key masks */
878-+ static Lisp_Object Vns_shift_key_mask;
879-+ static Lisp_Object Vns_control_key_mask;
880-+ static Lisp_Object Vns_alternate_key_mask;
881-+ static Lisp_Object Vns_command_key_mask;
882-
883- /* ==========================================================================
884-
885-*************** be used as the image of the icon represe
886-*** 2632,2637 ****
887---- 2637,2660 ----
888- doc: /* Toolkit version for NS Windowing. */);
889- Vns_version_string = ns_appkit_version_str ();
890-
891-+
892-+ DEFVAR_LISP ("ns-shift-key-mask", &Vns_shift_key_mask,
893-+ doc: /* Shift key mask defined in system. */);
894-+ Vns_shift_key_mask = make_number (NSShiftKeyMask);
895-+
896-+ DEFVAR_LISP ("ns-control-key-mask", &Vns_control_key_mask,
897-+ doc: /* Control key mask defined in system. */);
898-+ Vns_control_key_mask = make_number (NSControlKeyMask);
899-+
900-+ DEFVAR_LISP ("ns-alternate-key-mask", &Vns_alternate_key_mask,
901-+ doc: /* Alternate key mask defined in system. */);
902-+ Vns_alternate_key_mask = make_number (NSAlternateKeyMask);
903-+
904-+ DEFVAR_LISP ("ns-command-key-mask", &Vns_command_key_mask,
905-+ doc: /* Command key mask defined in system. */);
906-+ Vns_command_key_mask = make_number (NSCommandKeyMask);
907-+
908-+
909- defsubr (&Sns_read_file_name);
910- defsubr (&Sns_get_resource);
911- defsubr (&Sns_set_resource);
912-*************** be used as the image of the icon represe
913-*** 2676,2681 ****
914---- 2699,2708 ----
915- defsubr (&Sx_show_tip);
916- defsubr (&Sx_hide_tip);
917-
918-+ #ifdef NS_IMPL_COCOA
919-+ mac_init_input_method ();
920-+ #endif
921-+
922- /* used only in fontset.c */
923- check_window_system_func = check_ns;
924-
925-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/nsterm.h src/nsterm.h
926-*** ../emacs-23.3-0-lion/src/nsterm.h 2011-12-05 16:49:13.000000000 +0900
927---- src/nsterm.h 2012-01-13 08:53:57.000000000 +0900
928-*************** typedef unsigned int NSUInteger;
929-*** 365,370 ****
930---- 365,372 ----
931- #define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12)
932- #define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13)
933- #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14)
934-+ #define KEY_MAC_CHANGE_INPUT_METHOD ((1<<28)|(0<<16)|15)
935-+ #define KEY_NS_PUT_MARKED_TEXT ((1<<28)|(0<<16)|16)
936-
937- /* could use list to store these, but rest of emacs has a big infrastructure
938- for managing a table of bitmap "records" */
939-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/nsterm.m src/nsterm.m
940-*** ../emacs-23.3-0-lion/src/nsterm.m 2011-12-05 16:50:06.000000000 +0900
941---- src/nsterm.m 2012-01-13 08:53:57.000000000 +0900
942-*************** ns_term_init (Lisp_Object display_name)
943-*** 3730,3735 ****
944---- 3730,3738 ----
945- /* [[NSNotificationCenter defaultCenter] addObserver: NSApp
946- selector: @selector (logNotification:)
947- name: nil object: nil]; */
948-+ [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp
949-+ selector: @selector (changeInputMethod:)
950-+ name: @"AppleSelectedInputSourcesChangedNotification" object: nil];
951-
952- dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
953- bzero (dpyinfo, sizeof (struct ns_display_info));
954-*************** ns_term_shutdown (int sig)
955-*** 3935,3940 ****
956---- 3938,3955 ----
957- NSLog (@"notification: '%@'", [notification name]);
958- }
959-
960-+ - (void)changeInputMethod: (NSNotification *)notification
961-+ {
962-+
963-+ struct frame *emacsframe = SELECTED_FRAME ();
964-+
965-+ if (mac_store_change_input_method_event())
966-+ {
967-+ emacs_event->kind = NS_NONKEY_EVENT;
968-+ emacs_event->code = KEY_MAC_CHANGE_INPUT_METHOD;
969-+ EV_TRAILER ((id)nil);
970-+ }
971-+ }
972-
973- - (void)sendEvent: (NSEvent *)theEvent
974- /* --------------------------------------------------------------------------
975-*************** ns_term_shutdown (int sig)
976-*** 4488,4510 ****
977- code, fnKeysym, flags, emacs_event->modifiers);
978-
979- /* if it was a function key or had modifiers, pass it directly to emacs */
980-! if (fnKeysym || (emacs_event->modifiers
981-! && [[theEvent charactersIgnoringModifiers] length] > 0))
982-! /*[[theEvent characters] length] */
983-! {
984-! emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
985-! if (code < 0x20)
986-! code |= (1<<28)|(3<<16);
987-! else if (code == 0x7f)
988-! code |= (1<<28)|(3<<16);
989-! else if (!fnKeysym)
990-! emacs_event->kind = code > 0xFF
991-! ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
992-
993-! emacs_event->code = code;
994-! EV_TRAILER (theEvent);
995-! return;
996-! }
997- }
998-
999- /* if we get here we should send the key for input manager processing */
1000---- 4503,4540 ----
1001- code, fnKeysym, flags, emacs_event->modifiers);
1002-
1003- /* if it was a function key or had modifiers, pass it directly to emacs */
1004-! /* The function mac_pass_key_directly_to_emacs check special case
1005-! to pass it directly to emacs, such as passwd, read-only buffer, etc. */
1006-
1007-! if (mac_pass_key_directly_to_emacs ()
1008-! || fnKeysym
1009-! || (emacs_event->modifiers
1010-! && [[theEvent charactersIgnoringModifiers] length] > 0))
1011-! {
1012-! emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
1013-! if (code < 0x20)
1014-! code |= (1<<28)|(3<<16);
1015-! else if (code == 0x7f)
1016-! code |= (1<<28)|(3<<16);
1017-! else if (!fnKeysym)
1018-! emacs_event->kind = code > 0xFF
1019-! ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
1020-!
1021-! emacs_event->code = code;
1022-!
1023-! /* The function mac_pass_key_to_system decides whether it is
1024-! passed directly to emacs or not. */
1025-! if (emacs_event->kind == NON_ASCII_KEYSTROKE_EVENT
1026-! || !mac_pass_key_to_system (code, flags
1027-! & (NSShiftKeyMask
1028-! | NSControlKeyMask
1029-! | NSAlternateKeyMask
1030-! | NSCommandKeyMask)))
1031-! {
1032-! EV_TRAILER (theEvent);
1033-! return;
1034-! }
1035-! }
1036- }
1037-
1038- /* if we get here we should send the key for input manager processing */
1039-*************** ns_term_shutdown (int sig)
1040-*** 4594,4603 ****
1041- NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length],
1042- selRange.length, selRange.location);
1043-
1044-- if (workingText != nil)
1045-- [self deleteWorkingText];
1046- if ([str length] == 0)
1047-! return;
1048-
1049- if (!emacs_event)
1050- return;
1051---- 4624,4642 ----
1052- NSLog (@"setMarkedText '%@' len =%d range %d from %d", str, [str length],
1053- selRange.length, selRange.location);
1054-
1055- if ([str length] == 0)
1056-! {
1057-! [self deleteWorkingText];
1058-! return;
1059-! }
1060-! else
1061-! {
1062-! if (workingText != nil) {
1063-! [workingText release];
1064-! workingText = nil;
1065-! processingCompose = NO;
1066-! }
1067-! }
1068-
1069- if (!emacs_event)
1070- return;
1071-*************** ns_term_shutdown (int sig)
1072-*** 4607,4613 ****
1073- ns_working_text = build_string ([workingText UTF8String]);
1074-
1075- emacs_event->kind = NS_TEXT_EVENT;
1076-! emacs_event->code = KEY_NS_PUT_WORKING_TEXT;
1077- EV_TRAILER ((id)nil);
1078- }
1079-
1080---- 4646,4654 ----
1081- ns_working_text = build_string ([workingText UTF8String]);
1082-
1083- emacs_event->kind = NS_TEXT_EVENT;
1084-! emacs_event->code = KEY_NS_PUT_MARKED_TEXT;
1085-! emacs_event->arg = Fcons (make_number (selRange.location),
1086-! Fcons (make_number (selRange.length), Qnil));
1087- EV_TRAILER ((id)nil);
1088- }
1089-
1090-*************** ns_term_shutdown (int sig)
1091-*** 4662,4676 ****
1092- {
1093- NSRect rect;
1094- NSPoint pt;
1095-! struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
1096- if (NS_KEYLOG)
1097- NSLog (@"firstRectForCharRange request");
1098-
1099- rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
1100- rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
1101- pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
1102- pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
1103-! +FRAME_LINE_HEIGHT (emacsframe));
1104-
1105- pt = [self convertPoint: pt toView: nil];
1106- pt = [[self window] convertBaseToScreen: pt];
1107---- 4703,4725 ----
1108- {
1109- NSRect rect;
1110- NSPoint pt;
1111-! // struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
1112-! struct window *win;
1113- if (NS_KEYLOG)
1114- NSLog (@"firstRectForCharRange request");
1115-+
1116-+ if (NILP (Feval (Fcons (intern ("ns-in-echo-area"), Qnil))))
1117-+ win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
1118-+ else if (WINDOWP (echo_area_window))
1119-+ win = XWINDOW (echo_area_window);
1120-+ else
1121-+ win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe));
1122-
1123- rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe);
1124- rect.size.height = FRAME_LINE_HEIGHT (emacsframe);
1125- pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x);
1126- pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y
1127-! +FRAME_LINE_HEIGHT (emacsframe)+2);
1128-
1129- pt = [self convertPoint: pt toView: nil];
1130- pt = [[self window] convertBaseToScreen: pt];
1131-diff -r -p -N -x '*.o' ../emacs-23.3-0-lion/src/s/darwin.h src/s/darwin.h
1132-*** ../emacs-23.3-0-lion/src/s/darwin.h 2011-12-05 16:49:29.000000000 +0900
1133---- src/s/darwin.h 2012-01-13 08:53:57.000000000 +0900
1134-*************** along with GNU Emacs. If not, see <http
1135-*** 163,169 ****
1136- /* Definitions for how to compile & link. */
1137-
1138- #ifdef HAVE_NS
1139-! #define LIBS_NSGUI -framework AppKit
1140- #define SYSTEM_PURESIZE_EXTRA 200000
1141- #define HEADERPAD_EXTRA 6C8
1142- #else /* !HAVE_NS */
1143---- 163,169 ----
1144- /* Definitions for how to compile & link. */
1145-
1146- #ifdef HAVE_NS
1147-! #define LIBS_NSGUI -framework AppKit -framework Carbon
1148- #define SYSTEM_PURESIZE_EXTRA 200000
1149- #define HEADERPAD_EXTRA 6C8
1150- #else /* !HAVE_NS */
1185+ ;;; ns-win.el ends here
1186+
--- inline_patch/trunk/ChangeLog (revision 581)
+++ inline_patch/trunk/ChangeLog (revision 582)
@@ -1,3 +1,12 @@
1+2012-05-03 HASHIMOTO Taiichi <taiichi2@mac.com>
2+
3+ * lisp/term/
4+
5+2012-05-01 HASHIMOTO Taiichi <taiichi2@mac.com>
6+
7+ * ver.24 へ
8+ * xcode4.patch, font.patch, lion.patch 削除
9+
110 2011-12-04 HASHIMOTO Taiichi <taiichi2@mac.com>
211
312 * src/macim.m: 三代川さんのパッチを取り込み.localeの取得方法の変更.
--- inline_patch/trunk/README (revision 581)
+++ inline_patch/trunk/README (revision 582)
@@ -1,15 +1,33 @@
11 * Files
22
3-** emacs-inline.patch: patch for input method
4-** font.patch: patch to fix trembling font when user inputs japanese by input method
5-** xcode4.patch: patch to compile by xcode4 (gcc-4.2 64bit)
6-** lion.patch: patch to compile on MacOSX 10.7. It contains xcode4.patch.
3+** emacs-inline.patch: patch for input method on MacOSXn
74
8-* Usage
95
10-[MaxOSX 10.7 (Lion)]
11-% cd emacs-23.3
12-% patch -p0 < lion.patch
6+* Build
7+
8+% cd emacs-24.0.97
139 % patch -p0 < emacs-inline.patch
14-% patch -p0 < font.patch
1510
11+
12+* Usage
13+** setup in .emacs.d/init.el
14+(mac-input-method-mode t)
15+
16+** change each cursor face and title of input method or input method mode
17+*** set each cursor face and title of input method or input method mode
18+(mac-set-input-method-parameter input-source-name type value)
19+
20+;; change cursor color
21+(mac-set-input-method-parameter "com.google.inputmethod.Japanese.base" 'cursor-color 'red)
22+
23+;; change cursor type
24+(mac-set-input-method-parameter "com.google.inputmethod.Japanese.base" 'cursor-type 'box)
25+
26+;; change title
27+(mac-set-input-method-parameter "com.google.inputmethod.Japanese.base" 'title "J")
28+
29+*** know current input source name
30+(mac-get-current-input-source)
31+
32+*** know current face setting of input source
33+(mac-get-input-method-parameter input-source-name key)
Show on old repository browser