1 | diff -Nrc ../emacs-25.1.orig/configure.ac ./configure.ac |
---|
2 | *** ../emacs-25.1.orig/configure.ac 2016-07-25 01:08:36.000000000 -0600 |
---|
3 | --- ./configure.ac 2016-10-17 10:07:32.000000000 -0600 |
---|
4 | *************** |
---|
5 | *** 1916,1922 **** |
---|
6 | INSTALL_ARCH_INDEP_EXTRA= |
---|
7 | fi |
---|
8 | |
---|
9 | ! NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o $ns_fontfile" |
---|
10 | fi |
---|
11 | CFLAGS="$tmp_CFLAGS" |
---|
12 | CPPFLAGS="$tmp_CPPFLAGS" |
---|
13 | --- 1916,1922 ---- |
---|
14 | INSTALL_ARCH_INDEP_EXTRA= |
---|
15 | fi |
---|
16 | |
---|
17 | ! NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o macim.o $ns_fontfile" |
---|
18 | fi |
---|
19 | CFLAGS="$tmp_CFLAGS" |
---|
20 | CPPFLAGS="$tmp_CPPFLAGS" |
---|
21 | *************** |
---|
22 | *** 5123,5129 **** |
---|
23 | ## only costs about 1.5K of wasted binary space. |
---|
24 | headerpad_extra=1000 |
---|
25 | if test "$HAVE_NS" = "yes"; then |
---|
26 | ! libs_nsgui="-framework AppKit" |
---|
27 | if test "$NS_IMPL_COCOA" = "yes"; then |
---|
28 | libs_nsgui="$libs_nsgui -framework IOKit" |
---|
29 | fi |
---|
30 | --- 5123,5129 ---- |
---|
31 | ## only costs about 1.5K of wasted binary space. |
---|
32 | headerpad_extra=1000 |
---|
33 | if test "$HAVE_NS" = "yes"; then |
---|
34 | ! libs_nsgui="-framework AppKit -framework Carbon -framework Cocoa" |
---|
35 | if test "$NS_IMPL_COCOA" = "yes"; then |
---|
36 | libs_nsgui="$libs_nsgui -framework IOKit" |
---|
37 | fi |
---|
38 | diff -Nrc ../emacs-25.1.orig/lisp/term/common-win.el ./lisp/term/common-win.el |
---|
39 | *** ../emacs-25.1.orig/lisp/term/common-win.el 2016-06-29 03:49:20.000000000 -0600 |
---|
40 | --- ./lisp/term/common-win.el 2016-10-17 09:56:06.000000000 -0600 |
---|
41 | *************** |
---|
42 | *** 73,78 **** |
---|
43 | --- 73,79 ---- |
---|
44 | (cons (logior (lsh 0 16) 12) 'ns-new-frame) |
---|
45 | (cons (logior (lsh 0 16) 13) 'ns-toggle-toolbar) |
---|
46 | (cons (logior (lsh 0 16) 14) 'ns-show-prefs) |
---|
47 | + (cons (logior (lsh 0 16) 15) 'mac-change-input-method) |
---|
48 | )))) |
---|
49 | (set-terminal-parameter frame 'x-setup-function-keys t))) |
---|
50 | |
---|
51 | diff -Nrc ../emacs-25.1.orig/lisp/term/ns-win.el ./lisp/term/ns-win.el |
---|
52 | *** ../emacs-25.1.orig/lisp/term/ns-win.el 2016-06-29 03:49:20.000000000 -0600 |
---|
53 | --- ./lisp/term/ns-win.el 2016-10-17 09:56:06.000000000 -0600 |
---|
54 | *************** |
---|
55 | *** 169,174 **** |
---|
56 | --- 169,175 ---- |
---|
57 | (define-key global-map [ns-new-frame] 'make-frame) |
---|
58 | (define-key global-map [ns-toggle-toolbar] 'ns-toggle-toolbar) |
---|
59 | (define-key global-map [ns-show-prefs] 'customize) |
---|
60 | + (define-key global-map [mac-change-input-method] 'mac-change-input-method) |
---|
61 | |
---|
62 | |
---|
63 | ;; Set up a number of aliases and other layers to pretend we're using |
---|
64 | *************** |
---|
65 | *** 254,267 **** |
---|
66 | ;; editing window.) |
---|
67 | |
---|
68 | (defface ns-working-text-face |
---|
69 | ! '((t :underline t)) |
---|
70 | "Face used to highlight working text during compose sequence insert." |
---|
71 | :group 'ns) |
---|
72 | |
---|
73 | (defvar ns-working-overlay nil |
---|
74 | "Overlay used to highlight working text during compose sequence insert. |
---|
75 | When text is in th echo area, this just stores the length of the working text.") |
---|
76 | |
---|
77 | (defvar ns-working-text) ; nsterm.m |
---|
78 | |
---|
79 | ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2. |
---|
80 | --- 255,284 ---- |
---|
81 | ;; editing window.) |
---|
82 | |
---|
83 | (defface ns-working-text-face |
---|
84 | ! '((((background dark)) :underline "gray80") |
---|
85 | ! (t :underline "gray20")) |
---|
86 | "Face used to highlight working text during compose sequence insert." |
---|
87 | :group 'ns) |
---|
88 | |
---|
89 | + (defface ns-marked-text-face |
---|
90 | + '((((background dark)) :underline "gray80") |
---|
91 | + (t :underline "gray20")) |
---|
92 | + "Face used to highlight marked text during compose sequence insert." |
---|
93 | + :group 'ns) |
---|
94 | + |
---|
95 | + (defface ns-unmarked-text-face |
---|
96 | + '((((background dark)) :underline "gray20") |
---|
97 | + (t :underline "gray80")) |
---|
98 | + "Face used to highlight marked text during compose sequence insert." |
---|
99 | + :group 'ns) |
---|
100 | + |
---|
101 | (defvar ns-working-overlay nil |
---|
102 | "Overlay used to highlight working text during compose sequence insert. |
---|
103 | When text is in th echo area, this just stores the length of the working text.") |
---|
104 | |
---|
105 | + (defvar ns-marked-overlay nil |
---|
106 | + "Overlay used to highlight marked text during compose sequence insert.") |
---|
107 | + |
---|
108 | (defvar ns-working-text) ; nsterm.m |
---|
109 | |
---|
110 | ;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2. |
---|
111 | *************** |
---|
112 | *** 269,285 **** |
---|
113 | (defun ns-in-echo-area () |
---|
114 | "Whether, for purposes of inserting working composition text, the minibuffer |
---|
115 | is currently being used." |
---|
116 | ! (or isearch-mode |
---|
117 | ! (and cursor-in-echo-area (current-message)) |
---|
118 | ! ;; Overlay strings are not shown in some cases. |
---|
119 | ! (get-char-property (point) 'invisible) |
---|
120 | ! (and (not (bobp)) |
---|
121 | ! (or (and (get-char-property (point) 'display) |
---|
122 | ! (eq (get-char-property (1- (point)) 'display) |
---|
123 | ! (get-char-property (point) 'display))) |
---|
124 | ! (and (get-char-property (point) 'composition) |
---|
125 | ! (eq (get-char-property (1- (point)) 'composition) |
---|
126 | ! (get-char-property (point) 'composition))))))) |
---|
127 | |
---|
128 | ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area |
---|
129 | ;; always returns nil for some reason. If this WASN'T the case, we could |
---|
130 | --- 286,304 ---- |
---|
131 | (defun ns-in-echo-area () |
---|
132 | "Whether, for purposes of inserting working composition text, the minibuffer |
---|
133 | is currently being used." |
---|
134 | ! (setq mac-in-echo-area |
---|
135 | ! (or isearch-mode |
---|
136 | ! (and cursor-in-echo-area (current-message)) |
---|
137 | ! ;; Overlay strings are not shown in some cases. |
---|
138 | ! (get-char-property (point) 'invisible) |
---|
139 | ! (and (not (bobp)) |
---|
140 | ! (or (and (get-char-property (point) 'display) |
---|
141 | ! (eq (get-char-property (1- (point)) 'display) |
---|
142 | ! (get-char-property (point) 'display))) |
---|
143 | ! (and (get-char-property (point) 'composition) |
---|
144 | ! (eq (get-char-property (1- (point)) 'composition) |
---|
145 | ! (get-char-property (point) 'composition))))))) |
---|
146 | ! mac-in-echo-area) |
---|
147 | |
---|
148 | ;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area |
---|
149 | ;; always returns nil for some reason. If this WASN'T the case, we could |
---|
150 | *************** |
---|
151 | *** 288,293 **** |
---|
152 | --- 307,313 ---- |
---|
153 | (defun ns-put-working-text () |
---|
154 | (interactive) |
---|
155 | (if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text))) |
---|
156 | + |
---|
157 | (defun ns-unput-working-text () |
---|
158 | (interactive) |
---|
159 | (ns-delete-working-text)) |
---|
160 | *************** |
---|
161 | *** 309,327 **** |
---|
162 | (defun ns-echo-working-text () |
---|
163 | "Echo contents of `ns-working-text' in message display area. |
---|
164 | See `ns-insert-working-text'." |
---|
165 | - (ns-delete-working-text) |
---|
166 | (let* ((msg (current-message)) |
---|
167 | ! (msglen (length msg)) |
---|
168 | ! message-log-max) |
---|
169 | (setq ns-working-overlay (length ns-working-text)) |
---|
170 | (setq msg (concat msg ns-working-text)) |
---|
171 | (put-text-property msglen (+ msglen ns-working-overlay) |
---|
172 | ! 'face 'ns-working-text-face msg) |
---|
173 | (message "%s" msg))) |
---|
174 | |
---|
175 | (defun ns-delete-working-text() |
---|
176 | ! "Delete working text and clear `ns-working-overlay'." |
---|
177 | (interactive) |
---|
178 | (cond |
---|
179 | ((and (overlayp ns-working-overlay) |
---|
180 | ;; Still alive? |
---|
181 | --- 329,409 ---- |
---|
182 | (defun ns-echo-working-text () |
---|
183 | "Echo contents of `ns-working-text' in message display area. |
---|
184 | See `ns-insert-working-text'." |
---|
185 | (let* ((msg (current-message)) |
---|
186 | ! (msglen (length msg)) |
---|
187 | ! message-log-max) |
---|
188 | ! (if (integerp ns-working-overlay) |
---|
189 | ! (progn |
---|
190 | ! (setq msg (substring msg 0 (- (length msg) ns-working-overlay))) |
---|
191 | ! (setq msglen (length msg)))) |
---|
192 | (setq ns-working-overlay (length ns-working-text)) |
---|
193 | (setq msg (concat msg ns-working-text)) |
---|
194 | (put-text-property msglen (+ msglen ns-working-overlay) |
---|
195 | ! 'face 'ns-working-text-face msg) |
---|
196 | ! (message "%s" msg))) |
---|
197 | ! |
---|
198 | ! (defun ns-put-marked-text (event) |
---|
199 | ! (interactive "e") |
---|
200 | ! |
---|
201 | ! (let ((pos (nth 1 event)) |
---|
202 | ! (len (nth 2 event))) |
---|
203 | ! (if (ns-in-echo-area) |
---|
204 | ! (ns-echo-marked-text pos len) |
---|
205 | ! (ns-insert-marked-text pos len)))) |
---|
206 | ! |
---|
207 | ! (defun ns-insert-marked-text (pos len) |
---|
208 | ! "Insert contents of `ns-working-text' as UTF-8 string and mark with |
---|
209 | ! `ns-working-overlay' and `ns-marked-overlay'. Any previously existing |
---|
210 | ! working text is cleared first. The overlay is assigned the faces |
---|
211 | ! `ns-working-text-face' and `ns-marked-text-face'." |
---|
212 | ! (ns-delete-working-text) |
---|
213 | ! (let ((start (point))) |
---|
214 | ! (if (<= pos (length ns-working-text)) |
---|
215 | ! (progn |
---|
216 | ! (put-text-property pos len 'face 'ns-working-text-face ns-working-text) |
---|
217 | ! (insert ns-working-text) |
---|
218 | ! (if (= len 0) |
---|
219 | ! (overlay-put (setq ns-working-overlay |
---|
220 | ! (make-overlay start (point) (current-buffer) nil t)) |
---|
221 | ! 'face 'ns-working-text-face) |
---|
222 | ! (overlay-put (setq ns-working-overlay |
---|
223 | ! (make-overlay start (point) (current-buffer) nil t)) |
---|
224 | ! 'face 'ns-unmarked-text-face) |
---|
225 | ! (overlay-put (setq ns-marked-overlay |
---|
226 | ! (make-overlay (+ start pos) (+ start pos len) |
---|
227 | ! (current-buffer) nil t)) |
---|
228 | ! 'face 'ns-marked-text-face)) |
---|
229 | ! (goto-char (+ start pos)))))) |
---|
230 | ! |
---|
231 | ! (defun ns-echo-marked-text (pos len) |
---|
232 | ! "Echo contents of `ns-working-text' in message display area. |
---|
233 | ! See `ns-insert-working-text'." |
---|
234 | ! (let* ((msg (current-message)) |
---|
235 | ! (msglen (length msg)) |
---|
236 | ! message-log-max) |
---|
237 | ! (when (integerp ns-working-overlay) |
---|
238 | ! (setq msg (substring msg 0 (- (length msg) ns-working-overlay))) |
---|
239 | ! (setq msglen (length msg))) |
---|
240 | ! (setq ns-working-overlay (length ns-working-text)) |
---|
241 | ! (setq msg (concat msg ns-working-text)) |
---|
242 | ! (if (= len 0) |
---|
243 | ! (put-text-property msglen (+ msglen ns-working-overlay) |
---|
244 | ! 'face 'ns-working-text-face msg) |
---|
245 | ! (put-text-property msglen (+ msglen ns-working-overlay) |
---|
246 | ! 'face 'ns-unmarked-text-face msg) |
---|
247 | ! (put-text-property (+ msglen pos) (+ msglen pos len) |
---|
248 | ! 'face 'ns-marked-text-face msg)) |
---|
249 | (message "%s" msg))) |
---|
250 | |
---|
251 | (defun ns-delete-working-text() |
---|
252 | ! "Delete working text and clear `ns-working-overlay' and `ns-marked-overlay'." |
---|
253 | (interactive) |
---|
254 | + (when (and (overlayp ns-marked-overlay) |
---|
255 | + ;; Still alive |
---|
256 | + (overlay-buffer ns-marked-overlay)) |
---|
257 | + (with-current-buffer (overlay-buffer ns-marked-overlay) |
---|
258 | + (delete-overlay ns-marked-overlay))) |
---|
259 | + (setq ns-marked-overlay nil) |
---|
260 | (cond |
---|
261 | ((and (overlayp ns-working-overlay) |
---|
262 | ;; Still alive? |
---|
263 | *************** |
---|
264 | *** 935,940 **** |
---|
265 | --- 1017,1482 ---- |
---|
266 | &context (window-system ns)) |
---|
267 | (ns-get-selection selection-symbol target-type)) |
---|
268 | |
---|
269 | + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
---|
270 | + ;; |
---|
271 | + ;; Implementation of Input Method Extension for MacOS X |
---|
272 | + ;; written by Taiichi Hashimoto <taiichi2@mac.com> |
---|
273 | + ;; |
---|
274 | + |
---|
275 | + (defvar mac-input-method-parameters |
---|
276 | + '( |
---|
277 | + ("com.apple.inputmethod.Kotoeri.Roman" |
---|
278 | + (title . "A") |
---|
279 | + (cursor-color) |
---|
280 | + (cursor-type)) |
---|
281 | + ("com.apple.inputmethod.Kotoeri.Japanese" |
---|
282 | + (title . "あ") |
---|
283 | + (cursor-color) |
---|
284 | + (cursor-type)) |
---|
285 | + ("com.apple.inputmethod.Kotoeri.Japanese.Katakana" |
---|
286 | + (title . "ア") |
---|
287 | + (cursor-color) |
---|
288 | + (cursor-type)) |
---|
289 | + ("com.apple.inputmethod.Kotoeri.Japanese.FullWidthRoman" |
---|
290 | + (title . "A") |
---|
291 | + (cursor-color) |
---|
292 | + (cursor-type)) |
---|
293 | + ("com.apple.inputmethod.Kotoeri.Japanese.HalfWidthKana" |
---|
294 | + (title . "ア") |
---|
295 | + (cursor-color) |
---|
296 | + (cursor-type)) |
---|
297 | + ("com.apple.inputmethod.kotoeri.Ainu" |
---|
298 | + (title . "アイヌ") |
---|
299 | + (cursor-color) |
---|
300 | + (cursor-type)) |
---|
301 | + ("com.apple.inputmethod.Korean.2SetKorean" |
---|
302 | + (title . "가2") |
---|
303 | + (cursor-color) |
---|
304 | + (cursor-type)) |
---|
305 | + ("com.apple.inputmethod.Korean.3SetKorean" |
---|
306 | + (title . "가3") |
---|
307 | + (cursor-color) |
---|
308 | + (cursor-type)) |
---|
309 | + ("com.apple.inputmethod.Korean.390Sebulshik" |
---|
310 | + (title . "가5") |
---|
311 | + (cursor-color) |
---|
312 | + (cursor-type)) |
---|
313 | + ("com.apple.inputmethod.Korean.GongjinCheongRomaja" |
---|
314 | + (title . "가G") |
---|
315 | + (cursor-color) |
---|
316 | + (cursor-type)) |
---|
317 | + ("com.apple.inputmethod.Korean.HNCRomaja" |
---|
318 | + (title . "가H") |
---|
319 | + (cursor-color) |
---|
320 | + (cursor-type)) |
---|
321 | + ("com.apple.inputmethod.Tamil.AnjalIM" |
---|
322 | + (title . "Anjal") |
---|
323 | + (cursor-color) |
---|
324 | + (cursor-type)) |
---|
325 | + ("com.apple.inputmethod.Tamil.Tamil99" |
---|
326 | + (title . "Tamil") |
---|
327 | + (cursor-color) |
---|
328 | + (cursor-type)) |
---|
329 | + ("com.apple.inputmethod.VietnameseIM.VietnameseSimpleTelex" |
---|
330 | + (title . "ST") |
---|
331 | + (cursor-color) |
---|
332 | + (cursor-type)) |
---|
333 | + ("com.apple.inputmethod.VietnameseIM.VietnameseTelex" |
---|
334 | + (title . "TX") |
---|
335 | + (cursor-color) |
---|
336 | + (cursor-type)) |
---|
337 | + ("com.apple.inputmethod.VietnameseIM.VietnameseVNI" |
---|
338 | + (title . "VN") |
---|
339 | + (cursor-color) |
---|
340 | + (cursor-type)) |
---|
341 | + ("com.apple.inputmethod.VietnameseIM.VietnameseVIQR" |
---|
342 | + (title . "VQ") |
---|
343 | + (cursor-color) |
---|
344 | + (cursor-type)) |
---|
345 | + ("com.apple.inputmethod.SCIM.ITABC" |
---|
346 | + (title . "拼") |
---|
347 | + (cursor-color) |
---|
348 | + (cursor-type)) |
---|
349 | + ("com.apple.inputmethod.SCIM.WBX" |
---|
350 | + (title . "型") |
---|
351 | + (cursor-color) |
---|
352 | + (cursor-type)) |
---|
353 | + ("com.apple.inputmethod.SCIM.WBH" |
---|
354 | + (title . "画") |
---|
355 | + (cursor-color) |
---|
356 | + (cursor-type)) |
---|
357 | + ("com.apple.inputmethod.TCIM.Zhuyin" |
---|
358 | + (title . "注") |
---|
359 | + (cursor-color) |
---|
360 | + (cursor-type)) |
---|
361 | + ("com.apple.inputmethod.TCIM.Pinyin" |
---|
362 | + (title . "拼") |
---|
363 | + (cursor-color) |
---|
364 | + (cursor-type)) |
---|
365 | + ("com.apple.inputmethod.TCIM.Cangjie" |
---|
366 | + (title . "倉") |
---|
367 | + (cursor-color) |
---|
368 | + (cursor-type)) |
---|
369 | + ("com.apple.inputmethod.TCIM.Jianyi" |
---|
370 | + (title . "速") |
---|
371 | + (cursor-color) |
---|
372 | + (cursor-type)) |
---|
373 | + ("com.apple.inputmethod.TCIM.Dayi" |
---|
374 | + (title . "易") |
---|
375 | + (cursor-color) |
---|
376 | + (cursor-type)) |
---|
377 | + ("com.apple.inputmethod.TCIM.Hanin" |
---|
378 | + (title . "漢") |
---|
379 | + (cursor-color) |
---|
380 | + (cursor-type)) |
---|
381 | + ("com.google.inputmethod.Japanese.Roman" |
---|
382 | + (title . "G") |
---|
383 | + (cursor-color) |
---|
384 | + (cursor-type)) |
---|
385 | + ("com.google.inputmethod.Japanese.base" |
---|
386 | + (title . "ぐ") |
---|
387 | + (cursor-color) |
---|
388 | + (cursor-type)) |
---|
389 | + ("com.google.inputmethod.Japanese.Katakana" |
---|
390 | + (title . "グ") |
---|
391 | + (cursor-color) |
---|
392 | + (cursor-type)) |
---|
393 | + ("com.google.inputmethod.Japanese.FullWidthRoman" |
---|
394 | + (title . "G") |
---|
395 | + (cursor-color) |
---|
396 | + (cursor-type)) |
---|
397 | + ("com.google.inputmethod.Japanese.HalfWidthKana" |
---|
398 | + (title . "グ") |
---|
399 | + (cursor-color) |
---|
400 | + (cursor-type)) |
---|
401 | + ("jp.monokakido.inputmethod.Kawasemi.Roman" |
---|
402 | + (title . "K") |
---|
403 | + (cursor-color) |
---|
404 | + (cursor-type)) |
---|
405 | + ("jp.monokakido.inputmethod.Kawasemi.Japanese" |
---|
406 | + (title . "か") |
---|
407 | + (cursor-color) |
---|
408 | + (cursor-type)) |
---|
409 | + ("jp.monokakido.inputmethod.Kawasemi.Japanese.Katakana" |
---|
410 | + (title . "カ") |
---|
411 | + (cursor-color) |
---|
412 | + (cursor-type)) |
---|
413 | + ("jp.monokakido.inputmethod.Kawasemi.Japanese.FullWidthRoman" |
---|
414 | + (title . "K") |
---|
415 | + (cursor-color) |
---|
416 | + (cursor-type)) |
---|
417 | + ("jp.monokakido.inputmethod.Kawasemi.Japanese.HalfWidthKana" |
---|
418 | + (title . "カ") |
---|
419 | + (cursor-color) |
---|
420 | + (cursor-type)) |
---|
421 | + ("jp.monokakido.inputmethod.Kawasemi.Japanese.HalfWidthRoman" |
---|
422 | + (title . "_K") |
---|
423 | + (cursor-color) |
---|
424 | + (cursor-type)) |
---|
425 | + ("jp.monokakido.inputmethod.Kawasemi.Japanese.Code" |
---|
426 | + (title . "C") |
---|
427 | + (cursor-color) |
---|
428 | + (cursor-type)) |
---|
429 | + ("com.justsystems.inputmethod.atok21.Roman" |
---|
430 | + (title . "A") |
---|
431 | + (cursor-color) |
---|
432 | + (cursor-type)) |
---|
433 | + ("com.justsystems.inputmethod.atok21.Japanese" |
---|
434 | + (title . "あ") |
---|
435 | + (cursor-color) |
---|
436 | + (cursor-type)) |
---|
437 | + ("com.justsystems.inputmethod.atok21.Japanese.Katakana" |
---|
438 | + (title . "ア") |
---|
439 | + (cursor-color) |
---|
440 | + (cursor-type)) |
---|
441 | + ("com.justsystems.inputmethod.atok21.Japanese.FullWidthRoman" |
---|
442 | + (title . "英") |
---|
443 | + (cursor-color) |
---|
444 | + (cursor-type)) |
---|
445 | + ("com.justsystems.inputmethod.atok21.Japanese.HalfWidthEiji" |
---|
446 | + (title . "半英") |
---|
447 | + (cursor-color) |
---|
448 | + (cursor-type)) |
---|
449 | + ("com.justsystems.inputmethod.atok22.Roman" |
---|
450 | + (title . "A") |
---|
451 | + (cursor-color) |
---|
452 | + (cursor-type)) |
---|
453 | + ("com.justsystems.inputmethod.atok22.Japanese" |
---|
454 | + (title . "あ") |
---|
455 | + (cursor-color) |
---|
456 | + (cursor-type)) |
---|
457 | + ("com.justsystems.inputmethod.atok22.Japanese.Katakana" |
---|
458 | + (title . "ア") |
---|
459 | + (cursor-color) |
---|
460 | + (cursor-type)) |
---|
461 | + ("com.justsystems.inputmethod.atok22.Japanese.FullWidthRoman" |
---|
462 | + (title . "英") |
---|
463 | + (cursor-color) |
---|
464 | + (cursor-type)) |
---|
465 | + ("com.justsystems.inputmethod.atok22.Japanese.HalfWidthEiji" |
---|
466 | + (title . "半英") |
---|
467 | + (cursor-color) |
---|
468 | + (cursor-type)) |
---|
469 | + ("com.justsystems.inputmethod.atok23.Roman" |
---|
470 | + (title . "A") |
---|
471 | + (cursor-color) |
---|
472 | + (cursor-type)) |
---|
473 | + ("com.justsystems.inputmethod.atok23.Japanese" |
---|
474 | + (title . "あ") |
---|
475 | + (cursor-color) |
---|
476 | + (cursor-type)) |
---|
477 | + ("com.justsystems.inputmethod.atok23.Japanese.Katakana" |
---|
478 | + (title . "ア") |
---|
479 | + (cursor-color) |
---|
480 | + (cursor-type)) |
---|
481 | + ("com.justsystems.inputmethod.atok23.Japanese.FullWidthRoman" |
---|
482 | + (title . "英") |
---|
483 | + (cursor-color) |
---|
484 | + (cursor-type)) |
---|
485 | + ("com.justsystems.inputmethod.atok23.Japanese.HalfWidthEiji" |
---|
486 | + (title . "半英") |
---|
487 | + (cursor-color) |
---|
488 | + (cursor-type)) |
---|
489 | + ("com.justsystems.inputmethod.atok24.Roman" |
---|
490 | + (title . "A") |
---|
491 | + (cursor-color) |
---|
492 | + (cursor-type)) |
---|
493 | + ("com.justsystems.inputmethod.atok24.Japanese" |
---|
494 | + (title . "あ") |
---|
495 | + (cursor-color) |
---|
496 | + (cursor-type)) |
---|
497 | + ("com.justsystems.inputmethod.atok24.Japanese.Katakana" |
---|
498 | + (title . "ア") |
---|
499 | + (cursor-color) |
---|
500 | + (cursor-type)) |
---|
501 | + ("com.justsystems.inputmethod.atok24.Japanese.FullWidthRoman" |
---|
502 | + (title . "英") |
---|
503 | + (cursor-color) |
---|
504 | + (cursor-type)) |
---|
505 | + ("com.justsystems.inputmethod.atok24.Japanese.HalfWidthEiji" |
---|
506 | + (title . "半英") |
---|
507 | + (cursor-color) |
---|
508 | + (cursor-type)) |
---|
509 | + ("com.justsystems.inputmethod.atok25.Roman" |
---|
510 | + (title . "A") |
---|
511 | + (cursor-color) |
---|
512 | + (cursor-type)) |
---|
513 | + ("com.justsystems.inputmethod.atok25.Japanese" |
---|
514 | + (title . "あ") |
---|
515 | + (cursor-color) |
---|
516 | + (cursor-type)) |
---|
517 | + ("com.justsystems.inputmethod.atok25.Japanese.Katakana" |
---|
518 | + (title . "ア") |
---|
519 | + (cursor-color) |
---|
520 | + (cursor-type)) |
---|
521 | + ("com.justsystems.inputmethod.atok25.Japanese.FullWidthRoman" |
---|
522 | + (title . "英") |
---|
523 | + (cursor-color) |
---|
524 | + (cursor-type)) |
---|
525 | + ("com.justsystems.inputmethod.atok25.Japanese.HalfWidthEiji" |
---|
526 | + (title . "半英") |
---|
527 | + (cursor-color) |
---|
528 | + (cursor-type)) |
---|
529 | + ) |
---|
530 | + "Alist of Mac script code vs parameters for input method on MacOSX.") |
---|
531 | + |
---|
532 | + |
---|
533 | + (defun mac-get-input-method-parameter (is key) |
---|
534 | + "Function to get a parameter of a input method." |
---|
535 | + (interactive) |
---|
536 | + (assq key (cdr (assoc is mac-input-method-parameters)))) |
---|
537 | + |
---|
538 | + (defun mac-get-input-method-title (&optional input-source) |
---|
539 | + "Return input method title of input source. |
---|
540 | + If input-source is nil, return one of current frame." |
---|
541 | + (if input-source |
---|
542 | + (cdr (mac-get-input-method-parameter input-source 'title)) |
---|
543 | + current-input-method-title)) |
---|
544 | + |
---|
545 | + (defun mac-get-cursor-type (&optional input-source) |
---|
546 | + "Return cursor type of input source. |
---|
547 | + If input-source is nil, return one of current frame." |
---|
548 | + (if input-source |
---|
549 | + (or (cdr (mac-get-input-method-parameter input-source 'cursor-type)) |
---|
550 | + (cdr (assq 'cursor-type default-frame-alist)) |
---|
551 | + cursor-type) |
---|
552 | + (cdr (assq 'cursor-type (frame-parameters (selected-frame)))))) |
---|
553 | + |
---|
554 | + (defun mac-get-cursor-color (&optional input-source) |
---|
555 | + "Return cursor color of input source. |
---|
556 | + If input-source is nil, return one of current frame." |
---|
557 | + (if input-source |
---|
558 | + (or (cdr (mac-get-input-method-parameter input-source 'cursor-color)) |
---|
559 | + (cdr (assq 'cursor-color default-frame-alist))) |
---|
560 | + (cdr (assq 'cursor-color (frame-parameters (selected-frame)))))) |
---|
561 | + |
---|
562 | + |
---|
563 | + (defun mac-set-input-method-parameter (is key value) |
---|
564 | + "Function to set a parameter of a input method." |
---|
565 | + (let* ((is-param (assoc is mac-input-method-parameters)) |
---|
566 | + (param (assq key is-param))) |
---|
567 | + (if is-param |
---|
568 | + (if param |
---|
569 | + (setcdr param value) |
---|
570 | + (setcdr is-param (cons (cons key value) (cdr is-param)))) |
---|
571 | + (setq mac-input-method-parameters |
---|
572 | + (cons (list is (cons key value)) |
---|
573 | + mac-input-method-parameters))))) |
---|
574 | + |
---|
575 | + |
---|
576 | + (defun mac-input-method-update (is) |
---|
577 | + "Funtion to update parameters of a input method." |
---|
578 | + (interactive) |
---|
579 | + |
---|
580 | + (let ((title (mac-get-input-method-title is)) |
---|
581 | + (type (mac-get-cursor-type is)) |
---|
582 | + (color (mac-get-cursor-color is))) |
---|
583 | + (if (and title (not (equal title (mac-get-input-method-title)))) |
---|
584 | + (setq current-input-method-title title)) |
---|
585 | + (if (and type (not (equal type (mac-get-cursor-type)))) |
---|
586 | + (setq cursor-type type)) |
---|
587 | + (if (and color (not (equal color (mac-get-cursor-color)))) |
---|
588 | + (set-cursor-color color)) |
---|
589 | + (force-mode-line-update) |
---|
590 | + (if isearch-mode (isearch-update)))) |
---|
591 | + |
---|
592 | + |
---|
593 | + (defun mac-toggle-input-method (&optional arg) |
---|
594 | + "Function to toggle input method on MacOSX." |
---|
595 | + (interactive) |
---|
596 | + |
---|
597 | + (if arg |
---|
598 | + (progn |
---|
599 | + (make-local-variable 'input-method-function) |
---|
600 | + (setq inactivate-current-input-method-function 'mac-toggle-input-method) |
---|
601 | + (setq input-method-function nil) |
---|
602 | + (setq describe-current-input-method-function nil) |
---|
603 | + (mac-toggle-input-source t)) |
---|
604 | + (kill-local-variable 'input-method-function) |
---|
605 | + (setq describe-current-input-method-function nil) |
---|
606 | + (mac-toggle-input-source nil))) |
---|
607 | + |
---|
608 | + |
---|
609 | + (defun mac-change-language-to-us () |
---|
610 | + "Function to change language to us." |
---|
611 | + (interactive) |
---|
612 | + (mac-toggle-input-method nil)) |
---|
613 | + |
---|
614 | + |
---|
615 | + (defun mac-handle-input-method-change () |
---|
616 | + "Function run when a input method change." |
---|
617 | + (interactive) |
---|
618 | + |
---|
619 | + (if (equal default-input-method "MacOSX") |
---|
620 | + (let ((input-source (mac-get-current-input-source)) |
---|
621 | + (ascii-capable (mac-input-source-is-ascii-capable))) |
---|
622 | + |
---|
623 | + (cond ((and (not current-input-method) (not ascii-capable)) |
---|
624 | + (set-input-method "MacOSX")) |
---|
625 | + ((and (equal current-input-method "MacOSX") ascii-capable) |
---|
626 | + (toggle-input-method nil))) |
---|
627 | + (mac-input-method-update input-source)))) |
---|
628 | + |
---|
629 | + ;; |
---|
630 | + ;; Emacs input method for input method on MacOSX. |
---|
631 | + ;; |
---|
632 | + (register-input-method "MacOSX" "MacOSX" 'mac-toggle-input-method |
---|
633 | + "Mac" "Input Method on MacOSX System") |
---|
634 | + |
---|
635 | + |
---|
636 | + ;; |
---|
637 | + ;; Minor mode of using input methods on MacOS X |
---|
638 | + ;; |
---|
639 | + (define-minor-mode mac-input-method-mode |
---|
640 | + "Use input methods on MacOSX." |
---|
641 | + :init-value nil |
---|
642 | + :group 'ns |
---|
643 | + :global t |
---|
644 | + |
---|
645 | + (if mac-input-method-mode |
---|
646 | + (progn |
---|
647 | + (setq default-input-method "MacOSX") |
---|
648 | + (add-hook 'minibuffer-setup-hook 'mac-change-language-to-us) |
---|
649 | + (mac-translate-from-yen-to-backslash)) |
---|
650 | + (setq default-input-method nil))) |
---|
651 | + |
---|
652 | + ;; |
---|
653 | + ;; Valiable and functions to pass key(shortcut) to system. |
---|
654 | + ;; |
---|
655 | + (defvar mac-keys-passed-to-system nil |
---|
656 | + "A list of keys passed to system on MacOSX.") |
---|
657 | + |
---|
658 | + (defun mac-add-key-passed-to-system (key) |
---|
659 | + (let ((shift '(shift shft)) |
---|
660 | + (control '(control ctrl ctl)) |
---|
661 | + (option '(option opt alternate alt)) |
---|
662 | + (command '(command cmd))) |
---|
663 | + |
---|
664 | + (add-to-list 'mac-keys-passed-to-system |
---|
665 | + (cond ((symbolp key) |
---|
666 | + (cond ((memq key shift) |
---|
667 | + (cons ns-shift-key-mask nil)) |
---|
668 | + ((memq key control) |
---|
669 | + (cons ns-control-key-mask nil)) |
---|
670 | + ((memq key option) |
---|
671 | + (cons ns-alternate-key-mask nil)) |
---|
672 | + ((memq key command) |
---|
673 | + (cons ns-command-key-mask nil)) |
---|
674 | + (t (cons nil nil)))) |
---|
675 | + ((numberp key) (cons 0 key)) |
---|
676 | + ((listp key) |
---|
677 | + (let ((l key) (k nil) (m 0)) |
---|
678 | + (while l |
---|
679 | + (cond ((memq (car l) shift) |
---|
680 | + (setq m (logior m ns-shift-key-mask))) |
---|
681 | + ((memq (car l) control) |
---|
682 | + (setq m (logior m ns-control-key-mask))) |
---|
683 | + ((memq (car l) option) |
---|
684 | + (setq m (logior m ns-alternate-key-mask))) |
---|
685 | + ((memq (car l) command) |
---|
686 | + (setq m (logior m ns-command-key-mask))) |
---|
687 | + ((numberp (car l)) |
---|
688 | + (if (not k) (setq k (car l))))) |
---|
689 | + (setq l (cdr l))) |
---|
690 | + (cons m k))) |
---|
691 | + (t (cons nil nil)))))) |
---|
692 | + |
---|
693 | + |
---|
694 | + ;; |
---|
695 | + ;; Entry Emacs event for inline input method on MacOSX. |
---|
696 | + ;; |
---|
697 | + (define-key special-event-map |
---|
698 | + [mac-change-input-method] 'mac-handle-input-method-change) |
---|
699 | + |
---|
700 | + ;; |
---|
701 | + ;; Convert yen to backslash for JIS keyboard. |
---|
702 | + ;; |
---|
703 | + (defun mac-translate-from-yen-to-backslash () |
---|
704 | + ;; Convert yen to backslash for JIS keyboard. |
---|
705 | + (interactive) |
---|
706 | + |
---|
707 | + (define-key global-map [165] nil) |
---|
708 | + (define-key global-map [2213] nil) |
---|
709 | + (define-key global-map [3420] nil) |
---|
710 | + (define-key global-map [67109029] nil) |
---|
711 | + (define-key global-map [67111077] nil) |
---|
712 | + (define-key global-map [8388773] nil) |
---|
713 | + (define-key global-map [134219941] nil) |
---|
714 | + (define-key global-map [75497596] nil) |
---|
715 | + (define-key global-map [201328805] nil) |
---|
716 | + (define-key function-key-map [165] [?\\]) |
---|
717 | + (define-key function-key-map [2213] [?\\]) ;; for Intel |
---|
718 | + (define-key function-key-map [3420] [?\\]) ;; for PowerPC |
---|
719 | + (define-key function-key-map [67109029] [?\C-\\]) |
---|
720 | + (define-key function-key-map [67111077] [?\C-\\]) |
---|
721 | + (define-key function-key-map [8388773] [?\M-\\]) |
---|
722 | + (define-key function-key-map [134219941] [?\M-\\]) |
---|
723 | + (define-key function-key-map [75497596] [?\C-\M-\\]) |
---|
724 | + (define-key function-key-map [201328805] [?\C-\M-\\]) |
---|
725 | + ) |
---|
726 | + |
---|
727 | + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
---|
728 | + |
---|
729 | (provide 'ns-win) |
---|
730 | |
---|
731 | ;;; ns-win.el ends here |
---|
732 | diff -Nrc ../emacs-25.1.orig/src/Makefile.in ./src/Makefile.in |
---|
733 | *** ../emacs-25.1.orig/src/Makefile.in 2016-06-29 03:49:20.000000000 -0600 |
---|
734 | --- ./src/Makefile.in 2016-10-17 09:56:06.000000000 -0600 |
---|
735 | *************** |
---|
736 | *** 409,416 **** |
---|
737 | SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ |
---|
738 | xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ |
---|
739 | fontset.o dbusbind.o cygw32.o \ |
---|
740 | ! nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macfont.o \ |
---|
741 | ! w32.o w32console.o w32fns.o w32heap.o w32inevt.o w32notify.o \ |
---|
742 | w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ |
---|
743 | w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \ |
---|
744 | xsettings.o xgselect.o termcap.o |
---|
745 | --- 409,416 ---- |
---|
746 | SOME_MACHINE_OBJECTS = dosfns.o msdos.o \ |
---|
747 | xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ |
---|
748 | fontset.o dbusbind.o cygw32.o \ |
---|
749 | ! nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macfont.o macim.o \ |
---|
750 | ! w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ |
---|
751 | w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ |
---|
752 | w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \ |
---|
753 | xsettings.o xgselect.o termcap.o |
---|
754 | diff -Nrc ../emacs-25.1.orig/src/keyboard.c ./src/keyboard.c |
---|
755 | *** ../emacs-25.1.orig/src/keyboard.c 2016-08-02 02:06:01.000000000 -0600 |
---|
756 | --- ./src/keyboard.c 2016-10-17 09:56:06.000000000 -0600 |
---|
757 | *************** |
---|
758 | *** 3875,3882 **** |
---|
759 | { |
---|
760 | if (event->ie.code == KEY_NS_PUT_WORKING_TEXT) |
---|
761 | obj = list1 (intern ("ns-put-working-text")); |
---|
762 | ! else |
---|
763 | obj = list1 (intern ("ns-unput-working-text")); |
---|
764 | kbd_fetch_ptr = event + 1; |
---|
765 | if (used_mouse_menu) |
---|
766 | *used_mouse_menu = true; |
---|
767 | --- 3875,3884 ---- |
---|
768 | { |
---|
769 | if (event->ie.code == KEY_NS_PUT_WORKING_TEXT) |
---|
770 | obj = list1 (intern ("ns-put-working-text")); |
---|
771 | ! else if (event->ie.code == KEY_NS_UNPUT_WORKING_TEXT) |
---|
772 | obj = list1 (intern ("ns-unput-working-text")); |
---|
773 | + else if (event->ie.code == KEY_NS_PUT_MARKED_TEXT) |
---|
774 | + obj = Fcons (intern ("ns-put-marked-text"), event->ie.arg); |
---|
775 | kbd_fetch_ptr = event + 1; |
---|
776 | if (used_mouse_menu) |
---|
777 | *used_mouse_menu = true; |
---|
778 | *************** |
---|
779 | *** 11743,11748 **** |
---|
780 | --- 11745,11752 ---- |
---|
781 | "ns-put-working-text"); |
---|
782 | initial_define_lispy_key (Vspecial_event_map, "ns-unput-working-text", |
---|
783 | "ns-unput-working-text"); |
---|
784 | + initial_define_lispy_key (Vspecial_event_map, "ns-put-marked-text", |
---|
785 | + "ns-put-marked-text"); |
---|
786 | /* Here we used to use `ignore-event' which would simple set prefix-arg to |
---|
787 | current-prefix-arg, as is done in `handle-switch-frame'. |
---|
788 | But `handle-switch-frame is not run from the special-map. |
---|
789 | diff -Nrc ../emacs-25.1.orig/src/macim.m ./src/macim.m |
---|
790 | *** ../emacs-25.1.orig/src/macim.m 1969-12-31 17:00:00.000000000 -0700 |
---|
791 | --- ./src/macim.m 2016-10-17 09:56:06.000000000 -0600 |
---|
792 | *************** |
---|
793 | *** 0 **** |
---|
794 | --- 1,173 ---- |
---|
795 | + /* Implementation of Input Method Extension for MacOS X. |
---|
796 | + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 |
---|
797 | + Taiichi Hashimoto <taiichi2@mac.com>. |
---|
798 | + */ |
---|
799 | + |
---|
800 | + #include "config.h" |
---|
801 | + |
---|
802 | + #ifdef NS_IMPL_COCOA |
---|
803 | + |
---|
804 | + #include <math.h> |
---|
805 | + #include <sys/types.h> |
---|
806 | + #include <time.h> |
---|
807 | + #include <signal.h> |
---|
808 | + #include <unistd.h> |
---|
809 | + |
---|
810 | + #include <Carbon/Carbon.h> |
---|
811 | + |
---|
812 | + #include "lisp.h" |
---|
813 | + #include "blockinput.h" |
---|
814 | + |
---|
815 | + #include "termhooks.h" |
---|
816 | + #include "keyboard.h" |
---|
817 | + #include "buffer.h" |
---|
818 | + |
---|
819 | + //extern Lisp_Object Qcurrent_input_method; |
---|
820 | + //extern int cursor_in_echo_area; |
---|
821 | + static Lisp_Object Qmac_keys_passed_to_system; |
---|
822 | + |
---|
823 | + void mac_init_input_method (); |
---|
824 | + int mac_pass_key_to_system (int code, int modifiers); |
---|
825 | + int mac_pass_key_directly_to_emacs (); |
---|
826 | + int mac_store_change_input_method_event (); |
---|
827 | + |
---|
828 | + DEFUN ("mac-input-source-is-ascii-capable", Fmac_input_source_is_ascii_capable, Smac_input_source_is_ascii_capable, |
---|
829 | + 0, 0, 0, |
---|
830 | + doc: /* Is current input source ascii capable? */) |
---|
831 | + (void) |
---|
832 | + { |
---|
833 | + TISInputSourceRef is = TISCopyCurrentKeyboardInputSource(); |
---|
834 | + CFBooleanRef ret = TISGetInputSourceProperty(is, kTISPropertyInputSourceIsASCIICapable); |
---|
835 | + |
---|
836 | + return CFBooleanGetValue(ret)? Qt : Qnil; |
---|
837 | + } |
---|
838 | + |
---|
839 | + DEFUN ("mac-get-input-source-list", Fmac_get_input_source_list, Smac_get_input_source_list, |
---|
840 | + 0, 0, 0, |
---|
841 | + doc: /* get input source list on MacOSX */) |
---|
842 | + (void) |
---|
843 | + { |
---|
844 | + NSArray *is_list = (NSArray *)TISCreateInputSourceList(NULL, false); |
---|
845 | + int list_size = [is_list count]; |
---|
846 | + Lisp_Object list[list_size]; |
---|
847 | + int i; |
---|
848 | + |
---|
849 | + for (i = 0; i < list_size; i++) { |
---|
850 | + TISInputSourceRef is = (TISInputSourceRef)[is_list objectAtIndex:i]; |
---|
851 | + NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID); |
---|
852 | + list[i] = make_string([id UTF8String], |
---|
853 | + [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); |
---|
854 | + } |
---|
855 | + |
---|
856 | + return Flist(list_size, list); |
---|
857 | + } |
---|
858 | + |
---|
859 | + DEFUN ("mac-get-current-input-source", Fmac_get_current_input_source, Smac_get_current_input_source, |
---|
860 | + 0, 0, 0, |
---|
861 | + doc: /* get current input source on MacOSX */) |
---|
862 | + (void) |
---|
863 | + { |
---|
864 | + TISInputSourceRef is = TISCopyCurrentKeyboardInputSource(); |
---|
865 | + NSString *id = (NSString *)TISGetInputSourceProperty(is, kTISPropertyInputSourceID); |
---|
866 | + |
---|
867 | + return make_string([id UTF8String], |
---|
868 | + [id lengthOfBytesUsingEncoding:NSUTF8StringEncoding]); |
---|
869 | + } |
---|
870 | + |
---|
871 | + DEFUN ("mac-toggle-input-source", Fmac_toggle_input_source, Smac_toggle_input_source, |
---|
872 | + 1, 1, 0, |
---|
873 | + doc: /* toggle input source on MacOSX */) |
---|
874 | + (arg) |
---|
875 | + Lisp_Object arg; |
---|
876 | + { |
---|
877 | + TISInputSourceRef is = NULL; |
---|
878 | + |
---|
879 | + if (NILP (arg)) |
---|
880 | + { |
---|
881 | + is = TISCopyCurrentASCIICapableKeyboardInputSource(); |
---|
882 | + } |
---|
883 | + else |
---|
884 | + { |
---|
885 | + NSString *locale; |
---|
886 | + NSArray *languages = [NSLocale preferredLanguages]; |
---|
887 | + if (languages != nil) { |
---|
888 | + locale = [languages objectAtIndex:0]; |
---|
889 | + } else { |
---|
890 | + locale = [[NSLocale currentLocale] |
---|
891 | + objectForKey:NSLocaleLanguageCode]; |
---|
892 | + } |
---|
893 | + is = TISCopyInputSourceForLanguage((CFStringRef)locale); |
---|
894 | + } |
---|
895 | + if (is) TISSelectInputSource(is); |
---|
896 | + |
---|
897 | + return arg; |
---|
898 | + } |
---|
899 | + |
---|
900 | + int |
---|
901 | + mac_store_change_input_method_event () |
---|
902 | + { |
---|
903 | + Lisp_Object dim; |
---|
904 | + int ret = FALSE; |
---|
905 | + |
---|
906 | + dim = Fsymbol_value (intern ("default-input-method")); |
---|
907 | + if (STRINGP (dim) && strcmp(SDATA (dim), "MacOSX") == 0) |
---|
908 | + { |
---|
909 | + ret = TRUE; |
---|
910 | + } |
---|
911 | + |
---|
912 | + return ret; |
---|
913 | + } |
---|
914 | + |
---|
915 | + int |
---|
916 | + mac_pass_key_to_system (int code, int modifiers) |
---|
917 | + { |
---|
918 | + Lisp_Object keys = Fsymbol_value (Qmac_keys_passed_to_system); |
---|
919 | + Lisp_Object m, k; |
---|
920 | + |
---|
921 | + while (!NILP (keys)) |
---|
922 | + { |
---|
923 | + m = XCAR (XCAR (keys)); |
---|
924 | + k = XCDR (XCAR (keys)); |
---|
925 | + keys = XCDR (keys); |
---|
926 | + |
---|
927 | + if (NUMBERP (m) && modifiers == XINT (m)) |
---|
928 | + if (NILP (k) |
---|
929 | + || (NUMBERP (k) && code == XINT (k))) |
---|
930 | + return TRUE; |
---|
931 | + } |
---|
932 | + |
---|
933 | + return FALSE; |
---|
934 | + } |
---|
935 | + |
---|
936 | + int |
---|
937 | + mac_pass_key_directly_to_emacs (void) |
---|
938 | + { |
---|
939 | + |
---|
940 | + if (NILP (Fmac_input_source_is_ascii_capable())) |
---|
941 | + { |
---|
942 | + if (NILP (Vmac_use_input_method_on_system) |
---|
943 | + || this_command_key_count |
---|
944 | + || cursor_in_echo_area |
---|
945 | + || !NILP (BVAR (current_buffer, read_only))) |
---|
946 | + return TRUE; |
---|
947 | + } |
---|
948 | + |
---|
949 | + return FALSE; |
---|
950 | + } |
---|
951 | + |
---|
952 | + |
---|
953 | + void mac_init_input_method (void) |
---|
954 | + { |
---|
955 | + Qmac_keys_passed_to_system = intern ("mac-keys-passed-to-system"); |
---|
956 | + staticpro (&Qmac_keys_passed_to_system); |
---|
957 | + |
---|
958 | + DEFVAR_LISP ("mac-use-input-method-on-system", Vmac_use_input_method_on_system, |
---|
959 | + doc: /* If it is non-nil, use input method on system. */); |
---|
960 | + Vmac_use_input_method_on_system = Qt; |
---|
961 | + |
---|
962 | + defsubr (&Smac_input_source_is_ascii_capable); |
---|
963 | + defsubr (&Smac_get_input_source_list); |
---|
964 | + defsubr (&Smac_get_current_input_source); |
---|
965 | + defsubr (&Smac_toggle_input_source); |
---|
966 | + } |
---|
967 | + #endif |
---|
968 | diff -Nrc ../emacs-25.1.orig/src/nsfns.m ./src/nsfns.m |
---|
969 | *** ../emacs-25.1.orig/src/nsfns.m 2016-06-29 03:49:22.000000000 -0600 |
---|
970 | --- ./src/nsfns.m 2016-10-17 09:56:06.000000000 -0600 |
---|
971 | *************** |
---|
972 | *** 522,528 **** |
---|
973 | ns_set_name_internal (f, name); |
---|
974 | } |
---|
975 | |
---|
976 | - |
---|
977 | void |
---|
978 | ns_set_name_as_filename (struct frame *f) |
---|
979 | { |
---|
980 | --- 522,527 ---- |
---|
981 | *************** |
---|
982 | *** 3136,3141 **** |
---|
983 | --- 3135,3158 ---- |
---|
984 | doc: /* Toolkit version for NS Windowing. */); |
---|
985 | Vns_version_string = ns_appkit_version_str (); |
---|
986 | |
---|
987 | + |
---|
988 | + DEFVAR_LISP ("ns-shift-key-mask", Vns_shift_key_mask, |
---|
989 | + doc: /* Shift key mask defined in system. */); |
---|
990 | + Vns_shift_key_mask = make_number (NSShiftKeyMask); |
---|
991 | + |
---|
992 | + DEFVAR_LISP ("ns-control-key-mask", Vns_control_key_mask, |
---|
993 | + doc: /* Control key mask defined in system. */); |
---|
994 | + Vns_control_key_mask = make_number (NSControlKeyMask); |
---|
995 | + |
---|
996 | + DEFVAR_LISP ("ns-alternate-key-mask", Vns_alternate_key_mask, |
---|
997 | + doc: /* Alternate key mask defined in system. */); |
---|
998 | + Vns_alternate_key_mask = make_number (NSAlternateKeyMask); |
---|
999 | + |
---|
1000 | + DEFVAR_LISP ("ns-command-key-mask", Vns_command_key_mask, |
---|
1001 | + doc: /* Command key mask defined in system. */); |
---|
1002 | + Vns_command_key_mask = make_number (NSCommandKeyMask); |
---|
1003 | + |
---|
1004 | + |
---|
1005 | defsubr (&Sns_read_file_name); |
---|
1006 | defsubr (&Sns_get_resource); |
---|
1007 | defsubr (&Sns_set_resource); |
---|
1008 | *************** |
---|
1009 | *** 3180,3185 **** |
---|
1010 | --- 3197,3206 ---- |
---|
1011 | defsubr (&Sx_show_tip); |
---|
1012 | defsubr (&Sx_hide_tip); |
---|
1013 | |
---|
1014 | + #ifdef NS_IMPL_COCOA |
---|
1015 | + mac_init_input_method (); |
---|
1016 | + #endif |
---|
1017 | + |
---|
1018 | as_status = 0; |
---|
1019 | as_script = Qnil; |
---|
1020 | as_result = 0; |
---|
1021 | diff -Nrc ../emacs-25.1.orig/src/nsterm.h ./src/nsterm.h |
---|
1022 | *** ../emacs-25.1.orig/src/nsterm.h 2016-08-22 03:17:47.000000000 -0600 |
---|
1023 | --- ./src/nsterm.h 2016-10-17 09:56:06.000000000 -0600 |
---|
1024 | *************** |
---|
1025 | *** 757,762 **** |
---|
1026 | --- 757,764 ---- |
---|
1027 | #define KEY_NS_NEW_FRAME ((1<<28)|(0<<16)|12) |
---|
1028 | #define KEY_NS_TOGGLE_TOOLBAR ((1<<28)|(0<<16)|13) |
---|
1029 | #define KEY_NS_SHOW_PREFS ((1<<28)|(0<<16)|14) |
---|
1030 | + #define KEY_MAC_CHANGE_INPUT_METHOD ((1<<28)|(0<<16)|15) |
---|
1031 | + #define KEY_NS_PUT_MARKED_TEXT ((1<<28)|(0<<16)|16) |
---|
1032 | |
---|
1033 | /* could use list to store these, but rest of emacs has a big infrastructure |
---|
1034 | for managing a table of bitmap "records" */ |
---|
1035 | diff -Nrc ../emacs-25.1.orig/src/nsterm.m ./src/nsterm.m |
---|
1036 | *** ../emacs-25.1.orig/src/nsterm.m 2016-08-22 03:17:47.000000000 -0600 |
---|
1037 | --- ./src/nsterm.m 2016-10-17 09:57:27.000000000 -0600 |
---|
1038 | *************** |
---|
1039 | *** 4859,4864 **** |
---|
1040 | --- 4859,4867 ---- |
---|
1041 | /* [[NSNotificationCenter defaultCenter] addObserver: NSApp |
---|
1042 | selector: @selector (logNotification:) |
---|
1043 | name: nil object: nil]; */ |
---|
1044 | + [[NSDistributedNotificationCenter defaultCenter] addObserver: NSApp |
---|
1045 | + selector: @selector (changeInputMethod:) |
---|
1046 | + name: @"AppleSelectedInputSourcesChangedNotification" object: nil]; |
---|
1047 | |
---|
1048 | dpyinfo = xzalloc (sizeof *dpyinfo); |
---|
1049 | |
---|
1050 | *************** |
---|
1051 | *** 5162,5167 **** |
---|
1052 | --- 5165,5185 ---- |
---|
1053 | NSLog (@"notification: '%@'", [notification name]); |
---|
1054 | } |
---|
1055 | |
---|
1056 | + - (void)changeInputMethod: (NSNotification *)notification |
---|
1057 | + { |
---|
1058 | + |
---|
1059 | + struct frame *emacsframe = SELECTED_FRAME (); |
---|
1060 | + |
---|
1061 | + if (mac_store_change_input_method_event()) |
---|
1062 | + { |
---|
1063 | + if (!emacs_event) |
---|
1064 | + return; |
---|
1065 | + emacs_event->kind = NS_NONKEY_EVENT; |
---|
1066 | + emacs_event->code = KEY_MAC_CHANGE_INPUT_METHOD; |
---|
1067 | + emacs_event->modifiers = 0; |
---|
1068 | + EV_TRAILER ((id)nil); |
---|
1069 | + } |
---|
1070 | + } |
---|
1071 | |
---|
1072 | - (void)sendEvent: (NSEvent *)theEvent |
---|
1073 | /* -------------------------------------------------------------------------- |
---|
1074 | *************** |
---|
1075 | *** 5985,5991 **** |
---|
1076 | code, fnKeysym, flags, emacs_event->modifiers); |
---|
1077 | |
---|
1078 | /* if it was a function key or had modifiers, pass it directly to emacs */ |
---|
1079 | ! if (fnKeysym || (emacs_event->modifiers |
---|
1080 | && (emacs_event->modifiers != shift_modifier) |
---|
1081 | && [[theEvent charactersIgnoringModifiers] length] > 0)) |
---|
1082 | /*[[theEvent characters] length] */ |
---|
1083 | --- 6003,6010 ---- |
---|
1084 | code, fnKeysym, flags, emacs_event->modifiers); |
---|
1085 | |
---|
1086 | /* if it was a function key or had modifiers, pass it directly to emacs */ |
---|
1087 | ! if (mac_pass_key_directly_to_emacs () |
---|
1088 | ! ||fnKeysym || (emacs_event->modifiers |
---|
1089 | && (emacs_event->modifiers != shift_modifier) |
---|
1090 | && [[theEvent charactersIgnoringModifiers] length] > 0)) |
---|
1091 | /*[[theEvent characters] length] */ |
---|
1092 | *************** |
---|
1093 | *** 6000,6008 **** |
---|
1094 | ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; |
---|
1095 | |
---|
1096 | emacs_event->code = code; |
---|
1097 | ! EV_TRAILER (theEvent); |
---|
1098 | ! processingCompose = NO; |
---|
1099 | ! return; |
---|
1100 | } |
---|
1101 | } |
---|
1102 | |
---|
1103 | --- 6019,6037 ---- |
---|
1104 | ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT; |
---|
1105 | |
---|
1106 | emacs_event->code = code; |
---|
1107 | ! /* The function mac_pass_key_to_system decides |
---|
1108 | ! whether it is passed directly to emacs or not. */ |
---|
1109 | ! if (emacs_event->kind == NON_ASCII_KEYSTROKE_EVENT |
---|
1110 | ! || !mac_pass_key_to_system (code, flags |
---|
1111 | ! & (NSShiftKeyMask |
---|
1112 | ! | NSControlKeyMask |
---|
1113 | ! | NSAlternateKeyMask |
---|
1114 | ! | NSCommandKeyMask))) |
---|
1115 | ! { |
---|
1116 | ! EV_TRAILER (theEvent); |
---|
1117 | ! processingCompose = NO; |
---|
1118 | ! return; |
---|
1119 | ! } |
---|
1120 | } |
---|
1121 | } |
---|
1122 | |
---|
1123 | *************** |
---|
1124 | *** 6098,6107 **** |
---|
1125 | (unsigned long)selRange.length, |
---|
1126 | (unsigned long)selRange.location); |
---|
1127 | |
---|
1128 | - if (workingText != nil) |
---|
1129 | - [self deleteWorkingText]; |
---|
1130 | if ([str length] == 0) |
---|
1131 | ! return; |
---|
1132 | |
---|
1133 | if (!emacs_event) |
---|
1134 | return; |
---|
1135 | --- 6127,6145 ---- |
---|
1136 | (unsigned long)selRange.length, |
---|
1137 | (unsigned long)selRange.location); |
---|
1138 | |
---|
1139 | if ([str length] == 0) |
---|
1140 | ! { |
---|
1141 | ! [self deleteWorkingText]; |
---|
1142 | ! return; |
---|
1143 | ! } |
---|
1144 | ! else |
---|
1145 | ! { |
---|
1146 | ! if (workingText != nil) { |
---|
1147 | ! [workingText release]; |
---|
1148 | ! workingText = nil; |
---|
1149 | ! processingCompose = NO; |
---|
1150 | ! } |
---|
1151 | ! } |
---|
1152 | |
---|
1153 | if (!emacs_event) |
---|
1154 | return; |
---|
1155 | *************** |
---|
1156 | *** 6111,6117 **** |
---|
1157 | ns_working_text = build_string ([workingText UTF8String]); |
---|
1158 | |
---|
1159 | emacs_event->kind = NS_TEXT_EVENT; |
---|
1160 | ! emacs_event->code = KEY_NS_PUT_WORKING_TEXT; |
---|
1161 | EV_TRAILER ((id)nil); |
---|
1162 | } |
---|
1163 | |
---|
1164 | --- 6149,6157 ---- |
---|
1165 | ns_working_text = build_string ([workingText UTF8String]); |
---|
1166 | |
---|
1167 | emacs_event->kind = NS_TEXT_EVENT; |
---|
1168 | ! emacs_event->code = KEY_NS_PUT_MARKED_TEXT; |
---|
1169 | ! emacs_event->arg = Fcons (make_number (selRange.location), |
---|
1170 | ! Fcons (make_number (selRange.length), Qnil)); |
---|
1171 | EV_TRAILER ((id)nil); |
---|
1172 | } |
---|
1173 | |
---|
1174 | *************** |
---|
1175 | *** 6174,6191 **** |
---|
1176 | { |
---|
1177 | NSRect rect; |
---|
1178 | NSPoint pt; |
---|
1179 | ! struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); |
---|
1180 | |
---|
1181 | NSTRACE ("[EmacsView firstRectForCharacterRange:]"); |
---|
1182 | |
---|
1183 | if (NS_KEYLOG) |
---|
1184 | NSLog (@"firstRectForCharRange request"); |
---|
1185 | |
---|
1186 | rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe); |
---|
1187 | rect.size.height = FRAME_LINE_HEIGHT (emacsframe); |
---|
1188 | pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x); |
---|
1189 | pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y |
---|
1190 | ! +FRAME_LINE_HEIGHT (emacsframe)); |
---|
1191 | |
---|
1192 | pt = [self convertPoint: pt toView: nil]; |
---|
1193 | pt = [[self window] convertBaseToScreen: pt]; |
---|
1194 | --- 6214,6239 ---- |
---|
1195 | { |
---|
1196 | NSRect rect; |
---|
1197 | NSPoint pt; |
---|
1198 | ! // struct window *win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); |
---|
1199 | ! struct window *win; |
---|
1200 | |
---|
1201 | NSTRACE ("[EmacsView firstRectForCharacterRange:]"); |
---|
1202 | |
---|
1203 | if (NS_KEYLOG) |
---|
1204 | NSLog (@"firstRectForCharRange request"); |
---|
1205 | |
---|
1206 | + if (NILP (Vmac_in_echo_area)) |
---|
1207 | + win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); |
---|
1208 | + else if (WINDOWP (echo_area_window)) |
---|
1209 | + win = XWINDOW (echo_area_window); |
---|
1210 | + else |
---|
1211 | + win = XWINDOW (FRAME_SELECTED_WINDOW (emacsframe)); |
---|
1212 | + |
---|
1213 | rect.size.width = theRange.length * FRAME_COLUMN_WIDTH (emacsframe); |
---|
1214 | rect.size.height = FRAME_LINE_HEIGHT (emacsframe); |
---|
1215 | pt.x = WINDOW_TEXT_TO_FRAME_PIXEL_X (win, win->phys_cursor.x); |
---|
1216 | pt.y = WINDOW_TO_FRAME_PIXEL_Y (win, win->phys_cursor.y |
---|
1217 | ! +FRAME_LINE_HEIGHT (emacsframe)+2); |
---|
1218 | |
---|
1219 | pt = [self convertPoint: pt toView: nil]; |
---|
1220 | pt = [[self window] convertBaseToScreen: pt]; |
---|
1221 | *************** |
---|
1222 | *** 8782,8787 **** |
---|
1223 | --- 8830,8839 ---- |
---|
1224 | baseline level. The default value is nil. */); |
---|
1225 | x_underline_at_descent_line = 0; |
---|
1226 | |
---|
1227 | + DEFVAR_LISP ("mac-in-echo-area", Vmac_in_echo_area, |
---|
1228 | + doc: /* state of cursor in echo area. */); |
---|
1229 | + Vmac_in_echo_area = Qnil; |
---|
1230 | + |
---|
1231 | /* Tell Emacs about this window system. */ |
---|
1232 | Fprovide (Qns, Qnil); |
---|
1233 | |
---|
1234 | diff -Nrc ../emacs-25.1.orig/src/termhooks.h ./src/termhooks.h |
---|
1235 | *** ../emacs-25.1.orig/src/termhooks.h 2016-06-29 03:49:23.000000000 -0600 |
---|
1236 | --- ./src/termhooks.h 2016-10-17 09:56:06.000000000 -0600 |
---|
1237 | *************** |
---|
1238 | *** 59,64 **** |
---|
1239 | --- 59,65 ---- |
---|
1240 | output_x_window, |
---|
1241 | output_msdos_raw, |
---|
1242 | output_w32, |
---|
1243 | + output_mac, |
---|
1244 | output_ns |
---|
1245 | }; |
---|