Debian Codegraph @

SKK-MK

raw
1 ;;; SKK-MK --- installer for SKK -*- mode: emacs-lisp; coding: iso-2022-jp -*-
2
3 ;; Copyright (C) 1999, 2000 NAKAJIMA Mikio <[email protected]>
4 ;; Copyright (C) 2003-2020 SKK Development Team
5
6 ;; Author: NAKAJIMA Mikio <[email protected]>
7 ;; Maintainer: SKK Development Team
8 ;; URL: https://github.com/skk-dev/ddskk
9
10 ;; This file is part of Daredevil SKK.
11
12 ;; This program is free software: you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation, either version 3 of
15 ;; the License, or (at your option) any later version.
16
17 ;; This program is distributed in the hope that it will be
18 ;; useful, but WITHOUT ANY WARRANTY; without even the implied
19 ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 ;; PURPOSE. See the GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
24
25 ;;; Commentary:
26
27 ;; Those values of variables below are default configurations.
28 ;; If you would like to change some of those, you should edit SKK-CFG.
29 ;;
30 ;; DO NOT EDIT THIS FILE DIRECTLY!
31 ;;
32 ;; Variable sections are all three parts. GENERIC VARIABLE section,
33 ;; NON-PACKAGE INSTALL RELATED VARIABLE section, and PACKAGE INSTALL
34 ;; RELATED VARIABLE section.
35 ;;
36 ;; You can confirm target directories without an actual installation
37 ;; by M-x SKK-MK-what-where or M-x SKK-MK-what-where-package after
38 ;; load this program.
39
40 ;;; Code:
41
42 (when (featurep 'xemacs)
43 (error "%s" "\
44 XEmacs is not supported.\n"))
45
46 (when (string-lessp emacs-version "19")
47 (error "%s" "\
48 Emacs 18 or older is not supported by this version of SKK.
49 Try ddskk-e18 branch"))
50
51 (when (string-lessp emacs-version "20.3")
52 (error "%s" "\
53 Emacs 20.2 and Mule 2.3 (Emacs 19) is not supported by this version of SKK.
54 Please install Daredevil SKK 11.6.0"))
55
56 (when (string-lessp emacs-version "21.0")
57 (error "%s" "\
58 Emacs 20.7 is not supported by this version of SKK.
59 Please install Daredevil SKK 13.1 or 14.1"))
60
61 (when (string-lessp emacs-version "22.0")
62 (error "%s" "\
63 GNU Emacs 21 is not supported by this version of SKK.
64 Please install Daredevil SKK 14.4"))
65
66 (when (string-lessp emacs-version "23.0")
67 (error "%s" "\
68 GNU Emacs 22 is not supported by this version of SKK.
69 Please install Daredevil SKK 16.1"))
70
71 (when (string-lessp emacs-version "24.3")
72 (error "%s" "\
73 GNU Emacs 23, 24.2 is not supported by this version of SKK.
74 Please install Daredevil SKK 16.3"))
75
76 (unless (featurep 'mule)
77 (error "%s" "\
78 This version of SKK requires MULE features"))
79
80 (set-language-environment "Japanese")
81
82 ;; Variables.
83
84 (defvar PREFIX nil)
85
86 (defvar LISPDIR nil)
87
88 (defvar VERSION_SPECIFIC_LISPDIR nil)
89
90 (defvar ADDITIONAL_LISPDIR nil)
91
92 (defvar EMACS_SELF_CONTAINED nil)
93
94 ;; load user custom file.
95 (load (expand-file-name "./SKK-CFG") t nil nil)
96
97 (require 'install (expand-file-name
98 (convert-standard-filename "maint/install.el")))
99
100 (setq install-prefix
101 (cond ((eq system-type 'windows-nt)
102 ;; Meadow $B$H(B NTEmacs $B$O<+8J407k7?!#$3$l$i$KBP$7$F(B APEL $B$,I8=`$G(B
103 ;; $B@_Dj$9$k(B install-prefix $B$OIT<+A3$J$N$G!"$3$3$G=$@5$9$k!#(B
104 (setq EMACS_SELF_CONTAINED t)
105 (if (string-match "libexec" exec-directory)
106 (expand-file-name "share/emacs"
107 (expand-file-name "../../../../" exec-directory))
108 (expand-file-name ".." exec-directory)))
109
110 ((eq system-type 'darwin)
111 ;; Mac OS X (Carbon emacs, Cocoa Emacs $B$^$?$O(B OS $BIUB0$N(B Emacs)
112 ;; $B$G(B DDSKK $B$r(B build $B$9$k>l9g$O<+8J407k7?$+$I$&$+$rA*$Y$k!#(B
113 ;; $B%f!<%6$,<+8J407k7?$r;H$C$F$$$k$+$I$&$+D4$Y$k!#(B
114 (let ((dir (expand-file-name ".." data-directory)))
115 (if (string-match "/.+\\.app/Contents/Resources/?$" dir)
116 ;; $B<+8J407k7?(B
117 (progn
118 (setq EMACS_SELF_CONTAINED t)
119 dir)
120 ;; UNIX $BE*4D6-$HF1MM(B
121 (expand-file-name "../../../.." data-directory))))
122 (t
123 (expand-file-name "../../../.." data-directory))))
124
125 ;;;; User variables to control SKK-MK.
126 (defvar SKK-MK-debugging nil "*Non-nil means making verbose output.")
127
128 ;;;; load-path related.
129
130 (setq load-path (cons (expand-file-name ".") load-path))
131
132 ;; $BJQ?t(B install-prefix $B$O(B install.el $B$GDj5A$5$l$F$*$j!"(B
133 ;; $B$=$NCM$O(B UNIX $BE*4D6-$G$O(B "/usr/local" $B$N$h$&$JCM$H$J$k!#(B
134 ;; $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
135 ;; $BHs(B UNIX $BE*4D6-$G$ODL>o<+8J407k7?(B (self-contained) $B$N%U%!%$%kG[CV$r(B
136 ;; $B$H$k!#$3$N>l9g!"FCDj$N%G%#%l%/%H%j2<$K(B etc, info, lisp, site-lisp
137 ;; $B$J$I$N%G%#%l%/%H%j$,A4$F4^$^$l$F$$$k!#(B
138 ;; ($B<B$O(B Emacs 18 $B$^$G$O(B UNIX $B4D6-$G$b<+8J407k7?$G$"$C$?!#(B)
139 (unless PREFIX
140 (setq PREFIX install-prefix))
141
142 (unless LISPDIR
143 (setq LISPDIR
144 (cond (EMACS_SELF_CONTAINED
145 ;; Meadow, NTEmacs, Carbon Emacs, Cocoa Emacs
146 (expand-file-name "site-lisp" PREFIX))
147 (t
148 (install-detect-elisp-directory PREFIX)))))
149
150 (when (stringp LISPDIR)
151 (setq LISPDIR (expand-file-name LISPDIR))
152 (when (file-directory-p LISPDIR)
153 (add-to-list 'load-path LISPDIR)))
154
155 (unless VERSION_SPECIFIC_LISPDIR
156 (setq VERSION_SPECIFIC_LISPDIR
157 (cond (EMACS_SELF_CONTAINED
158 ;; Meadow, NTEmacs, Carbon Emacs, Cocoa Emacs
159 (expand-file-name "site-lisp" PREFIX))
160 (t
161 (install-detect-elisp-directory
162 PREFIX nil 'version-specific)))))
163
164 (when (stringp VERSION_SPECIFIC_LISPDIR)
165 (setq VERSION_SPECIFIC_LISPDIR (expand-file-name VERSION_SPECIFIC_LISPDIR))
166 (when (file-directory-p VERSION_SPECIFIC_LISPDIR)
167 (add-to-list 'load-path VERSION_SPECIFIC_LISPDIR)))
168
169 (when (stringp ADDITIONAL_LISPDIR)
170 (setq ADDITIONAL_LISPDIR (expand-file-name ADDITIONAL_LISPDIR))
171 (when (file-directory-p ADDITIONAL_LISPDIR)
172 (add-to-list 'load-path VERSION_SPECIFIC_LISPDIR)))
173
174 (when SKK-MK-debugging
175 (princ (format "load-path=%s\n" load-path)))
176
177 ;; constants.
178 (defconst SKK-MK-texinfo-coding-system 'iso-2022-7bit)
179
180 ;; GENERIC VARIABLE.
181 (defvar DOCDIR "./doc")
182 (defvar ETCDIR "./etc")
183 (defvar DICDIR "./dic")
184 (defvar SKK_PREFIX "skk")
185 (defvar SKK_INFO "skk.info")
186 (defvar SKK_INFO_DIR_FILE nil)
187 (defvar SKK_TEXIS '("skk.texi"))
188 (defvar SKK_TUTORIALS '("SKK.tut" "SKK.tut.E" "NICOLA-SKK.tut" "skk.xpm"))
189 (defvar SKK_DICTIONARIES
190 '("SKK-JISYO.L" "SKK-JISYO.ML" "SKK-JISYO.M" "SKK-JISYO.S" "SKK-JISYO.JIS2"
191 "SKK-JISYO.JIS3_4" "SKK-JISYO.pubdic+" "SKK-JISYO.edict"
192 "SKK-JISYO.okinawa" "SKK-JISYO.geo" "SKK-JISYO.jinmei" "SKK-JISYO.law"
193 "SKK-JISYO.mazegaki" "SKK-JISYO.assoc" "SKK-JISYO.itaiji"
194 "SKK-JISYO.itaiji.JIS3_4" "SKK-JISYO.china_taiwan"
195 "SKK-JISYO.propernoun" "SKK-JISYO.station" "SKK-JISYO.requested"
196 "SKK-JISYO.fullname" "SKK-JISYO.JIS2004"
197 "SKK-JISYO.office.zipcode" "SKK-JISYO.zipcode" "SKK-JISYO.lisp"))
198
199 (setq SKK_DICTIONARIES
200 (append SKK_DICTIONARIES
201 (mapcar (lambda (dic)
202 (format "%s.cdb" dic))
203 SKK_DICTIONARIES)))
204
205 (defvar SKK_DEFAULT_JISYO nil)
206
207 (defvar SKK_MODULES
208 ;; $B$3$s$J$b$s%3%^%s%I%i%$%s$G;XDj$9$k?M$$$J$$$h$M!)(B
209 (let ((list '(ccc
210 cdb
211 context-skk
212 skk-abbrev
213 skk-act
214 skk-annotation
215 skk-auto
216 skk-autoloads
217 skk-azik
218 skk-bayesian
219 skk-cdb
220 skk-comp
221 skk-cursor
222 skk-cus
223 skk-dcomp
224 skk-decor
225 skk-develop
226 skk-emacs
227 skk-gadget
228 skk-hint
229 skk-inline
230 skk-isearch
231 skk-jisx0201
232 skk-jisyo-edit-mode
233 skk-kakasi
234 skk-kcode
235 skk-leim
236 skk-look
237 skk-macs
238 skk-num
239 skk-search-web
240 skk-server-completion
241 skk-server
242 skk-show-mode
243 skk-sticky
244 skk-study
245 skk-tankan
246 skk-tut
247 skk-vars
248 skk-version
249 skk
250 tar-util
251 ;; EXPERIMENTAL
252 skk-correct
253 skk-exsearch
254 skk-exserv
255 skk-pre-henkan
256 skk-rdbms
257 skk-tutcdef
258 skk-tutcode
259 skk-w3m
260 ;; VIP 3.7
261 ;; vip
262 )))
263
264 ;; skk-jisx0213.el
265 (when (or (coding-system-p 'euc-jisx0213)
266 (and (fboundp 'find-coding-system)
267 (find-coding-system 'euc-jisx0213))
268 (condition-case nil
269 (and (require 'jisx0213) ; Mule-UCS
270 (require 'un-define)) ; Mule-UCS
271 (error)))
272 (add-to-list 'list 'skk-jisx0213))
273
274 ;; skk-lookup.el
275 (when (condition-case nil
276 ;; you might have to add lookup installed directory
277 ;; to `load-path'.
278 (let ((lookup-byte-compile t))
279 (require 'lookup))
280 (error))
281 (add-to-list 'list 'skk-lookup))
282
283 (when (condition-case nil
284 (require 'viper)
285 (error))
286 (add-to-list 'list 'skk-viper))
287 ;;
288 list))
289
290 ;; $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
291 ;; $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
292 ;; $B>C$7$F$*$/!#(B
293 (let ((modules SKK_MODULES))
294 (while modules
295 (unless (or
296 ;; skk-autoloads.el $B$O<+F0@8@.$5$l$k$N$G$^$@B8:_$7$J$$!#(B
297 (memq (car modules) '(skk-autoloads))
298 (file-exists-p (concat (symbol-name (car modules))
299 ".el")))
300 (setq SKK_MODULES (delq (car modules) SKK_MODULES)))
301 (setq modules (cdr modules))))
302
303 (defun SKK-MK-server-installed-p ()
304 ;; Check whether we can talk to the server.
305 (require 'skk-server (expand-file-name "skk-server.el"))
306 (let ((skk-server-inhibit-startup-server t))
307 (condition-case nil
308 (prog1
309 (skk-server-live-p (skk-open-server))
310 (skk-disconnect-server))
311 (error))))
312
313 (defvar SKK_SET_JISYO (not (SKK-MK-server-installed-p)))
314
315 ;; NON-PACKAGE INSTALL RELATED VARIABLE.
316 (defvar SKK_DATADIR
317 (cond ((and (eq system-type 'windows-nt)
318 (string-match "libexec" exec-directory))
319 (expand-file-name "skk" data-directory))
320 (t
321 (let ((subdir (cond (EMACS_SELF_CONTAINED
322 ;; Meadow, NTEmacs, Carbon Emacs, Cocoa Emacs
323 "etc")
324 (t
325 "share"))))
326 (expand-file-name SKK_PREFIX (expand-file-name subdir PREFIX))))))
327
328 (defvar SKK_INFODIR
329 (cond ((file-directory-p
330 (expand-file-name "info" (expand-file-name "share" PREFIX)))
331 (expand-file-name "info" (expand-file-name "share" PREFIX)))
332
333 ((file-directory-p (expand-file-name "info" PREFIX))
334 (expand-file-name "info" PREFIX))
335
336 ((file-directory-p
337 (expand-file-name "info" (expand-file-name ".." PREFIX)))
338 (expand-file-name "info" (expand-file-name ".." PREFIX)))
339
340 (t
341 (let ((list Info-default-directory-list)
342 dir)
343 (while (and (not dir)
344 list)
345 (when (file-directory-p (car list))
346 (setq dir (car list)))
347 (setq list (cdr list)))
348 dir)))
349 (expand-file-name "info" PREFIX))
350
351 (defvar SKK_LISPDIR
352 (cond
353 (VERSION_SPECIFIC_LISPDIR
354 (expand-file-name SKK_PREFIX VERSION_SPECIFIC_LISPDIR))
355 (PREFIX
356 (expand-file-name SKK_PREFIX
357 (install-detect-elisp-directory
358 PREFIX)))
359 (t
360 nil)))
361
362 (defconst SKK_DAREDEVIL_NOT_USE '(skk-vip
363 skk-foreword
364 stack-m
365 skk-cursor2
366 skk-cursor3))
367
368 (when SKK-MK-debugging
369 (princ (format "SKK_MODULES=%s\n" SKK_MODULES)))
370
371 ;; This code is for skk-jisx0201.el.
372 (when (fboundp 'make-translation-table) ;; FSF Emacs 20.3 or later
373 (setq standard-translation-table-for-decode
374 (make-translation-table nil)))
375
376 ;;; [FUNCTIONS]
377 (defun SKK-MK-make-setup-file (spec)
378 ;; SPEC $B$O8rBe%j%9%H!#(B
379 (with-temp-buffer
380 (save-excursion
381 (insert-file-contents "skk-setup.el.in")
382 (goto-char (point-min))
383 (when (looking-at ";;; -\\*- emacs-lisp -\\*-")
384 (delete-region (point) (progn
385 (forward-line 1)
386 (point))))
387 (when (search-forward ";;; skk-setup.el --- initial setup for SKK")
388 (forward-line 1)
389 (insert ";; This file was generated automatically by SKK-MK at "
390 (current-time-string)
391 "\n"))
392 (while spec
393 (goto-char (point-min))
394 (while (re-search-forward (concat "^;;[^@]+\\(" (car spec) "\\)")
395 nil t nil)
396 (delete-region (match-beginning 1)
397 (match-end 1))
398 (insert (nth 1 spec))
399 (beginning-of-line)
400 (while (looking-at ";")
401 (delete-char 1)))
402 (setq spec (nthcdr 2 spec)))
403 (write-region (point-min) (point-max) "skk-setup.el"))))
404
405 (defun SKK-MK-compile ()
406 (let (enable-local-eval)
407 (SKK-MK-generate-autoloads-el)
408 ;; (load (expand-file-name "skk-autoloads.el"))
409 ;; (require 'skk (expand-file-name "skk.el"))
410 (compile-elisp-modules SKK_MODULES
411 (expand-file-name "."))))
412
413 (defun SKK-MK-compile-info ()
414 (when (and SKK_INFO
415 (or (not (file-exists-p
416 (expand-file-name SKK_INFO DOCDIR)))
417 (file-newer-than-file-p
418 (expand-file-name (car SKK_TEXIS) DOCDIR)
419 (expand-file-name SKK_INFO DOCDIR))))
420 (SKK-MK-texinfo-format SKK_TEXIS)))
421
422 (defun SKK-MK-install ()
423 (SKK-MK-install-elc)
424 (SKK-MK-install-info))
425
426 (defun SKK-MK-install-elc ()
427 (let ((dics SKK_DICTIONARIES)
428 ;;standard-output
429 delete-target exists spec)
430 ;; make target directories.
431 (setq DOCDIR (expand-file-name DOCDIR)
432 ETCDIR (expand-file-name ETCDIR)
433 DICDIR (expand-file-name DICDIR))
434 (unless (file-exists-p SKK_LISPDIR)
435 (make-directory SKK_LISPDIR t))
436 (unless (file-exists-p SKK_DATADIR)
437 (make-directory SKK_DATADIR t))
438 ;; delete already installed unnecessary files.
439 (while SKK_DAREDEVIL_NOT_USE
440 (setq SKK_MODULES (delq (car SKK_DAREDEVIL_NOT_USE)
441 SKK_MODULES)
442 delete-target (expand-file-name
443 (concat (prin1-to-string
444 (car SKK_DAREDEVIL_NOT_USE))
445 ".el")
446 SKK_LISPDIR)
447 SKK_DAREDEVIL_NOT_USE (cdr SKK_DAREDEVIL_NOT_USE))
448 (when (file-exists-p delete-target)
449 (delete-file delete-target))
450 (setq delete-target (concat delete-target "c"))
451 (when (file-exists-p delete-target)
452 (delete-file delete-target)))
453 ;; install Emacs Lisp programs.
454 (SKK-MK-compile)
455 (install-elisp-modules SKK_MODULES "." SKK_LISPDIR)
456 (delete-file "./skk-autoloads.el")
457 ;; make skk-setup.el.
458 (while dics
459 (when (file-exists-p (expand-file-name (car dics) DICDIR))
460 (setq exists (cons (car dics) exists)))
461 (setq dics (cdr dics)))
462 (setq SKK_DICTIONARIES exists)
463 ;; move existing largest dictionay to car of `SKK_DICTIONARIES'.
464 (when (member "SKK-JISYO.M" SKK_DICTIONARIES)
465 (setq SKK_DICTIONARIES
466 (cons "SKK-JISYO.M"
467 (delete "SKK-JISYO.M"
468 SKK_DICTIONARIES))))
469 (when (member "SKK-JISYO.ML" SKK_DICTIONARIES)
470 (setq SKK_DICTIONARIES
471 (cons "SKK-JISYO.ML"
472 (delete "SKK-JISYO.ML"
473 SKK_DICTIONARIES))))
474 (when (member "SKK-JISYO.L" SKK_DICTIONARIES)
475 (setq SKK_DICTIONARIES
476 (cons "SKK-JISYO.L"
477 (delete "SKK-JISYO.L"
478 SKK_DICTIONARIES))))
479 (when SKK_TUTORIALS
480 (setq spec (append
481 spec
482 (list "@TUT@"
483 (expand-file-name
484 (car SKK_TUTORIALS) SKK_DATADIR)))))
485 (cond
486 (SKK_DICTIONARIES
487 (setq spec
488 (append spec
489 (list "@AUXDIC@"
490 (expand-file-name
491 (car SKK_DICTIONARIES) SKK_DATADIR))))
492 (when SKK_SET_JISYO
493 (setq spec
494 (append spec
495 (list
496 "@DIC@"
497 (expand-file-name
498 (car SKK_DICTIONARIES) SKK_DATADIR))))))
499 (t
500 ;; when dictionaries do not exist in ./dic subdirectory, check
501 ;; already installed dictionary and detect largest one to setup
502 ;; skk-setup.el.in.
503 (setq dics '("SKK-JISYO.L"
504 "SKK-JISYO.ML"
505 "SKK-JISYO.M"
506 "SKK-JISYO.S"))
507 (while (and dics
508 (not (file-exists-p (expand-file-name
509 (car dics)
510 SKK_DATADIR))))
511 (setq dics (cdr dics)))
512 (when dics
513 (setq spec
514 (append spec
515 (list "@AUXDIC@"
516 (expand-file-name
517 (car dics)
518 SKK_DATADIR))))
519 (when SKK_SET_JISYO
520 (setq spec
521 (append spec
522 (list "@DIC@"
523 (expand-file-name
524 (car dics)
525 SKK_DATADIR))))))))
526 (if (not spec)
527 ;; merely copy without setup dictionary information.
528 (copy-file "skk-setup.el.in"
529 "skk-setup.el"
530 'ok-if-already-exists)
531 (SKK-MK-make-setup-file spec))
532 (when SKK_DICTIONARIES
533 ;; install dictionaries if the files exist in ./dic directory.
534 (install-files SKK_DICTIONARIES
535 DICDIR
536 SKK_DATADIR
537 nil t nil))
538
539 (copy-file "./leim-list.el.in"
540 "./leim-list.el"
541 'overwrite)
542 (install-elisp-modules (list 'leim-list)
543 "."
544 SKK_LISPDIR)
545 (delete-file "./leim-list.el")
546 ;; install skk-setup.el
547 (install-elisp-modules (list 'skk-setup) "." SKK_LISPDIR)
548 ;; install tutorials.
549 (install-files SKK_TUTORIALS ETCDIR SKK_DATADIR nil t nil)
550 (SKK-MK-detect-shadow-directory)))
551
552 (defun SKK-MK-detect-shadow-directory ()
553 (condition-case nil
554 (progn
555 (require 'shadow)
556 (save-match-data
557 (let ((list (find-emacs-lisp-shadows load-path))
558 shadowed)
559 (while list
560 (if (and (string-match "skk-autoloads"
561 (car list))
562 (setq list (cdr list))
563 (string-match "skk-autoloads"
564 (car list)))
565 (setq shadowed
566 (substring
567 (file-name-directory (car list))
568 0 -1)
569 list nil))
570 (setq list (cdr list)))
571 (when shadowed
572 (princ (format "\
573 ** WARNING ** %s is shadowed. You might want to remove it
574 "
575 shadowed))))))
576 (error)))
577
578 (defun SKK-MK-install-info ()
579 (when SKK_INFO
580 (unless (file-exists-p SKK_INFODIR)
581 (make-directory SKK_INFODIR t))
582 (SKK-MK-compile-info)
583 (install-files (list SKK_INFO) ;defun in install.el
584 DOCDIR
585 SKK_INFODIR
586 nil t nil)
587 (when noninteractive
588 (SKK-MK-install-info-1))))
589
590 (defun SKK-MK-install-info-1 ()
591 "Updates info/dir entries."
592 (when SKK_INFO
593 ;; updates info/dir entries.
594 (require 'install-info (expand-file-name "./maint/install-info.el"))
595 (let ((info-file (expand-file-name SKK_INFO
596 SKK_INFODIR))
597 (dir-file (cond
598 ((file-exists-p (expand-file-name "dir" SKK_INFODIR))
599 (expand-file-name "dir" SKK_INFODIR))
600 ((file-exists-p (expand-file-name "dir.info" SKK_INFODIR))
601 (expand-file-name "dir.info" SKK_INFODIR))
602 (t
603 (expand-file-name "dir" SKK_INFODIR)))))
604 (when (file-readable-p dir-file)
605 (install-info info-file dir-file nil nil 'delete))
606 (install-info info-file dir-file nil nil nil)
607 (setq SKK_INFO_DIR_FILE dir-file))))
608
609 ;;; 2014-12-31, skk.texi $B$r(B utf-8 $B$H$7$?$3$H$KH<$$!"ITMW$H$J$C$?$,!"(B
610 ;;; $B>-MhE*$K(B pre-format $B$rMW$9$k$3$H$,9M$($i$l$k$?$a!"OHAH$_$O;D$9!#(B
611 (defun SKK-MK-texinfo-pre-format ()
612 ;; http://mail.ring.gr.jp/skk/201112/msg00023.html
613 ;; (unless (and (featurep 'emacs)
614 ;; (>= emacs-major-version 23))
615 ;; (dolist (str '("\C-[$(Q\"1\C-[(B" "\C-[$(Q\"Q\C-[(B" "\C-[$(Q\"q\C-[(B"))
616 ;; (goto-char (point-min))
617 ;; (when (search-forward str nil t)
618 ;; (replace-match " "))))
619 nil)
620
621 (defun SKK-MK-texinfo-post-format ()
622 (goto-char (point-min))
623 (when (re-search-forward "-\\*-Text-\\*-" (point-at-eol) t)
624 (replace-match (format "-*- mode: text; coding: %s -*-"
625 SKK-MK-texinfo-coding-system))))
626
627 (defun SKK-MK-texinfo-format (targets)
628 (let (;; Emacs20.2's default is 'raw-text-unix.
629 (coding-system-for-write SKK-MK-texinfo-coding-system)
630 (make-backup-files nil)
631 x obuf beg standard-output)
632 (require 'ptexinfmt (expand-file-name
633 (convert-standard-filename "maint/ptexinfmt.el")))
634 (while targets
635 (setq x (expand-file-name (car targets) DOCDIR))
636 (find-file x)
637 (setq obuf (current-buffer))
638 (SKK-MK-texinfo-pre-format)
639 (texinfo-every-node-update)
640 (texinfo-format-buffer 'nosplit)
641 (SKK-MK-texinfo-post-format)
642 (basic-save-buffer)
643 (kill-buffer (current-buffer)) ; .info buffer
644 (set-buffer-modified-p nil) ; .texi buffer
645 (kill-buffer obuf) ; .texi buffer
646 (setq targets (cdr targets)))))
647
648 (defun SKK-MK-uninstall ()
649 (dolist (f (directory-files SKK_LISPDIR t ".el"))
650 (delete-file f))
651 (princ (format "Delete files in %s...done\n" SKK_LISPDIR))
652
653 (delete-directory SKK_LISPDIR)
654 (princ (format "Delete directory %s...done\n" SKK_LISPDIR))
655
656 (delete-file (expand-file-name SKK_INFO SKK_INFODIR))
657 (princ (format "Delete %s file in %s...done\n" SKK_INFO SKK_INFODIR))
658
659 (dolist (f SKK_TUTORIALS)
660 (let ((fullpath (expand-file-name f SKK_DATADIR)))
661 (delete-file fullpath)
662 (princ (format "Delete %s...done\n" fullpath)))))
663
664 (defun SKK-MK-what-where ()
665 (interactive)
666 (let ((dics SKK_DICTIONARIES)
667 exists)
668 (while dics
669 (when (file-exists-p (expand-file-name (car dics) DICDIR))
670 (setq exists (cons (car dics) exists)))
671 (setq dics (cdr dics)))
672 (setq SKK_DICTIONARIES exists))
673
674 (let ((string
675 (format "
676 Running in:
677 %s
678
679 SKK modules:
680 %s
681 -> %s
682
683 SKK infos:
684 %s
685 -> %s
686
687 SKK tutorials:
688 %s
689 -> %s
690
691 "
692 (version)
693 (mapconcat 'symbol-name SKK_MODULES ", ")
694 SKK_LISPDIR
695 SKK_INFO
696 SKK_INFODIR
697 (mapconcat 'identity SKK_TUTORIALS ", ")
698 SKK_DATADIR)))
699 (when SKK_DICTIONARIES
700 (setq string (concat string
701 (format "
702 SKK dictionaries:
703 %s
704 -> %s
705
706 "
707 (mapconcat 'identity SKK_DICTIONARIES ", ")
708 SKK_DATADIR))))
709 (if noninteractive
710 (princ string)
711 (progn
712 (with-output-to-temp-buffer
713 "*What where*" (princ string))
714 (message "")))))
715
716 (defun SKK-MK-generate-autoloads-el ()
717 "Generate skk-autoload.el."
718 (let ((modules SKK_MODULES)
719 (buf (get-buffer-create
720 " *SKK-MK-generate-autoloads-el*"))
721 (sort-min)
722 (funcs)
723 standard-output)
724 (save-excursion
725 (set-buffer buf)
726 (erase-buffer)
727 (insert "\
728 ;;; skk-autoloads.el --- autoload settings for SKK -*- coding: iso-2022-jp -*-
729
730 ;; This file was generated automatically by SKK-MK at "
731 (current-time-string)
732 ".
733
734 ;; This file is part of Daredevil SKK.
735
736 ;; This program is free software: you can redistribute it and/or
737 ;; modify it under the terms of the GNU General Public License as
738 ;; published by the Free Software Foundation; either version 3 of
739 ;; the License, or (at your option) any later version.
740
741 ;; This program is distributed in the hope that it will be
742 ;; useful,but WITHOUT ANY WARRANTY; without even the implied
743 ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
744 ;; PURPOSE. See the GNU General Public License for more details.
745
746 ;; You should have received a copy of the GNU General Public License
747 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
748
749 ;;; Code:\n\n")
750 (require 'autoload)
751 (setq buffer-file-name "skk-autoloads.el")
752 (while modules
753 (let ((file (expand-file-name
754 (format "%s.el" (car modules)))))
755 (when (file-exists-p file)
756 (generate-file-autoloads file)))
757 (setq modules (cdr modules)))
758 (goto-char (point-max))
759 (insert "(provide 'skk-autoloads)
760 ;;; skk-autoloads.el ends here
761 ")
762 (let ((coding-system-for-write 'iso-2022-jp))
763 (write-region (point-min) (point-max) "skk-autoloads.el" nil 'quiet))
764 (set-buffer-modified-p nil)
765 (kill-buffer buf))))
766
767 ;;; DDSKK Interactive Installer (Jan 2011)
768 ;;; Lookup $B$N(B install.el $B$r;29M$K$5$;$F$$$?$@$-$^$7$?!#(B
769
770 (defun install-check-directory (directory)
771 (and (not (file-exists-p directory))
772 (y-or-n-p (format "Directory %s is not exist. Create it? " directory))
773 (make-directory directory t))
774 (if (not (file-directory-p directory))
775 (error "%s is not directory" directory))
776 (directory-file-name (expand-file-name directory)))
777
778 (defvar VERSION-STRING nil)
779 (if noninteractive
780 nil
781 (setq VERSION-STRING
782 (let (start)
783 (with-temp-buffer
784 (insert-file-contents "skk-version.el")
785 (goto-char (point-min))
786 (search-forward "ver ")
787 (forward-char)
788 (setq start (point))
789 (search-forward (char-to-string 34))
790 (buffer-substring start (1- (point)))))))
791
792 (if noninteractive
793 nil
794 (switch-to-buffer (generate-new-buffer "*DDSKK Installer*"))
795 (insert (version))
796 (insert "\n===================\n")
797 (insert "DDSKK $B%$%s%9%H!<%i(B\n")
798 (insert "===================\n\n")
799 (insert "DDSKK "
800 VERSION-STRING
801 " $B$N%$%s%9%H!<%k$r;O$a$^$9!#(B\n")
802 (insert "C-g $B$r%?%$%W$9$k$H!"$$$D$G$bCfCG$G$-$^$9!#(B\n\n")
803
804 (insert "$B$3$N%?%$%_%s%0$G<-=q%U%!%$%k$r%@%&%s%m!<%I$9$k$3$H$b$G$-$^$9!#(B:\n")
805 (when (yes-or-no-p "$B%@%&%s%m!<%I$7$^$9$+!)(B ")
806 (load-file (expand-file-name "./skk-develop.el"))
807 (skk-get (expand-file-name "./dic"))
808 (insert (format "
809 %s
810 -> %s
811
812 "
813 (mapconcat #'identity
814 (directory-files (expand-file-name "./dic/") nil "SKK")
815 ", ")
816 (expand-file-name "./dic")
817 )))
818
819 (insert "DDSKK $B$N%$%s%9%H!<%k@h$rF~NO$7$F$/$@$5$$(B:\n")
820 (setq SKK_LISPDIR (install-check-directory
821 (read-file-name "SKK_LISPDIR: " SKK_LISPDIR SKK_LISPDIR)))
822 (insert " => " SKK_LISPDIR "\n\n") (sit-for 0)
823
824 (insert "Info $B%U%!%$%k$rCV$/%G%#%l%/%H%j$rF~NO$7$F$/$@$5$$(B:\n")
825 (setq SKK_INFODIR (install-check-directory
826 (read-file-name "SKK_INFODIR: " SKK_INFODIR SKK_INFODIR)))
827 (insert " => " SKK_INFODIR "\n\n") (sit-for 0)
828
829 (insert "$B%A%e!<%H%j%"%k!&%U%!%$%k$rCV$/%G%#%l%/%H%j$rF~NO$7$F$/$@$5$$(B:\n")
830 (setq SKK_DATADIR (install-check-directory
831 (read-file-name "SKK_DATADIR: " SKK_DATADIR SKK_DATADIR)))
832 (insert " => " SKK_DATADIR "\n\n") (sit-for 0)
833
834 (insert "$B3NG'$7$F$/$@$5$$!#(B\n")
835 (insert (format "SKK modules: %s\n => %s\n\n"
836 (mapconcat 'symbol-name SKK_MODULES ", ")
837 SKK_LISPDIR))
838 (insert (format "SKK infos: %s\n => %s\n\n"
839 SKK_INFO
840 SKK_INFODIR))
841 (insert (format "SKK tutorials: %s\n => %s\n\n"
842 (mapconcat 'identity SKK_TUTORIALS ", ")
843 SKK_DATADIR))
844 (let ((dics SKK_DICTIONARIES)
845 exists)
846 (while dics
847 (when (file-exists-p (expand-file-name (car dics) DICDIR))
848 (setq exists (cons (car dics) exists)))
849 (setq dics (cdr dics)))
850 (insert (format "SKK dictionaries: %s\n => %s\n\n"
851 (mapconcat 'identity exists ", ")
852 SKK_DATADIR)))
853 (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")
854 (if (yes-or-no-p "$B%$%s%9%H!<%k$rB39T$7$^$9$+!)(B ")
855 nil
856 (error "$B%$%s%9%H!<%k$rCfCG$7$^$7$?!#(B")))
857
858 ;; SKK-MK-compile
859 (if noninteractive
860 nil
861 (let (enable-local-eval)
862 (insert "skk-autoloads.el $B$r@[email protected](B...") (sit-for 0)
863 (SKK-MK-generate-autoloads-el)
864 (insert "done\n")
865
866 (insert "skk-autoloads.el $B$rFI$_9~$_Cf(B...") (sit-for 0)
867 (load (expand-file-name "skk-autoloads.el"))
868 (insert "done\n")
869
870 (insert "skk.el $B$rFI$_9~$_Cf(B...") (sit-for 0)
871 (require 'skk (expand-file-name "skk.el"))
872 (insert "done\n")
873
874 (insert "elisp $B%U%!%$%k$N%3%s%Q%$%kCf(B...") (sit-for 0)
875 (compile-elisp-modules SKK_MODULES
876 (expand-file-name "."))
877 (switch-to-buffer (get-buffer "*DDSKK Installer*"))
878 (insert "done\n")))
879
880 ;; SKK-MK-install
881 ;; SKK-MK-install-elc
882 (if noninteractive
883 nil
884 (insert "elisp $B%U%!%$%k$N%$%s%9%H!<%kCf(B...") (sit-for 0)
885 (SKK-MK-install-elc)
886 (switch-to-buffer (get-buffer "*DDSKK Installer*"))
887 (insert "done\n"))
888
889 ;; SKK-MK-install-info
890 (if noninteractive
891 nil
892 (insert "info $B$N%$%s%9%H!<%kCf(B...") (sit-for 0)
893 (SKK-MK-install-info)
894 (insert "done\n")
895
896 (insert "info/dir $B%N!<%IDI2CCf(B...") (sit-for 0)
897 (SKK-MK-install-info-1)
898 (insert "done\n"))
899
900 ;; Congratulations!
901 (if noninteractive
902 nil
903 (insert "\n\nCongratulations!\nDDSKK $B$N%$%s%9%H!<%k$,40N;$7$^$7$?!#(B
904
905 load-path $B$N@_Dj(B
906 ----------------
907 $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
908 $BITMW$G$9!#(B
909 (setq load-path (cons \"" SKK_LISPDIR "\" load-path))
910
911 info $B%G%#%l%/%H%j$N@_Dj(B
912 -----------------------
913 $B<!$N$H$*$j(B $BJQ?t(B Info-default-directory-list $B$r@_Dj$7$F$/$@$5$$!#4{$K%Q%9(B
914 $B$,DL$C$F$$$k$J$i$PITMW$G$9!#(B
915 (setq Info-default-directory-list
916 (cons \"" SKK_INFODIR "\" Info-default-directory-list))
917
918 $B%G%#%l%/%H%j%U%!%$%k(B " SKK_INFO_DIR_FILE " $B$X$N%N!<%IDI2C$O40N;$7$F$$$^$9!#(B
919
920 Emacs $B$N@_Dj(B
921 ------------
922 $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
923 $B$k$3$H$,$G$-$k$O$:$G$9!#(B
924 $B$b$7(B DDSKK $B$,5/F0$7$J$$$h$&$G$"$l$P(B ~/.emacs $B$K(B
925 (require 'skk-autoloads)
926 $B$H5-:\$7$F!"$"$i$?$a$F(B Emacs $B$r:F5/F0$7$F$/$@$5$$!#(B
927
928 DDSKK $B$N@_Dj(B
929 ------------
930 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
931 Info $B$b$*FI$_$/$@$5$$!#(B
932 "))
933
934 (if noninteractive
935 nil
936 (delete-other-windows)
937 (recenter -1)
938 (remove-hook 'kill-emacs-hook 'skk-save-jisyo))
939
940 ;;; SKK-MK ends here