-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
emacs-27.1-inline.patch
2187 lines (2039 loc) · 74.6 KB
/
emacs-27.1-inline.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff -crN --exclude .git emacs_origin/configure.ac emacs/configure.ac
*** emacs_origin/configure.ac 2019-12-30 01:06:49.000000000 +0900
--- emacs/configure.ac 2019-12-30 07:22:13.000000000 +0900
***************
*** 2073,2079 ****
INSTALL_ARCH_INDEP_EXTRA=
fi
! NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o $ns_fontfile"
fi
CFLAGS="$tmp_CFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
--- 2073,2079 ----
INSTALL_ARCH_INDEP_EXTRA=
fi
! NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o macim.o $ns_fontfile"
fi
CFLAGS="$tmp_CFLAGS"
CPPFLAGS="$tmp_CPPFLAGS"
***************
*** 5459,5465 ****
darwin)
if test "$HAVE_NS" = "yes"; then
! libs_nsgui="-framework AppKit"
if test "$NS_IMPL_COCOA" = "yes"; then
libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon"
fi
--- 5459,5465 ----
darwin)
if test "$HAVE_NS" = "yes"; then
! libs_nsgui="-framework AppKit -framework Carbon"
if test "$NS_IMPL_COCOA" = "yes"; then
libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon"
fi
diff -crN --exclude .git emacs_origin/lisp/term/common-win.el emacs/lisp/term/common-win.el
*** emacs_origin/lisp/term/common-win.el 2019-12-30 01:06:56.000000000 +0900
--- emacs/lisp/term/common-win.el 2019-12-30 07:22:13.000000000 +0900
***************
*** 73,78 ****
--- 73,79 ----
(cons 12 'ns-new-frame)
(cons 13 'ns-toggle-toolbar)
(cons 14 'ns-show-prefs)
+ (cons 15 'mac-change-input-method)
))))
(set-terminal-parameter frame 'x-setup-function-keys t)))
diff -crN --exclude .git emacs_origin/lisp/term/ns-win.el emacs/lisp/term/ns-win.el
*** emacs_orig/lisp/term/ns-win.el 2021-09-24 01:09:05.000000000 +0900
--- emacs/lisp/term/ns-win.el 2021-09-24 18:23:21.000000000 +0900
***************
*** 18,24 ****
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
! ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
--- 18,24 ----
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
! ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
***************
*** 42,48 ****
(eval-when-compile (require 'cl-lib))
(or (featurep 'ns)
(error "%s: Loading ns-win.el but not compiled for GNUstep/macOS"
! invocation-name))
;; Documentation-purposes only: actually loaded in loadup.el.
(require 'frame)
--- 42,48 ----
(eval-when-compile (require 'cl-lib))
(or (featurep 'ns)
(error "%s: Loading ns-win.el but not compiled for GNUstep/macOS"
! invocation-name))
;; Documentation-purposes only: actually loaded in loadup.el.
(require 'frame)
***************
*** 68,76 ****
(defun ns-handle-nxopen (_switch &optional temp)
(setq unread-command-events (append unread-command-events
! (if temp '(ns-open-temp-file)
! '(ns-open-file)))
! ns-input-file (append ns-input-file (list (pop x-invocation-args)))))
(defun ns-handle-nxopentemp (switch)
(ns-handle-nxopen switch t))
--- 68,76 ----
(defun ns-handle-nxopen (_switch &optional temp)
(setq unread-command-events (append unread-command-events
! (if temp '(ns-open-temp-file)
! '(ns-open-file)))
! ns-input-file (append ns-input-file (list (pop x-invocation-args)))))
(defun ns-handle-nxopentemp (switch)
(ns-handle-nxopen switch t))
***************
*** 175,181 ****
(define-key global-map [ns-new-frame] 'make-frame)
(define-key global-map [ns-toggle-toolbar] 'ns-toggle-toolbar)
(define-key global-map [ns-show-prefs] 'customize)
!
;; Set up a number of aliases and other layers to pretend we're using
;; the Choi/Mitsuharu Carbon port.
--- 175,181 ----
(define-key global-map [ns-new-frame] 'make-frame)
(define-key global-map [ns-toggle-toolbar] 'ns-toggle-toolbar)
(define-key global-map [ns-show-prefs] 'customize)
! (define-key global-map [mac-change-input-method] 'mac-change-input-method)
;; Set up a number of aliases and other layers to pretend we're using
;; the Choi/Mitsuharu Carbon port.
***************
*** 198,222 ****
(let ((mapping [menu-bar services])
(service (mapconcat 'identity path "/"))
(name (intern
! (subst-char-in-string
! ?\s ?-
! (mapconcat 'identity (cons "ns-service" path) "-")))))
;; This defines the function.
(defalias name
(lambda (arg)
! (interactive "p")
! (let* ((in-string
! (cond ((stringp arg) arg)
! (mark-active
! (buffer-substring (region-beginning) (region-end)))))
! (out-string (ns-perform-service service in-string)))
! (cond
! ((stringp arg) out-string)
! ((and out-string (or (not in-string)
! (not (string= in-string out-string))))
! (if mark-active (delete-region (region-beginning) (region-end)))
! (insert out-string)
! (setq deactivate-mark nil))))))
(cond
((lookup-key global-map mapping)
(while (cdr path)
--- 198,222 ----
(let ((mapping [menu-bar services])
(service (mapconcat 'identity path "/"))
(name (intern
! (subst-char-in-string
! ?\s ?-
! (mapconcat 'identity (cons "ns-service" path) "-")))))
;; This defines the function.
(defalias name
(lambda (arg)
! (interactive "p")
! (let* ((in-string
! (cond ((stringp arg) arg)
! (mark-active
! (buffer-substring (region-beginning) (region-end)))))
! (out-string (ns-perform-service service in-string)))
! (cond
! ((stringp arg) out-string)
! ((and out-string (or (not in-string)
! (not (string= in-string out-string))))
! (if mark-active (delete-region (region-beginning) (region-end)))
! (insert out-string)
! (setq deactivate-mark nil))))))
(cond
((lookup-key global-map mapping)
(while (cdr path)
***************
*** 269,311 ****
;; editing window.)
(defface ns-working-text-face
! '((t :underline t))
"Face used to highlight working text during compose sequence insert."
:group 'ns)
(defvar ns-working-overlay nil
"Overlay used to highlight working text during compose sequence insert.
When text is in th echo area, this just stores the length of the working text.")
- (defvar ns-working-text) ; nsterm.m
-
;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
;; This will fail if called from a NONASCII_KEYSTROKE event on the global map.
(defun ns-in-echo-area ()
"Whether, for purposes of inserting working composition text, the minibuffer
is currently being used."
! (or isearch-mode
! (and cursor-in-echo-area (current-message))
! ;; Overlay strings are not shown in some cases.
! (get-char-property (point) 'invisible)
! (and (not (bobp))
! (or (and (get-char-property (point) 'display)
! (eq (get-char-property (1- (point)) 'display)
! (get-char-property (point) 'display)))
! (and (get-char-property (point) 'composition)
! (eq (get-char-property (1- (point)) 'composition)
! (get-char-property (point) 'composition)))))))
;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
! ;; always returns nil for some reason. If this WASN'T the case, we could
;; map this to [ns-insert-working-text] and eliminate Fevals in nsterm.m.
;; These functions test whether in echo area and delegate accordingly.
(defun ns-put-working-text ()
(interactive)
(if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text)))
(defun ns-unput-working-text ()
(interactive)
! (ns-delete-working-text))
(defun ns-insert-working-text ()
"Insert contents of `ns-working-text' as UTF-8 string and mark with
--- 269,336 ----
;; editing window.)
(defface ns-working-text-face
! '((((background dark)) :underline "gray80")
! (t :underline "gray20"))
"Face used to highlight working text during compose sequence insert."
:group 'ns)
+ (defface ns-marked-text-face
+ '((((background dark)) :underline "gray80")
+ (t :underline "gray20"))
+ "Face used to highlight marked text during compose sequence insert."
+ :group 'ns)
+
+ (defface ns-unmarked-text-face
+ '((((background dark)) :underline "gray20")
+ (t :underline "gray80"))
+ "Face used to highlight marked text during compose sequence insert."
+ :group 'ns)
+
(defvar ns-working-overlay nil
"Overlay used to highlight working text during compose sequence insert.
When text is in th echo area, this just stores the length of the working text.")
;; Test if in echo area, based on mac-win.el 2007/08/26 unicode-2.
;; This will fail if called from a NONASCII_KEYSTROKE event on the global map.
(defun ns-in-echo-area ()
"Whether, for purposes of inserting working composition text, the minibuffer
is currently being used."
! (setq mac-in-echo-area
! (or isearch-mode
! (and cursor-in-echo-area (current-message))
! ;; Overlay strings are not shown in some cases.
! (get-char-property (point) 'invisible)
! (and (not (bobp))
! (or (and (get-char-property (point) 'display)
! (eq (get-char-property (1- (point)) 'display)
! (get-char-property (point) 'display)))
! (and (get-char-property (point) 'composition)
! (eq (get-char-property (1- (point)) 'composition)
! (get-char-property (point) 'composition)))))))
! mac-in-echo-area)
!
! (defvar ns-put-text-p nil)
! (defvar mac-ime-before-put-text-hook nil)
! (defvar mac-ime-after-put-text-hook nil)
;; The 'interactive' here stays for subinvocations, so the ns-in-echo-area
! ;; always returns nil for some reason. If this WASN'T the case, we could
;; map this to [ns-insert-working-text] and eliminate Fevals in nsterm.m.
;; These functions test whether in echo area and delegate accordingly.
(defun ns-put-working-text ()
(interactive)
+ (setq ns-put-text-p t)
+ (run-hooks 'mac-ime-before-put-text-hook)
(if (ns-in-echo-area) (ns-echo-working-text) (ns-insert-working-text)))
+
(defun ns-unput-working-text ()
(interactive)
! (setq ns-put-text-p nil)
! (run-hooks 'mac-ime-after-put-text-hook)
! (ns-delete-working-text)
! (when (and mac-ime-hide-cursor mac-ime--cursor-type)
! (setq cursor-type mac-ime--cursor-type
! mac-ime--cursor-type nil)))
(defun ns-insert-working-text ()
"Insert contents of `ns-working-text' as UTF-8 string and mark with
***************
*** 314,323 ****
(interactive)
(ns-delete-working-text)
(let ((start (point)))
! (insert ns-working-text)
! (overlay-put (setq ns-working-overlay (make-overlay start (point)
! (current-buffer) nil t))
! 'face 'ns-working-text-face)))
(defun ns-echo-working-text ()
"Echo contents of `ns-working-text' in message display area.
--- 339,347 ----
(interactive)
(ns-delete-working-text)
(let ((start (point)))
! (overlay-put (setq ns-working-overlay (make-overlay start (point)))
! 'after-string
! (propertize ns-working-text 'face 'ns-working-text-face))))
(defun ns-echo-working-text ()
"Echo contents of `ns-working-text' in message display area.
***************
*** 332,356 ****
'face 'ns-working-text-face msg)
(message "%s" msg)))
(defun ns-delete-working-text()
"Delete working text and clear `ns-working-overlay'."
(interactive)
(cond
((and (overlayp ns-working-overlay)
! ;; Still alive?
! (overlay-buffer ns-working-overlay))
(with-current-buffer (overlay-buffer ns-working-overlay)
! (delete-region (overlay-start ns-working-overlay)
! (overlay-end ns-working-overlay))
(delete-overlay ns-working-overlay)))
((integerp ns-working-overlay)
(let ((msg (current-message))
! message-log-max)
(setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
(message "%s" msg))))
(setq ns-working-overlay nil))
-
;; macOS file system Unicode UTF-8 NFD (decomposed form) support.
(when (eq system-type 'darwin)
;; Used prior to Emacs 25.
--- 356,438 ----
'face 'ns-working-text-face msg)
(message "%s" msg)))
+ (defvar mac-ime--cursor-type nil)
+ (defun ns-put-marked-text (event)
+ (interactive "e")
+ (setq ns-put-text-p t)
+ (run-hooks 'mac-ime-before-put-text-hook)
+ (let ((pos (nth 1 event))
+ (len (nth 2 event)))
+ (when (and (> len 0)
+ cursor-type
+ mac-ime-hide-cursor)
+ (setq mac-ime--cursor-type cursor-type
+ cursor-type nil))
+ (if (ns-in-echo-area)
+ (ns-echo-marked-text pos len)
+ (ns-insert-marked-text pos len))))
+
+ (defun ns-insert-marked-text (mark-from mark-length)
+ "Insert contents of `ns-working-text' as UTF-8 string and mark with
+ `ns-working-overlay'. Any previously existing working text is cleared
+ first. The overlay is assigned the faces `ns-working-text-face' and
+ `ns-marked-text-face'."
+ (ns-delete-working-text)
+ (let ((mark-to (+ mark-from mark-length)))
+ (when (<= mark-to (length ns-working-text))
+ (setq ns-working-overlay (make-overlay (point) (point)))
+ (if (= mark-length 0)
+ (overlay-put ns-working-overlay
+ 'before-string
+ (propertize ns-working-text 'face 'ns-working-text-face))
+ (overlay-put ns-working-overlay
+ 'before-string
+ (concat
+ (propertize (substring ns-working-text 0 mark-from)
+ 'face 'ns-unmarked-text-face)
+ (propertize (substring ns-working-text mark-from mark-to)
+ 'face 'ns-marked-text-face)
+ (propertize (substring ns-working-text mark-to nil)
+ 'face 'ns-unmarked-text-face)))))))
+
+ (defun ns-echo-marked-text (pos len)
+ "Echo contents of `ns-working-text' in message display area.
+ See `ns-insert-working-text'."
+ (ns-delete-working-text)
+ (let* ((msg (current-message))
+ (msglen (length msg))
+ message-log-max)
+ (when (integerp ns-working-overlay)
+ (setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
+ (setq msglen (length msg)))
+ (setq ns-working-overlay (length ns-working-text))
+ (setq msg (concat msg ns-working-text))
+ (if (= len 0)
+ (put-text-property msglen (+ msglen ns-working-overlay)
+ 'face 'ns-working-text-face msg)
+ (put-text-property msglen (+ msglen ns-working-overlay)
+ 'face 'ns-marked-text-face msg)
+ (put-text-property (+ msglen pos) (+ msglen pos len)
+ 'face 'ns-unmarked-text-face msg))
+ (message "%s" msg)))
+
(defun ns-delete-working-text()
"Delete working text and clear `ns-working-overlay'."
(interactive)
(cond
((and (overlayp ns-working-overlay)
! ;; Still alive?
! (overlay-buffer ns-working-overlay))
(with-current-buffer (overlay-buffer ns-working-overlay)
! (overlay-put ns-working-overlay 'after-string nil)
(delete-overlay ns-working-overlay)))
((integerp ns-working-overlay)
(let ((msg (current-message))
! message-log-max)
(setq msg (substring msg 0 (- (length msg) ns-working-overlay)))
(message "%s" msg))))
(setq ns-working-overlay nil))
;; macOS file system Unicode UTF-8 NFD (decomposed form) support.
(when (eq system-type 'darwin)
;; Used prior to Emacs 25.
***************
*** 366,379 ****
(interactive)
(let ((f (pop ns-input-file)))
(if (file-directory-p f)
! (find-file f)
(push-mark (+ (point) (cadr (insert-file-contents f)))))))
(defvar ns-select-overlay nil
"Overlay used to highlight areas in files requested by Nextstep apps.")
(make-variable-buffer-local 'ns-select-overlay)
! (defvar ns-input-line) ; nsterm.m
(defun ns-open-file-select-line ()
"Open a buffer containing the file `ns-input-file'.
--- 448,461 ----
(interactive)
(let ((f (pop ns-input-file)))
(if (file-directory-p f)
! (find-file f)
(push-mark (+ (point) (cadr (insert-file-contents f)))))))
(defvar ns-select-overlay nil
"Overlay used to highlight areas in files requested by Nextstep apps.")
(make-variable-buffer-local 'ns-select-overlay)
! (defvar ns-input-line) ; nsterm.m
(defun ns-open-file-select-line ()
"Open a buffer containing the file `ns-input-file'.
***************
*** 383,417 ****
(cond
((and ns-input-line (buffer-modified-p))
(if ns-select-overlay
! (setq ns-select-overlay (delete-overlay ns-select-overlay)))
(deactivate-mark)
(goto-char (point-min))
(forward-line (1- (if (consp ns-input-line)
! (min (car ns-input-line) (cdr ns-input-line))
! ns-input-line))))
(ns-input-line
(if (not ns-select-overlay)
! (overlay-put (setq ns-select-overlay (make-overlay (point-min)
! (point-min)))
! 'face 'highlight))
(let ((beg (save-excursion
! (goto-char (point-min))
! (line-beginning-position
! (if (consp ns-input-line)
! (min (car ns-input-line) (cdr ns-input-line))
! ns-input-line))))
! (end (save-excursion
! (goto-char (point-min))
! (line-beginning-position
! (1+ (if (consp ns-input-line)
! (max (car ns-input-line) (cdr ns-input-line))
! ns-input-line))))))
(move-overlay ns-select-overlay beg end)
(deactivate-mark)
(goto-char beg)))
(t
(if ns-select-overlay
! (setq ns-select-overlay (delete-overlay ns-select-overlay))))))
(defun ns-unselect-line ()
"Removes any Nextstep highlight a buffer may contain."
--- 465,499 ----
(cond
((and ns-input-line (buffer-modified-p))
(if ns-select-overlay
! (setq ns-select-overlay (delete-overlay ns-select-overlay)))
(deactivate-mark)
(goto-char (point-min))
(forward-line (1- (if (consp ns-input-line)
! (min (car ns-input-line) (cdr ns-input-line))
! ns-input-line))))
(ns-input-line
(if (not ns-select-overlay)
! (overlay-put (setq ns-select-overlay (make-overlay (point-min)
! (point-min)))
! 'face 'highlight))
(let ((beg (save-excursion
! (goto-char (point-min))
! (line-beginning-position
! (if (consp ns-input-line)
! (min (car ns-input-line) (cdr ns-input-line))
! ns-input-line))))
! (end (save-excursion
! (goto-char (point-min))
! (line-beginning-position
! (1+ (if (consp ns-input-line)
! (max (car ns-input-line) (cdr ns-input-line))
! ns-input-line))))))
(move-overlay ns-select-overlay beg end)
(deactivate-mark)
(goto-char beg)))
(t
(if ns-select-overlay
! (setq ns-select-overlay (delete-overlay ns-select-overlay))))))
(defun ns-unselect-line ()
"Removes any Nextstep highlight a buffer may contain."
***************
*** 428,434 ****
(cond
((not res) 'unbound)
((string-equal (upcase res) "YES") t)
! ((string-equal (upcase res) "NO") nil)
(t (read res)))))
;; nsterm.m
--- 510,516 ----
(cond
((not res) 'unbound)
((string-equal (upcase res) "YES") t)
! ((string-equal (upcase res) "NO") nil)
(t (read res)))))
;; nsterm.m
***************
*** 464,474 ****
If t, always do so. Any other non-nil value means open a new frame
unless the current buffer is a scratch buffer."
:type '(choice (const :tag "Never" nil)
! (const :tag "Always" t)
! (other :tag "Except for scratch buffer" fresh))
:version "23.1"
:group 'ns)
(declare-function ns-hide-emacs "nsfns.m" (on))
(defun ns-find-file ()
--- 546,572 ----
If t, always do so. Any other non-nil value means open a new frame
unless the current buffer is a scratch buffer."
:type '(choice (const :tag "Never" nil)
! (const :tag "Always" t)
! (other :tag "Except for scratch buffer" fresh))
:version "23.1"
:group 'ns)
+ (defcustom mac-ime-startup-state nil
+ "If non-nil, start Emacs with the specified IME state.
+ `activate' or `deactivate' shall be used.
+ If nil, inherit the IME state from macOS."
+ :type '(choice (const :tag "IME activated" activate)
+ (const :tag "IME deactivated" deactivate)
+ (const :tag "IME inherited from macOS" nil))
+ :version "27.0"
+ :group 'ns)
+
+ (defcustom mac-ime-hide-cursor t
+ "If non-nil, the cursor is not rendered when composing text."
+ :type 'boolean
+ :version "27.0"
+ :group 'ns)
+
(declare-function ns-hide-emacs "nsfns.m" (on))
(defun ns-find-file ()
***************
*** 477,485 ****
(let* ((f (file-truename
(expand-file-name (pop ns-input-file)
command-line-default-directory)))
! (file (find-file-noselect f))
! (bufwin1 (get-buffer-window file 'visible))
! (bufwin2 (get-buffer-window "*scratch*" 'visible)))
(cond
(bufwin1
(select-frame (window-frame bufwin1))
--- 575,583 ----
(let* ((f (file-truename
(expand-file-name (pop ns-input-file)
command-line-default-directory)))
! (file (find-file-noselect f))
! (bufwin1 (get-buffer-window file 'visible))
! (bufwin2 (get-buffer-window "*scratch*" 'visible)))
(cond
(bufwin1
(select-frame (window-frame bufwin1))
***************
*** 505,528 ****
string dropped into the current buffer."
(interactive "e")
(let* ((window (posn-window (event-start event)))
! (arg (car (cdr (cdr event))))
! (type (car arg))
! (operations (car (cdr arg)))
! (objects (cdr (cdr arg)))
! (string (mapconcat 'identity objects "\n")))
(set-frame-selected-window nil window)
(raise-frame)
(setq window (selected-window))
(cond ((or (memq 'ns-drag-operation-generic operations)
! (memq 'ns-drag-operation-copy operations))
! ;; Perform the default/copy action.
! (dolist (data objects)
! (dnd-handle-one-url window 'private (if (eq type 'file)
! (concat "file:" data)
! data))))
! (t
! ;; Insert the text as is.
! (dnd-insert-text window 'private string)))))
(global-set-key [drag-n-drop] 'ns-drag-n-drop)
--- 603,626 ----
string dropped into the current buffer."
(interactive "e")
(let* ((window (posn-window (event-start event)))
! (arg (car (cdr (cdr event))))
! (type (car arg))
! (operations (car (cdr arg)))
! (objects (cdr (cdr arg)))
! (string (mapconcat 'identity objects "\n")))
(set-frame-selected-window nil window)
(raise-frame)
(setq window (selected-window))
(cond ((or (memq 'ns-drag-operation-generic operations)
! (memq 'ns-drag-operation-copy operations))
! ;; Perform the default/copy action.
! (dolist (data objects)
! (dnd-handle-one-url window 'private (if (eq type 'file)
! (concat "file:" data)
! data))))
! (t
! ;; Insert the text as is.
! (dnd-insert-text window 'private string)))))
(global-set-key [drag-n-drop] 'ns-drag-n-drop)
***************
*** 587,594 ****
(interactive)
(modify-frame-parameters
frame (list (cons 'tool-bar-lines
! (if (> (or (frame-parameter frame 'tool-bar-lines) 0) 0)
! 0 1)) ))
(if (not tool-bar-mode) (tool-bar-mode t)))
--- 685,692 ----
(interactive)
(modify-frame-parameters
frame (list (cons 'tool-bar-lines
! (if (> (or (frame-parameter frame 'tool-bar-lines) 0) 0)
! 0 1)) ))
(if (not tool-bar-mode) (tool-bar-mode t)))
***************
*** 599,613 ****
"Interactive front-end to `print-buffer': asks for user confirmation first."
(interactive)
(if (and (called-interactively-p 'interactive)
! (or (listp last-nonmenu-event)
! (and (char-or-string-p (event-basic-type last-command-event))
! (memq 'super (event-modifiers last-command-event)))))
(let ((last-nonmenu-event (if (listp last-nonmenu-event)
! last-nonmenu-event
! ;; Fake it:
! '(mouse-1 POSITION 1))))
! (if (y-or-n-p (format "Print buffer %s? " (buffer-name)))
! (print-buffer)
(error "Canceled")))
(print-buffer)))
--- 697,711 ----
"Interactive front-end to `print-buffer': asks for user confirmation first."
(interactive)
(if (and (called-interactively-p 'interactive)
! (or (listp last-nonmenu-event)
! (and (char-or-string-p (event-basic-type last-command-event))
! (memq 'super (event-modifiers last-command-event)))))
(let ((last-nonmenu-event (if (listp last-nonmenu-event)
! last-nonmenu-event
! ;; Fake it:
! '(mouse-1 POSITION 1))))
! (if (y-or-n-p (format "Print buffer %s? " (buffer-name)))
! (print-buffer)
(error "Canceled")))
(print-buffer)))
***************
*** 632,640 ****
`ns-input-fontsize' of new font."
(interactive)
(modify-frame-parameters (selected-frame)
! (list (cons 'fontsize ns-input-fontsize)))
(modify-frame-parameters (selected-frame)
! (list (cons 'font ns-input-font)))
(set-frame-font ns-input-font))
--- 730,738 ----
`ns-input-fontsize' of new font."
(interactive)
(modify-frame-parameters (selected-frame)
! (list (cons 'fontsize ns-input-fontsize)))
(modify-frame-parameters (selected-frame)
! (list (cons 'font ns-input-font)))
(set-frame-font ns-input-font))
***************
*** 645,661 ****
;; Only some code supports this so far, so use uglier XLFD version
;; "-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard,latin:Courier,han:Kai"
(mapconcat 'identity
! '("-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard"
! "latin:-*-Courier-*-*-*-*-10-*-*-*-*-*-iso10646-1"
! "han:-*-Kai-*-*-*-*-10-*-*-*-*-*-iso10646-1"
! "cyrillic:-*-Trebuchet$MS-*-*-*-*-10-*-*-*-*-*-iso10646-1")
! ",")
"String of fontset spec of the standard fontset.
This defines a fontset consisting of the Courier and other fonts that
come with macOS.
See the documentation of `create-fontset-from-fontset-spec' for the format.")
! (defvar ns-reg-to-script) ; nsfont.m
;; This maps font registries (not exposed by NS APIs for font selection) to
;; Unicode scripts (which can be mapped to Unicode character ranges which are).
--- 743,759 ----
;; Only some code supports this so far, so use uglier XLFD version
;; "-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard,latin:Courier,han:Kai"
(mapconcat 'identity
! '("-ns-*-*-*-*-*-10-*-*-*-*-*-fontset-standard"
! "latin:-*-Courier-*-*-*-*-10-*-*-*-*-*-iso10646-1"
! "han:-*-Kai-*-*-*-*-10-*-*-*-*-*-iso10646-1"
! "cyrillic:-*-Trebuchet$MS-*-*-*-*-10-*-*-*-*-*-iso10646-1")
! ",")
"String of fontset spec of the standard fontset.
This defines a fontset consisting of the Courier and other fonts that
come with macOS.
See the documentation of `create-fontset-from-fontset-spec' for the format.")
! (defvar ns-reg-to-script) ; nsfont.m
;; This maps font registries (not exposed by NS APIs for font selection) to
;; Unicode scripts (which can be mapped to Unicode character ranges which are).
***************
*** 733,746 ****
;; that keeps customize happy?
(when (featurep 'cocoa)
(let ((appkit-version
! (progn (string-match "^appkit-\\([^\s-]*\\)" ns-version-string)
! (string-to-number (match-string 1 ns-version-string)))))
;; Appkit 1138 ~= macOS 10.7.
(when (>= appkit-version 1138)
(setq mouse-wheel-progressive-speed nil)
(put 'mouse-wheel-progressive-speed 'customized-value
! (list (custom-quote
! (symbol-value 'mouse-wheel-progressive-speed)))))))
;;;; Color support.
--- 831,844 ----
;; that keeps customize happy?
(when (featurep 'cocoa)
(let ((appkit-version
! (progn (string-match "^appkit-\\([^\s-]*\\)" ns-version-string)
! (string-to-number (match-string 1 ns-version-string)))))
;; Appkit 1138 ~= macOS 10.7.
(when (>= appkit-version 1138)
(setq mouse-wheel-progressive-speed nil)
(put 'mouse-wheel-progressive-speed 'customized-value
! (list (custom-quote
! (symbol-value 'mouse-wheel-progressive-speed)))))))
;;;; Color support.
***************
*** 748,758 ****
;; Functions for color panel + drag
(defun ns-face-at-pos (pos)
(let* ((frame (car pos))
! (frame-pos (cons (cadr pos) (cddr pos)))
! (window (window-at (car frame-pos) (cdr frame-pos) frame))
! (window-pos (coordinates-in-window-p frame-pos window))
! (buffer (window-buffer window))
! (edges (window-edges window)))
(cond
((not window-pos)
nil)
--- 846,856 ----
;; Functions for color panel + drag
(defun ns-face-at-pos (pos)
(let* ((frame (car pos))
! (frame-pos (cons (cadr pos) (cddr pos)))
! (window (window-at (car frame-pos) (cdr frame-pos) frame))
! (window-pos (coordinates-in-window-p frame-pos window))
! (buffer (window-buffer window))
! (edges (window-edges window)))
(cond
((not window-pos)
nil)
***************
*** 762,780 ****
'default)
((consp window-pos)
(with-current-buffer buffer
! (let ((p (car (compute-motion (window-start window)
! (cons (nth 0 edges) (nth 1 edges))
! (window-end window)
! frame-pos
! (- (window-width window) 1)
! nil
! window))))
! (cond
! ((eq p (window-point window))
! 'cursor)
! ((and mark-active (< (region-beginning) p) (< p (region-end)))
! 'region)
! (t
(let ((faces (get-char-property p 'face window)))
(if (consp faces) (car faces) faces)))))))
(t
--- 860,878 ----
'default)
((consp window-pos)
(with-current-buffer buffer
! (let ((p (car (compute-motion (window-start window)
! (cons (nth 0 edges) (nth 1 edges))
! (window-end window)
! frame-pos
! (- (window-width window) 1)
! nil
! window))))
! (cond
! ((eq p (window-point window))
! 'cursor)
! ((and mark-active (< (region-beginning) p) (< p (region-end)))
! 'region)
! (t
(let ((faces (get-char-property p 'face window)))
(if (consp faces) (car faces) faces)))))))
(t
***************
*** 797,809 ****
(declare-function x-handle-args "common-win" (args))
(declare-function ns-list-services "nsfns.m" ())
(declare-function x-open-connection "nsfns.m"
! (display &optional xrm-string must-succeed))
(declare-function ns-set-resource "nsfns.m" (owner name value))
;; Do the actual Nextstep Windows setup here; the above code just
;; defines functions and variables that we use now.
(cl-defmethod window-system-initialization (&context (window-system ns)
! &optional _display)
"Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing."
(cl-assert (not ns-initialized))
--- 895,907 ----
(declare-function x-handle-args "common-win" (args))
(declare-function ns-list-services "nsfns.m" ())
(declare-function x-open-connection "nsfns.m"
! (display &optional xrm-string must-succeed))
(declare-function ns-set-resource "nsfns.m" (owner name value))
;; Do the actual Nextstep Windows setup here; the above code just
;; defines functions and variables that we use now.
(cl-defmethod window-system-initialization (&context (window-system ns)
! &optional _display)
"Initialize Emacs for Nextstep (Cocoa / GNUstep) windowing."
(cl-assert (not ns-initialized))
***************
*** 816,824 ****
(condition-case err
(create-fontset-from-fontset-spec ns-standard-fontset-spec t)
(error (display-warning
! 'initialization
! (format "Creation of the standard fontset failed: %s" err)
! :error)))
(x-open-connection (or (system-name) "") x-command-line-resources t)
--- 914,922 ----
(condition-case err
(create-fontset-from-fontset-spec ns-standard-fontset-spec t)
(error (display-warning
! 'initialization
! (format "Creation of the standard fontset failed: %s" err)
! :error)))
(x-open-connection (or (system-name) "") x-command-line-resources t)
***************
*** 842,851 ****
(dolist (service (ns-list-services))
! (if (eq (car service) 'undefined)
! (ns-define-service (cdr service))
! (define-key global-map (vector (car service))
! (ns-define-service (cdr service)))))
(if (and (eq (get-lisp-resource nil "NXAutoLaunch") t)
(eq (get-lisp-resource nil "HideOnAutoLaunch") t))
--- 940,949 ----
(dolist (service (ns-list-services))
! (if (eq (car service) 'undefined)
! (ns-define-service (cdr service))
! (define-key global-map (vector (car service))
! (ns-define-service (cdr service)))))
(if (and (eq (get-lisp-resource nil "NXAutoLaunch") t)
(eq (get-lisp-resource nil "HideOnAutoLaunch") t))
***************
*** 856,866 ****
;; For Darwin nothing except UTF-8 makes sense.
(when (eq system-type 'darwin)
! (add-hook 'before-init-hook
! #'(lambda ()
! (setq locale-coding-system 'utf-8-unix)
! (setq default-process-coding-system
! '(utf-8-unix . utf-8-unix)))))
;; Mac OS X Lion introduces PressAndHold, which is unsupported by this port.
;; See this thread for more details:
--- 954,964 ----
;; For Darwin nothing except UTF-8 makes sense.
(when (eq system-type 'darwin)
! (add-hook 'before-init-hook
! #'(lambda ()
! (setq locale-coding-system 'utf-8-unix)
! (setq default-process-coding-system
! '(utf-8-unix . utf-8-unix)))))
;; Mac OS X Lion introduces PressAndHold, which is unsupported by this port.
;; See this thread for more details:
***************
*** 889,910 ****
(declare-function ns-get-selection "nsselect.m" (selection-symbol target-type))
(cl-defmethod gui-backend-set-selection (selection value
! &context (window-system ns))
(if value (ns-own-selection-internal selection value)
(ns-disown-selection-internal selection)))
(cl-defmethod gui-backend-selection-owner-p (selection
! &context (window-system ns))
(ns-selection-owner-p selection))
(cl-defmethod gui-backend-selection-exists-p (selection
! &context (window-system ns))
(ns-selection-exists-p selection))
(cl-defmethod gui-backend-get-selection (selection-symbol target-type
! &context (window-system ns))
(ns-get-selection selection-symbol target-type))
(provide 'ns-win)
(provide 'term/ns-win)
--- 987,1539 ----
(declare-function ns-get-selection "nsselect.m" (selection-symbol target-type))
(cl-defmethod gui-backend-set-selection (selection value
! &context (window-system ns))
(if value (ns-own-selection-internal selection value)
(ns-disown-selection-internal selection)))
(cl-defmethod gui-backend-selection-owner-p (selection
! &context (window-system ns))
(ns-selection-owner-p selection))