-
Notifications
You must be signed in to change notification settings - Fork 42
/
SKK-MK
940 lines (827 loc) · 27.9 KB
/
SKK-MK
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
;;; SKK-MK --- installer for SKK -*- mode: emacs-lisp; coding: iso-2022-jp -*-
;; Copyright (C) 1999, 2000 NAKAJIMA Mikio <[email protected]>
;; Copyright (C) 2003-2020 SKK Development Team
;; Author: NAKAJIMA Mikio <[email protected]>
;; Maintainer: SKK Development Team
;; URL: https://github.com/skk-dev/ddskk
;; This file is part of Daredevil SKK.
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of
;; the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be
;; useful, but WITHOUT ANY WARRANTY; without even the implied
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE. See the GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Those values of variables below are default configurations.
;; If you would like to change some of those, you should edit SKK-CFG.
;;
;; DO NOT EDIT THIS FILE DIRECTLY!
;;
;; Variable sections are all three parts. GENERIC VARIABLE section,
;; NON-PACKAGE INSTALL RELATED VARIABLE section, and PACKAGE INSTALL
;; RELATED VARIABLE section.
;;
;; You can confirm target directories without an actual installation
;; by M-x SKK-MK-what-where or M-x SKK-MK-what-where-package after
;; load this program.
;;; Code:
(when (featurep 'xemacs)
(error "%s" "\
XEmacs is not supported.\n"))
(when (string-lessp emacs-version "19")
(error "%s" "\
Emacs 18 or older is not supported by this version of SKK.
Try ddskk-e18 branch"))
(when (string-lessp emacs-version "20.3")
(error "%s" "\
Emacs 20.2 and Mule 2.3 (Emacs 19) is not supported by this version of SKK.
Please install Daredevil SKK 11.6.0"))
(when (string-lessp emacs-version "21.0")
(error "%s" "\
Emacs 20.7 is not supported by this version of SKK.
Please install Daredevil SKK 13.1 or 14.1"))
(when (string-lessp emacs-version "22.0")
(error "%s" "\
GNU Emacs 21 is not supported by this version of SKK.
Please install Daredevil SKK 14.4"))
(when (string-lessp emacs-version "23.0")
(error "%s" "\
GNU Emacs 22 is not supported by this version of SKK.
Please install Daredevil SKK 16.1"))
(when (string-lessp emacs-version "24.3")
(error "%s" "\
GNU Emacs 23, 24.2 is not supported by this version of SKK.
Please install Daredevil SKK 16.3"))
(unless (featurep 'mule)
(error "%s" "\
This version of SKK requires MULE features"))
(set-language-environment "Japanese")
;; Variables.
(defvar PREFIX nil)
(defvar LISPDIR nil)
(defvar VERSION_SPECIFIC_LISPDIR nil)
(defvar ADDITIONAL_LISPDIR nil)
(defvar EMACS_SELF_CONTAINED nil)
;; load user custom file.
(load (expand-file-name "./SKK-CFG") t nil nil)
(require 'install (expand-file-name
(convert-standard-filename "maint/install.el")))
(setq install-prefix
(cond ((eq system-type 'windows-nt)
;; Meadow $B$H(B NTEmacs $B$O<+8J407k7?!#$3$l$i$KBP$7$F(B APEL $B$,I8=`$G(B
;; $B@_Dj$9$k(B install-prefix $B$OIT<+A3$J$N$G!"$3$3$G=$@5$9$k!#(B
(setq EMACS_SELF_CONTAINED t)
(if (string-match "libexec" exec-directory)
(expand-file-name "share/emacs"
(expand-file-name "../../../../" exec-directory))
(expand-file-name ".." exec-directory)))
((eq system-type 'darwin)
;; Mac OS X (Carbon emacs, Cocoa Emacs $B$^$?$O(B OS $BIUB0$N(B Emacs)
;; $B$G(B DDSKK $B$r(B build $B$9$k>l9g$O<+8J407k7?$+$I$&$+$rA*$Y$k!#(B
;; $B%f!<%6$,<+8J407k7?$r;H$C$F$$$k$+$I$&$+D4$Y$k!#(B
(let ((dir (expand-file-name ".." data-directory)))
(if (string-match "/.+\\.app/Contents/Resources/?$" dir)
;; $B<+8J407k7?(B
(progn
(setq EMACS_SELF_CONTAINED t)
dir)
;; UNIX $BE*4D6-$HF1MM(B
(expand-file-name "../../../.." data-directory))))
(t
(expand-file-name "../../../.." data-directory))))
;;;; User variables to control SKK-MK.
(defvar SKK-MK-debugging nil "*Non-nil means making verbose output.")
;;;; load-path related.
(setq load-path (cons (expand-file-name ".") load-path))
;; $BJQ?t(B install-prefix $B$O(B install.el $B$GDj5A$5$l$F$*$j!"(B
;; $B$=$NCM$O(B UNIX $BE*4D6-$G$O(B "/usr/local" $B$N$h$&$JCM$H$J$k!#(B
;; $BHs(B UNIX $BE*4D6-$N$?$a$K>e5-$N(B setq $B$G(B install-prefix $B$r:F@_Dj$7$F$$$k!#(B
;; $BHs(B UNIX $BE*4D6-$G$ODL>o<+8J407k7?(B (self-contained) $B$N%U%!%$%kG[CV$r(B
;; $B$H$k!#$3$N>l9g!"FCDj$N%G%#%l%/%H%j2<$K(B etc, info, lisp, site-lisp
;; $B$J$I$N%G%#%l%/%H%j$,A4$F4^$^$l$F$$$k!#(B
;; ($B<B$O(B Emacs 18 $B$^$G$O(B UNIX $B4D6-$G$b<+8J407k7?$G$"$C$?!#(B)
(unless PREFIX
(setq PREFIX install-prefix))
(unless LISPDIR
(setq LISPDIR
(cond (EMACS_SELF_CONTAINED
;; Meadow, NTEmacs, Carbon Emacs, Cocoa Emacs
(expand-file-name "site-lisp" PREFIX))
(t
(install-detect-elisp-directory PREFIX)))))
(when (stringp LISPDIR)
(setq LISPDIR (expand-file-name LISPDIR))
(when (file-directory-p LISPDIR)
(add-to-list 'load-path LISPDIR)))
(unless VERSION_SPECIFIC_LISPDIR
(setq VERSION_SPECIFIC_LISPDIR
(cond (EMACS_SELF_CONTAINED
;; Meadow, NTEmacs, Carbon Emacs, Cocoa Emacs
(expand-file-name "site-lisp" PREFIX))
(t
(install-detect-elisp-directory
PREFIX nil 'version-specific)))))
(when (stringp VERSION_SPECIFIC_LISPDIR)
(setq VERSION_SPECIFIC_LISPDIR (expand-file-name VERSION_SPECIFIC_LISPDIR))
(when (file-directory-p VERSION_SPECIFIC_LISPDIR)
(add-to-list 'load-path VERSION_SPECIFIC_LISPDIR)))
(when (stringp ADDITIONAL_LISPDIR)
(setq ADDITIONAL_LISPDIR (expand-file-name ADDITIONAL_LISPDIR))
(when (file-directory-p ADDITIONAL_LISPDIR)
(add-to-list 'load-path VERSION_SPECIFIC_LISPDIR)))
(when SKK-MK-debugging
(princ (format "load-path=%s\n" load-path)))
;; constants.
(defconst SKK-MK-texinfo-coding-system 'iso-2022-7bit)
;; GENERIC VARIABLE.
(defvar DOCDIR "./doc")
(defvar ETCDIR "./etc")
(defvar DICDIR "./dic")
(defvar SKK_PREFIX "skk")
(defvar SKK_INFO "skk.info")
(defvar SKK_INFO_DIR_FILE nil)
(defvar SKK_TEXIS '("skk.texi"))
(defvar SKK_TUTORIALS '("SKK.tut" "SKK.tut.E" "NICOLA-SKK.tut" "skk.xpm"))
(defvar SKK_DICTIONARIES
'("SKK-JISYO.L" "SKK-JISYO.ML" "SKK-JISYO.M" "SKK-JISYO.S" "SKK-JISYO.JIS2"
"SKK-JISYO.JIS3_4" "SKK-JISYO.pubdic+" "SKK-JISYO.edict"
"SKK-JISYO.okinawa" "SKK-JISYO.geo" "SKK-JISYO.jinmei" "SKK-JISYO.law"
"SKK-JISYO.mazegaki" "SKK-JISYO.assoc" "SKK-JISYO.itaiji"
"SKK-JISYO.itaiji.JIS3_4" "SKK-JISYO.china_taiwan"
"SKK-JISYO.propernoun" "SKK-JISYO.station" "SKK-JISYO.requested"
"SKK-JISYO.fullname" "SKK-JISYO.JIS2004"
"SKK-JISYO.office.zipcode" "SKK-JISYO.zipcode" "SKK-JISYO.lisp"))
(setq SKK_DICTIONARIES
(append SKK_DICTIONARIES
(mapcar (lambda (dic)
(format "%s.cdb" dic))
SKK_DICTIONARIES)))
(defvar SKK_DEFAULT_JISYO nil)
(defvar SKK_MODULES
;; $B$3$s$J$b$s%3%^%s%I%i%$%s$G;XDj$9$k?M$$$J$$$h$M!)(B
(let ((list '(ccc
cdb
context-skk
skk-abbrev
skk-act
skk-annotation
skk-auto
skk-autoloads
skk-azik
skk-bayesian
skk-cdb
skk-comp
skk-cursor
skk-cus
skk-dcomp
skk-decor
skk-develop
skk-emacs
skk-gadget
skk-hint
skk-inline
skk-isearch
skk-jisx0201
skk-jisyo-edit-mode
skk-kakasi
skk-kcode
skk-leim
skk-look
skk-macs
skk-num
skk-search-web
skk-server-completion
skk-server
skk-show-mode
skk-sticky
skk-study
skk-tankan
skk-tut
skk-vars
skk-version
skk
tar-util
;; EXPERIMENTAL
skk-correct
skk-exsearch
skk-exserv
skk-pre-henkan
skk-rdbms
skk-tutcdef
skk-tutcode
skk-w3m
;; VIP 3.7
;; vip
)))
;; skk-jisx0213.el
(when (or (coding-system-p 'euc-jisx0213)
(and (fboundp 'find-coding-system)
(find-coding-system 'euc-jisx0213))
(condition-case nil
(and (require 'jisx0213) ; Mule-UCS
(require 'un-define)) ; Mule-UCS
(error)))
(add-to-list 'list 'skk-jisx0213))
;; skk-lookup.el
(when (condition-case nil
;; you might have to add lookup installed directory
;; to `load-path'.
(let ((lookup-byte-compile t))
(require 'lookup))
(error))
(add-to-list 'list 'skk-lookup))
(when (condition-case nil
(require 'viper)
(error))
(add-to-list 'list 'skk-viper))
;;
list))
;; $B>C$5$J$/$H$b%$%s%9%H!<%k>e$OLdBj$,$J$$$,!"(Bwhat-where $B$K$F%$%s%9%H!<%k$5$l$J(B
;; $B$$%W%m%0%i%`$,I=<($5$l$k$N$rKI$0$?$a!"%H%C%W%G%#%l%/%H%j$K$J$$%W%m%0%i%`$O(B
;; $B>C$7$F$*$/!#(B
(let ((modules SKK_MODULES))
(while modules
(unless (or
;; skk-autoloads.el $B$O<+F0@8@.$5$l$k$N$G$^$@B8:_$7$J$$!#(B
(memq (car modules) '(skk-autoloads))
(file-exists-p (concat (symbol-name (car modules))
".el")))
(setq SKK_MODULES (delq (car modules) SKK_MODULES)))
(setq modules (cdr modules))))
(defun SKK-MK-server-installed-p ()
;; Check whether we can talk to the server.
(require 'skk-server (expand-file-name "skk-server.el"))
(let ((skk-server-inhibit-startup-server t))
(condition-case nil
(prog1
(skk-server-live-p (skk-open-server))
(skk-disconnect-server))
(error))))
(defvar SKK_SET_JISYO (not (SKK-MK-server-installed-p)))
;; NON-PACKAGE INSTALL RELATED VARIABLE.
(defvar SKK_DATADIR
(cond ((and (eq system-type 'windows-nt)
(string-match "libexec" exec-directory))
(expand-file-name "skk" data-directory))
(t
(let ((subdir (cond (EMACS_SELF_CONTAINED
;; Meadow, NTEmacs, Carbon Emacs, Cocoa Emacs
"etc")
(t
"share"))))
(expand-file-name SKK_PREFIX (expand-file-name subdir PREFIX))))))
(defvar SKK_INFODIR
(cond ((file-directory-p
(expand-file-name "info" (expand-file-name "share" PREFIX)))
(expand-file-name "info" (expand-file-name "share" PREFIX)))
((file-directory-p (expand-file-name "info" PREFIX))
(expand-file-name "info" PREFIX))
((file-directory-p
(expand-file-name "info" (expand-file-name ".." PREFIX)))
(expand-file-name "info" (expand-file-name ".." PREFIX)))
(t
(let ((list Info-default-directory-list)
dir)
(while (and (not dir)
list)
(when (file-directory-p (car list))
(setq dir (car list)))
(setq list (cdr list)))
dir)))
(expand-file-name "info" PREFIX))
(defvar SKK_LISPDIR
(cond
(VERSION_SPECIFIC_LISPDIR
(expand-file-name SKK_PREFIX VERSION_SPECIFIC_LISPDIR))
(PREFIX
(expand-file-name SKK_PREFIX
(install-detect-elisp-directory
PREFIX)))
(t
nil)))
(defconst SKK_DAREDEVIL_NOT_USE '(skk-vip
skk-foreword
stack-m
skk-cursor2
skk-cursor3))
(when SKK-MK-debugging
(princ (format "SKK_MODULES=%s\n" SKK_MODULES)))
;; This code is for skk-jisx0201.el.
(when (fboundp 'make-translation-table) ;; FSF Emacs 20.3 or later
(setq standard-translation-table-for-decode
(make-translation-table nil)))
;;; [FUNCTIONS]
(defun SKK-MK-make-setup-file (spec)
;; SPEC $B$O8rBe%j%9%H!#(B
(with-temp-buffer
(save-excursion
(insert-file-contents "skk-setup.el.in")
(goto-char (point-min))
(when (looking-at ";;; -\\*- emacs-lisp -\\*-")
(delete-region (point) (progn
(forward-line 1)
(point))))
(when (search-forward ";;; skk-setup.el --- initial setup for SKK")
(forward-line 1)
(insert ";; This file was generated automatically by SKK-MK at "
(current-time-string)
"\n"))
(while spec
(goto-char (point-min))
(while (re-search-forward (concat "^;;[^@]+\\(" (car spec) "\\)")
nil t nil)
(delete-region (match-beginning 1)
(match-end 1))
(insert (nth 1 spec))
(beginning-of-line)
(while (looking-at ";")
(delete-char 1)))
(setq spec (nthcdr 2 spec)))
(write-region (point-min) (point-max) "skk-setup.el"))))
(defun SKK-MK-compile ()
(let (enable-local-eval)
(SKK-MK-generate-autoloads-el)
;; (load (expand-file-name "skk-autoloads.el"))
;; (require 'skk (expand-file-name "skk.el"))
(compile-elisp-modules SKK_MODULES
(expand-file-name "."))))
(defun SKK-MK-compile-info ()
(when (and SKK_INFO
(or (not (file-exists-p
(expand-file-name SKK_INFO DOCDIR)))
(file-newer-than-file-p
(expand-file-name (car SKK_TEXIS) DOCDIR)
(expand-file-name SKK_INFO DOCDIR))))
(SKK-MK-texinfo-format SKK_TEXIS)))
(defun SKK-MK-install ()
(SKK-MK-install-elc)
(SKK-MK-install-info))
(defun SKK-MK-install-elc ()
(let ((dics SKK_DICTIONARIES)
;;standard-output
delete-target exists spec)
;; make target directories.
(setq DOCDIR (expand-file-name DOCDIR)
ETCDIR (expand-file-name ETCDIR)
DICDIR (expand-file-name DICDIR))
(unless (file-exists-p SKK_LISPDIR)
(make-directory SKK_LISPDIR t))
(unless (file-exists-p SKK_DATADIR)
(make-directory SKK_DATADIR t))
;; delete already installed unnecessary files.
(while SKK_DAREDEVIL_NOT_USE
(setq SKK_MODULES (delq (car SKK_DAREDEVIL_NOT_USE)
SKK_MODULES)
delete-target (expand-file-name
(concat (prin1-to-string
(car SKK_DAREDEVIL_NOT_USE))
".el")
SKK_LISPDIR)
SKK_DAREDEVIL_NOT_USE (cdr SKK_DAREDEVIL_NOT_USE))
(when (file-exists-p delete-target)
(delete-file delete-target))
(setq delete-target (concat delete-target "c"))
(when (file-exists-p delete-target)
(delete-file delete-target)))
;; install Emacs Lisp programs.
(SKK-MK-compile)
(install-elisp-modules SKK_MODULES "." SKK_LISPDIR)
(delete-file "./skk-autoloads.el")
;; make skk-setup.el.
(while dics
(when (file-exists-p (expand-file-name (car dics) DICDIR))
(setq exists (cons (car dics) exists)))
(setq dics (cdr dics)))
(setq SKK_DICTIONARIES exists)
;; move existing largest dictionay to car of `SKK_DICTIONARIES'.
(when (member "SKK-JISYO.M" SKK_DICTIONARIES)
(setq SKK_DICTIONARIES
(cons "SKK-JISYO.M"
(delete "SKK-JISYO.M"
SKK_DICTIONARIES))))
(when (member "SKK-JISYO.ML" SKK_DICTIONARIES)
(setq SKK_DICTIONARIES
(cons "SKK-JISYO.ML"
(delete "SKK-JISYO.ML"
SKK_DICTIONARIES))))
(when (member "SKK-JISYO.L" SKK_DICTIONARIES)
(setq SKK_DICTIONARIES
(cons "SKK-JISYO.L"
(delete "SKK-JISYO.L"
SKK_DICTIONARIES))))
(when SKK_TUTORIALS
(setq spec (append
spec
(list "@TUT@"
(expand-file-name
(car SKK_TUTORIALS) SKK_DATADIR)))))
(cond
(SKK_DICTIONARIES
(setq spec
(append spec
(list "@AUXDIC@"
(expand-file-name
(car SKK_DICTIONARIES) SKK_DATADIR))))
(when SKK_SET_JISYO
(setq spec
(append spec
(list
"@DIC@"
(expand-file-name
(car SKK_DICTIONARIES) SKK_DATADIR))))))
(t
;; when dictionaries do not exist in ./dic subdirectory, check
;; already installed dictionary and detect largest one to setup
;; skk-setup.el.in.
(setq dics '("SKK-JISYO.L"
"SKK-JISYO.ML"
"SKK-JISYO.M"
"SKK-JISYO.S"))
(while (and dics
(not (file-exists-p (expand-file-name
(car dics)
SKK_DATADIR))))
(setq dics (cdr dics)))
(when dics
(setq spec
(append spec
(list "@AUXDIC@"
(expand-file-name
(car dics)
SKK_DATADIR))))
(when SKK_SET_JISYO
(setq spec
(append spec
(list "@DIC@"
(expand-file-name
(car dics)
SKK_DATADIR))))))))
(if (not spec)
;; merely copy without setup dictionary information.
(copy-file "skk-setup.el.in"
"skk-setup.el"
'ok-if-already-exists)
(SKK-MK-make-setup-file spec))
(when SKK_DICTIONARIES
;; install dictionaries if the files exist in ./dic directory.
(install-files SKK_DICTIONARIES
DICDIR
SKK_DATADIR
nil t nil))
(copy-file "./leim-list.el.in"
"./leim-list.el"
'overwrite)
(install-elisp-modules (list 'leim-list)
"."
SKK_LISPDIR)
(delete-file "./leim-list.el")
;; install skk-setup.el
(install-elisp-modules (list 'skk-setup) "." SKK_LISPDIR)
;; install tutorials.
(install-files SKK_TUTORIALS ETCDIR SKK_DATADIR nil t nil)
(SKK-MK-detect-shadow-directory)))
(defun SKK-MK-detect-shadow-directory ()
(condition-case nil
(progn
(require 'shadow)
(save-match-data
(let ((list (find-emacs-lisp-shadows load-path))
shadowed)
(while list
(if (and (string-match "skk-autoloads"
(car list))
(setq list (cdr list))
(string-match "skk-autoloads"
(car list)))
(setq shadowed
(substring
(file-name-directory (car list))
0 -1)
list nil))
(setq list (cdr list)))
(when shadowed
(princ (format "\
** WARNING ** %s is shadowed. You might want to remove it
"
shadowed))))))
(error)))
(defun SKK-MK-install-info ()
(when SKK_INFO
(unless (file-exists-p SKK_INFODIR)
(make-directory SKK_INFODIR t))
(SKK-MK-compile-info)
(install-files (list SKK_INFO) ;defun in install.el
DOCDIR
SKK_INFODIR
nil t nil)
(when noninteractive
(SKK-MK-install-info-1))))
(defun SKK-MK-install-info-1 ()
"Updates info/dir entries."
(when SKK_INFO
;; updates info/dir entries.
(require 'install-info (expand-file-name "./maint/install-info.el"))
(let ((info-file (expand-file-name SKK_INFO
SKK_INFODIR))
(dir-file (cond
((file-exists-p (expand-file-name "dir" SKK_INFODIR))
(expand-file-name "dir" SKK_INFODIR))
((file-exists-p (expand-file-name "dir.info" SKK_INFODIR))
(expand-file-name "dir.info" SKK_INFODIR))
(t
(expand-file-name "dir" SKK_INFODIR)))))
(when (file-readable-p dir-file)
(install-info info-file dir-file nil nil 'delete))
(install-info info-file dir-file nil nil nil)
(setq SKK_INFO_DIR_FILE dir-file))))
;;; 2014-12-31, skk.texi $B$r(B utf-8 $B$H$7$?$3$H$KH<$$!"ITMW$H$J$C$?$,!"(B
;;; $B>-MhE*$K(B pre-format $B$rMW$9$k$3$H$,9M$($i$l$k$?$a!"OHAH$_$O;D$9!#(B
(defun SKK-MK-texinfo-pre-format ()
;; http://mail.ring.gr.jp/skk/201112/msg00023.html
;; (unless (and (featurep 'emacs)
;; (>= emacs-major-version 23))
;; (dolist (str '("\C-[$(Q\"1\C-[(B" "\C-[$(Q\"Q\C-[(B" "\C-[$(Q\"q\C-[(B"))
;; (goto-char (point-min))
;; (when (search-forward str nil t)
;; (replace-match " "))))
nil)
(defun SKK-MK-texinfo-post-format ()
(goto-char (point-min))
(when (re-search-forward "-\\*-Text-\\*-" (point-at-eol) t)
(replace-match (format "-*- mode: text; coding: %s -*-"
SKK-MK-texinfo-coding-system))))
(defun SKK-MK-texinfo-format (targets)
(let (;; Emacs20.2's default is 'raw-text-unix.
(coding-system-for-write SKK-MK-texinfo-coding-system)
(make-backup-files nil)
x obuf beg standard-output)
(require 'ptexinfmt (expand-file-name
(convert-standard-filename "maint/ptexinfmt.el")))
(while targets
(setq x (expand-file-name (car targets) DOCDIR))
(find-file x)
(setq obuf (current-buffer))
(SKK-MK-texinfo-pre-format)
(texinfo-every-node-update)
(texinfo-format-buffer 'nosplit)
(SKK-MK-texinfo-post-format)
(basic-save-buffer)
(kill-buffer (current-buffer)) ; .info buffer
(set-buffer-modified-p nil) ; .texi buffer
(kill-buffer obuf) ; .texi buffer
(setq targets (cdr targets)))))
(defun SKK-MK-uninstall ()
(dolist (f (directory-files SKK_LISPDIR t ".el"))
(delete-file f))
(princ (format "Delete files in %s...done\n" SKK_LISPDIR))
(delete-directory SKK_LISPDIR)
(princ (format "Delete directory %s...done\n" SKK_LISPDIR))
(delete-file (expand-file-name SKK_INFO SKK_INFODIR))
(princ (format "Delete %s file in %s...done\n" SKK_INFO SKK_INFODIR))
(dolist (f SKK_TUTORIALS)
(let ((fullpath (expand-file-name f SKK_DATADIR)))
(delete-file fullpath)
(princ (format "Delete %s...done\n" fullpath)))))
(defun SKK-MK-what-where ()
(interactive)
(let ((dics SKK_DICTIONARIES)
exists)
(while dics
(when (file-exists-p (expand-file-name (car dics) DICDIR))
(setq exists (cons (car dics) exists)))
(setq dics (cdr dics)))
(setq SKK_DICTIONARIES exists))
(let ((string
(format "
Running in:
%s
SKK modules:
%s
-> %s
SKK infos:
%s
-> %s
SKK tutorials:
%s
-> %s
"
(version)
(mapconcat 'symbol-name SKK_MODULES ", ")
SKK_LISPDIR
SKK_INFO
SKK_INFODIR
(mapconcat 'identity SKK_TUTORIALS ", ")
SKK_DATADIR)))
(when SKK_DICTIONARIES
(setq string (concat string
(format "
SKK dictionaries:
%s
-> %s
"
(mapconcat 'identity SKK_DICTIONARIES ", ")
SKK_DATADIR))))
(if noninteractive
(princ string)
(progn
(with-output-to-temp-buffer
"*What where*" (princ string))
(message "")))))
(defun SKK-MK-generate-autoloads-el ()
"Generate skk-autoload.el."
(let ((modules SKK_MODULES)
(buf (get-buffer-create
" *SKK-MK-generate-autoloads-el*"))
(sort-min)
(funcs)
standard-output)
(save-excursion
(set-buffer buf)
(erase-buffer)
(insert "\
;;; skk-autoloads.el --- autoload settings for SKK -*- coding: iso-2022-jp -*-
;; This file was generated automatically by SKK-MK at "
(current-time-string)
".
;; This file is part of Daredevil SKK.
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3 of
;; the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be
;; useful,but WITHOUT ANY WARRANTY; without even the implied
;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
;; PURPOSE. See the GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Code:\n\n")
(require 'autoload)
(setq buffer-file-name "skk-autoloads.el")
(while modules
(let ((file (expand-file-name
(format "%s.el" (car modules)))))
(when (file-exists-p file)
(generate-file-autoloads file)))
(setq modules (cdr modules)))
(goto-char (point-max))
(insert "(provide 'skk-autoloads)
;;; skk-autoloads.el ends here
")
(let ((coding-system-for-write 'iso-2022-jp))
(write-region (point-min) (point-max) "skk-autoloads.el" nil 'quiet))
(set-buffer-modified-p nil)
(kill-buffer buf))))
;;; DDSKK Interactive Installer (Jan 2011)
;;; Lookup $B$N(B install.el $B$r;29M$K$5$;$F$$$?$@$-$^$7$?!#(B
(defun install-check-directory (directory)
(and (not (file-exists-p directory))
(y-or-n-p (format "Directory %s is not exist. Create it? " directory))
(make-directory directory t))
(if (not (file-directory-p directory))
(error "%s is not directory" directory))
(directory-file-name (expand-file-name directory)))
(defvar VERSION-STRING nil)
(if noninteractive
nil
(setq VERSION-STRING
(let (start)
(with-temp-buffer
(insert-file-contents "skk-version.el")
(goto-char (point-min))
(search-forward "ver ")
(forward-char)
(setq start (point))
(search-forward (char-to-string 34))
(buffer-substring start (1- (point)))))))
(if noninteractive
nil
(switch-to-buffer (generate-new-buffer "*DDSKK Installer*"))
(insert (version))
(insert "\n===================\n")
(insert "DDSKK $B%$%s%9%H!<%i(B\n")
(insert "===================\n\n")
(insert "DDSKK "
VERSION-STRING
" $B$N%$%s%9%H!<%k$r;O$a$^$9!#(B\n")
(insert "C-g $B$r%?%$%W$9$k$H!"$$$D$G$bCfCG$G$-$^$9!#(B\n\n")
(insert "$B$3$N%?%$%_%s%0$G<-=q%U%!%$%k$r%@%&%s%m!<%I$9$k$3$H$b$G$-$^$9!#(B:\n")
(when (yes-or-no-p "$B%@%&%s%m!<%I$7$^$9$+!)(B ")
(load-file (expand-file-name "./skk-develop.el"))
(skk-get (expand-file-name "./dic"))
(insert (format "
%s
-> %s
"
(mapconcat #'identity
(directory-files (expand-file-name "./dic/") nil "SKK")
", ")
(expand-file-name "./dic")
)))
(insert "DDSKK $B$N%$%s%9%H!<%k@h$rF~NO$7$F$/$@$5$$(B:\n")
(setq SKK_LISPDIR (install-check-directory
(read-file-name "SKK_LISPDIR: " SKK_LISPDIR SKK_LISPDIR)))
(insert " => " SKK_LISPDIR "\n\n") (sit-for 0)
(insert "Info $B%U%!%$%k$rCV$/%G%#%l%/%H%j$rF~NO$7$F$/$@$5$$(B:\n")
(setq SKK_INFODIR (install-check-directory
(read-file-name "SKK_INFODIR: " SKK_INFODIR SKK_INFODIR)))
(insert " => " SKK_INFODIR "\n\n") (sit-for 0)
(insert "$B%A%e!<%H%j%"%k!&%U%!%$%k$rCV$/%G%#%l%/%H%j$rF~NO$7$F$/$@$5$$(B:\n")
(setq SKK_DATADIR (install-check-directory
(read-file-name "SKK_DATADIR: " SKK_DATADIR SKK_DATADIR)))
(insert " => " SKK_DATADIR "\n\n") (sit-for 0)
(insert "$B3NG'$7$F$/$@$5$$!#(B\n")
(insert (format "SKK modules: %s\n => %s\n\n"
(mapconcat 'symbol-name SKK_MODULES ", ")
SKK_LISPDIR))
(insert (format "SKK infos: %s\n => %s\n\n"
SKK_INFO
SKK_INFODIR))
(insert (format "SKK tutorials: %s\n => %s\n\n"
(mapconcat 'identity SKK_TUTORIALS ", ")
SKK_DATADIR))
(let ((dics SKK_DICTIONARIES)
exists)
(while dics
(when (file-exists-p (expand-file-name (car dics) DICDIR))
(setq exists (cons (car dics) exists)))
(setq dics (cdr dics)))
(insert (format "SKK dictionaries: %s\n => %s\n\n"
(mapconcat 'identity exists ", ")
SKK_DATADIR)))
(insert "$B3F%G%#%l%/%H%j$rD{@5$9$k$K$O!"$3$N%$%s%9%H!<%i$rCfCG!J(BC-g $B$r%?%$%W!K$7$F:G=i$+$i$d$jD>$7$F$/$@$5$$!J(BSKK-CFG $B$G@_Dj$9$k$3$H$b2DG=$G$9!K!#(B\n")
(if (yes-or-no-p "$B%$%s%9%H!<%k$rB39T$7$^$9$+!)(B ")
nil
(error "$B%$%s%9%H!<%k$rCfCG$7$^$7$?!#(B")))
;; SKK-MK-compile
(if noninteractive
nil
(let (enable-local-eval)
(insert "skk-autoloads.el $B$r@[email protected](B...") (sit-for 0)
(SKK-MK-generate-autoloads-el)
(insert "done\n")
(insert "skk-autoloads.el $B$rFI$_9~$_Cf(B...") (sit-for 0)
(load (expand-file-name "skk-autoloads.el"))
(insert "done\n")
(insert "skk.el $B$rFI$_9~$_Cf(B...") (sit-for 0)
(require 'skk (expand-file-name "skk.el"))
(insert "done\n")
(insert "elisp $B%U%!%$%k$N%3%s%Q%$%kCf(B...") (sit-for 0)
(compile-elisp-modules SKK_MODULES
(expand-file-name "."))
(switch-to-buffer (get-buffer "*DDSKK Installer*"))
(insert "done\n")))
;; SKK-MK-install
;; SKK-MK-install-elc
(if noninteractive
nil
(insert "elisp $B%U%!%$%k$N%$%s%9%H!<%kCf(B...") (sit-for 0)
(SKK-MK-install-elc)
(switch-to-buffer (get-buffer "*DDSKK Installer*"))
(insert "done\n"))
;; SKK-MK-install-info
(if noninteractive
nil
(insert "info $B$N%$%s%9%H!<%kCf(B...") (sit-for 0)
(SKK-MK-install-info)
(insert "done\n")
(insert "info/dir $B%N!<%IDI2CCf(B...") (sit-for 0)
(SKK-MK-install-info-1)
(insert "done\n"))
;; Congratulations!
(if noninteractive
nil
(insert "\n\nCongratulations!\nDDSKK $B$N%$%s%9%H!<%k$,40N;$7$^$7$?!#(B
load-path $B$N@_Dj(B
----------------
$B<!$N$H$*$j(B $BJQ?t(B load-path $B$r@_Dj$7$F$/$@$5$$!#4{$K%Q%9$,DL$C$F$$$k$J$i$P(B
$BITMW$G$9!#(B
(setq load-path (cons \"" SKK_LISPDIR "\" load-path))
info $B%G%#%l%/%H%j$N@_Dj(B
-----------------------
$B<!$N$H$*$j(B $BJQ?t(B Info-default-directory-list $B$r@_Dj$7$F$/$@$5$$!#4{$K%Q%9(B
$B$,DL$C$F$$$k$J$i$PITMW$G$9!#(B
(setq Info-default-directory-list
(cons \"" SKK_INFODIR "\" Info-default-directory-list))
$B%G%#%l%/%H%j%U%!%$%k(B " SKK_INFO_DIR_FILE " $B$X$N%N!<%IDI2C$O40N;$7$F$$$^$9!#(B
Emacs $B$N@_Dj(B
------------
$B>e5-$N@_DjFbMF$r(B ~/.emacs $B$K5-:\$7$F(B Emacs $B$r:F5/F0$9$l$P(B DDSKK $B$r;HMQ$9(B
$B$k$3$H$,$G$-$k$O$:$G$9!#(B
$B$b$7(B DDSKK $B$,5/F0$7$J$$$h$&$G$"$l$P(B ~/.emacs $B$K(B
(require 'skk-autoloads)
$B$H5-:\$7$F!"$"$i$?$a$F(B Emacs $B$r:F5/F0$7$F$/$@$5$$!#(B
DDSKK $B$N@_Dj(B
------------
etc/dot.emacs $B$H(B etc/dot.skk $B$K@_DjNc$,5s$2$i$l$F$$$^$9$N$G;29M$K$7$F$/$@$5$$!#(B
Info $B$b$*FI$_$/$@$5$$!#(B
"))
(if noninteractive
nil
(delete-other-windows)
(recenter -1)
(remove-hook 'kill-emacs-hook 'skk-save-jisyo))
;;; SKK-MK ends here