Mercurial > hg > xemacs-beta
annotate lisp/update-elc.el @ 4989:d2ec55325515
make utf-8 default for Cygwin 1.7, rewrite init code determining default coding systems
-------------------- ChangeLog entries follow: --------------------
lisp/ChangeLog addition:
2010-02-06 Ben Wing <ben@xemacs.org>
* code-init.el:
* code-init.el (set-eol-detection):
* code-init.el (coding-system-current-system-configuration):
* code-init.el (coding-system-default-configuration-table): New.
* code-init.el (no-mule-no-eol-detection):
* code-init.el (define-coding-system-default-configuration): New.
* code-init.el (coding-system-variable-default-value-table): Removed.
* code-init.el (no-mule-eol-detection):
* code-init.el (coding-system-default-configuration-list): Removed.
* code-init.el (coding-system-default-variable-list):
* code-init.el (get-coding-system-variable):
* code-init.el (set-coding-system-variable):
* code-init.el (coding-system-variable-default-value):
* code-init.el (reset-coding-categories-to-default):
Significant clean-up, add Cygwin-UTF-8 support.
1. Shorten the names of the coding system variables to follow
what used to be considered the "abbreviations":
default-process-coding-system-read -> process-read
default-process-coding-system-write -> process-write
buffer-file-coding-system-for-read -> bfcs-for-read
default-buffer-file-coding-system -> default-bfcs
no-conversion-coding-system-mapping -> no-conv-cs
2. Instead of listing all the defaults in a big, strangely organized
table, use a new function
`define-coding-system-default-configuration' to define a
particular configuration. This uses a hash table stored in
`coding-system-default-configuration-table'. Rewrite
`coding-system-variable-default-value' appropriately.
3. Rename configurations to eliminate `unix' from the name:
unix-no-mule-no-eol-detection -> no-mule-no-eol-detection
unix-no-mule-eol-detection -> no-mule-eol-detection
unix-mule -> mule
This is because these are really for all systems but Windows,
not just Unix.
4. Add configuration `cygwin-utf-8', enabled when (featurep
'cygwin-use-utf-8). Uses `utf-8' for all defaults except for
`bfcs-for-read', which is `undecided'.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 06 Feb 2010 03:59:18 -0600 |
parents | 257b468bf2ca |
children | 8431b52e43b1 |
rev | line source |
---|---|
1303 | 1 ;;; update-elc.el --- Bytecompile out-of-date dumped files, pre-dumping |
428 | 2 |
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. | |
442 | 4 ;; Copyright (C) 1996 Sun Microsystems, Inc. |
1261 | 5 ;; Copyright (C) 2001, 2003 Ben Wing. |
428 | 6 |
528 | 7 ;; Author: Ben Wing <ben@xemacs.org> |
8 ;; Based On: Original by Steven L Baur <steve@xemacs.org> | |
428 | 9 ;; Maintainer: XEmacs Development Team |
10 ;; Keywords: internal | |
11 | |
12 ;; This file is part of XEmacs. | |
13 | |
14 ;; XEmacs is free software; you can redistribute it and/or modify it | |
15 ;; under the terms of the GNU General Public License as published by | |
16 ;; the Free Software Foundation; either version 2, or (at your option) | |
17 ;; any later version. | |
18 | |
19 ;; XEmacs is distributed in the hope that it will be useful, but | |
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
22 ;; General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
25 ;; along with XEmacs; see the file COPYING. If not, write to the | |
26 ;; Free Software Foundation, 59 Temple Place - Suite 330, | |
27 ;; Boston, MA 02111-1307, USA. | |
28 | |
29 ;;; Synched up with: Not in FSF. | |
30 | |
31 ;;; Commentary: | |
32 | |
33 ;; Byte compile the .EL files necessary to dump out xemacs. | |
1261 | 34 ;; Also update the auto-autoloads.el files. |
35 | |
428 | 36 ;; Use this file like this: |
37 | |
38 ;; temacs -batch -l ../lisp/update-elc.el $lisp | |
39 | |
40 ;; where $lisp comes from the Makefile. .elc files listed in $lisp will | |
41 ;; cause the corresponding .el file to be compiled. .el files listed in | |
42 ;; $lisp will be ignored. | |
43 | |
44 ;; (the idea here is that you can bootstrap if your .ELC files | |
45 ;; are missing or badly out-of-date) | |
46 | |
442 | 47 ;; See also update-elc-2.el |
428 | 48 |
49 ;;; Code: | |
50 | |
1261 | 51 ;; Help debug problems. |
52 (setq stack-trace-on-error t | |
53 load-always-display-messages t) | |
54 | |
428 | 55 (defvar processed nil) |
56 (defvar update-elc-files-to-compile nil) | |
528 | 57 (defvar need-to-rebuild-autoloads nil) |
58 (defvar need-to-rebuild-mule-autoloads nil) | |
59 (defvar need-to-recompile-autoloads nil) | |
60 (defvar need-to-recompile-mule-autoloads nil) | |
1330 | 61 (defvar exe-target nil) |
62 (defvar dump-target nil) | |
63 (defvar dump-target-out-of-date-wrt-dump-files nil) | |
64 ;(defvar dump-target-out-of-date-wrt-exe-target nil) | |
428 | 65 |
66 ;(setq update-elc-files-to-compile | |
67 ; (delq nil | |
68 ; (mapcar (function | |
69 ; (lambda (x) | |
70 ; (if (string-match "\.elc$" x) | |
71 ; (let ((src (substring x 0 -1))) | |
72 ; (if (file-newer-than-file-p src x) | |
73 ; (progn | |
74 ; (and (file-exists-p x) | |
75 ; (null (file-writable-p x)) | |
76 ; (set-file-modes x (logior (file-modes x) 128))) | |
77 ; src)))))) | |
78 ; ;; -batch gets filtered out. | |
79 ; (nthcdr 3 command-line-args)))) | |
80 | |
1330 | 81 |
3511 | 82 (defvar build-directory (expand-file-name ".." invocation-directory)) |
83 | |
1330 | 84 (defvar source-lisp (file-name-directory (expand-file-name |
3511 | 85 (nth 2 command-line-args)))) |
86 | |
1330 | 87 (defvar source-lisp-mule (expand-file-name "mule" source-lisp)) |
3511 | 88 (defvar source-directory (expand-file-name ".." source-lisp)) |
1330 | 89 (defvar aa-lisp (expand-file-name "auto-autoloads.el" source-lisp)) |
90 (defvar aac-lisp (expand-file-name "auto-autoloads.elc" source-lisp)) | |
91 (defvar aa-lisp-mule (expand-file-name "auto-autoloads.el" source-lisp-mule)) | |
92 (defvar aac-lisp-mule (expand-file-name "auto-autoloads.elc" source-lisp-mule)) | |
93 | |
94 (setq load-path (list source-lisp)) | |
428 | 95 |
96 (load "find-paths.el") | |
97 (load "packages.el") | |
98 (load "setup-paths.el") | |
1261 | 99 |
100 ;; Lisp files loaded in order to byte compile anything. If any are out of | |
101 ;; date, we need to load them as .el's, byte compile them, and reload as | |
102 ;; .elc's. | |
103 (defvar lisp-files-needed-for-byte-compilation | |
104 '("bytecomp" | |
105 "byte-optimize")) | |
106 | |
1263 | 107 ;; Lisp files not in `lisp-files-needed-for-byte-compilation' that need |
108 ;; early byte compilation. These are files loaded by update-elc.el in | |
109 ;; order to do the compilation of all the rest of the files. | |
1261 | 110 (defvar lisp-files-needing-early-byte-compilation |
2548 | 111 '("easy-mmode" |
1261 | 112 "autoload" |
113 "shadow" | |
114 "cl-macs")) | |
115 | |
116 (defvar unbytecompiled-lisp-files | |
117 '("paths.el" | |
118 "dumped-lisp.el" | |
119 "dumped-pkg-lisp.el" | |
4246 | 120 "raw-process.el") |
2367 | 121 "Lisp files that should not be byte compiled. |
122 Files in `additional-dump-dependencies' do not need to be listed here.") | |
123 | |
124 (defvar additional-dump-dependencies | |
4690
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4246
diff
changeset
|
125 (nconc '("loadup.el" |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4246
diff
changeset
|
126 "loadup-el.el" |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4246
diff
changeset
|
127 "update-elc.el") |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4246
diff
changeset
|
128 (if (featurep 'mule) |
257b468bf2ca
Move the #'query-coding-region implementation to C.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4246
diff
changeset
|
129 '("mule/make-coding-system"))) |
2367 | 130 "Lisp files that are not dumped but which the dump depends on. |
131 If any of these files are changed, we need to redump.") | |
428 | 132 |
1298 | 133 (defvar lisp-files-ignored-when-checking-for-autoload-updating |
134 '("custom-load.el" | |
135 "auto-autoloads.el") | |
136 "Lisp files that should not trigger auto-autoloads rebuilding.") | |
137 | |
528 | 138 (defun update-elc-chop-extension (file) |
139 (if (string-match "\\.elc?$" file) | |
140 (substring file 0 (match-beginning 0)) | |
141 file)) | |
428 | 142 |
528 | 143 ;; we used to call packages-list-autoloads here, but it's false generality. |
144 ;; we need to handle each autoload file differently and there are only | |
145 ;; two of them. | |
428 | 146 |
1261 | 147 (let (preloaded-file-list site-load-packages files-to-process) |
528 | 148 |
1330 | 149 (load (expand-file-name "dumped-lisp.el" source-lisp)) |
442 | 150 |
1330 | 151 ;; two setups here: |
152 ;; (1) temacs.exe is undumped, dumped into xemacs.exe. Happens with | |
153 ;; unexec, but also with pdump under MS Windows native, since | |
154 ;; the dumped data is stored as a resource in the xemacs.exe | |
155 ;; executable. | |
156 ;; (2) xemacs.exe is dumped or undumped. Running `xemacs -nd' gets | |
157 ;; you the equivalent of `temacs'. Dumping creates a file | |
158 ;; `xemacs.dmp'. | |
1261 | 159 |
1330 | 160 (cond ((eq system-type 'windows-nt) |
161 (setq exe-target "src/temacs.exe" | |
162 dump-target "src/xemacs.exe")) | |
163 ;; #### need better ways of getting config params | |
164 ((not (memq 'pdump (emacs-run-status))) | |
165 (setq exe-target "src/temacs" | |
166 dump-target "src/xemacs")) | |
167 (t | |
168 (setq exe-target "src/xemacs" | |
169 dump-target "src/xemacs.dmp"))) | |
1261 | 170 |
3511 | 171 (setq exe-target (expand-file-name exe-target build-directory)) |
172 (setq dump-target (expand-file-name dump-target build-directory)) | |
1330 | 173 |
174 ;; Not currently used. | |
175 ; (setq dump-target-out-of-date-wrt-exe-target | |
176 ; (cond ((not dump-target) t) | |
177 ; (temacs-exe (file-newer-than-file-p temacs-exe dump-target)) | |
178 ; ((not data-file) t) | |
179 ; (t (file-newer-than-file-p dump-target data-file)))) | |
180 ; (setq dump-target-exists (or (and temacs-exe dump-target) | |
181 ; (and data-file dump-target)))) | |
1261 | 182 |
428 | 183 ;; Path setup |
184 (let ((package-preloaded-file-list | |
185 (packages-collect-package-dumped-lisps late-package-load-path))) | |
186 | |
187 (setq preloaded-file-list | |
188 (append package-preloaded-file-list | |
189 preloaded-file-list | |
190 packages-hardcoded-lisp))) | |
191 | |
3511 | 192 (load (expand-file-name "site-packages" source-directory) t t) |
428 | 193 (setq preloaded-file-list |
194 (append packages-hardcoded-lisp | |
195 preloaded-file-list | |
196 site-load-packages)) | |
1261 | 197 ;; bytecomp, byte-optimize, autoload, etc. are mentioned specially |
198 ;; in the lisp-files-need* variables. | |
199 (setq files-to-process (append lisp-files-needed-for-byte-compilation | |
200 lisp-files-needing-early-byte-compilation | |
2367 | 201 additional-dump-dependencies |
1261 | 202 preloaded-file-list)) |
528 | 203 (while files-to-process |
204 (let* ((arg (car files-to-process)) | |
2367 | 205 (arg-is-dump-dependency |
206 (or (member arg preloaded-file-list) | |
207 (member arg additional-dump-dependencies))) | |
528 | 208 (arg-sans-extension (update-elc-chop-extension arg)) |
209 (full-arg (locate-library arg-sans-extension)) | |
210 (full-arg-sans-extension | |
211 (if (null full-arg) | |
212 (progn | |
213 (print (format "Error: Library file %s not found" arg)) | |
1261 | 214 (backtrace) |
528 | 215 ;; Uncomment in case of trouble |
2456 | 216 ;;(print (format "late-package-hierarchies: %S" late-package-hierarchies)) |
528 | 217 ;;(print (format "guessed-roots: %S" |
218 ;; (paths-find-emacs-roots | |
219 ;; invocation-directory invocation-name))) | |
220 (kill-emacs)) | |
221 (update-elc-chop-extension full-arg))) | |
222 (full-arg-el (concat full-arg-sans-extension ".el")) | |
223 (full-arg-elc (concat full-arg-sans-extension ".elc")) | |
1261 | 224 (full-arg-dir (file-name-directory full-arg-el))) |
528 | 225 |
2367 | 226 ; (print full-arg-el) |
442 | 227 |
228 ;; now check if .el or .elc is newer than the dumped exe. | |
229 ;; if so, need to redump. | |
2367 | 230 (when (and dump-target arg-is-dump-dependency |
1298 | 231 ;; no need to check for existence of either of the files |
232 ;; because of the definition of file-newer-than-file-p. | |
1330 | 233 (or (file-newer-than-file-p full-arg-el dump-target) |
234 (file-newer-than-file-p full-arg-elc dump-target))) | |
235 (setq dump-target-out-of-date-wrt-dump-files t)) | |
528 | 236 |
237 (if (and (not (member (file-name-nondirectory arg) | |
1261 | 238 unbytecompiled-lisp-files)) |
2367 | 239 (not (member (file-name-nondirectory arg) |
240 additional-dump-dependencies)) | |
528 | 241 (not (member full-arg-el processed)) |
1298 | 242 ;; no need to check for existence of either of the files |
243 ;; because of the definition of file-newer-than-file-p. | |
244 (file-newer-than-file-p full-arg-el full-arg-elc)) | |
528 | 245 (setq processed (cons full-arg-el processed))) |
246 | |
247 (setq files-to-process (cdr files-to-process)))) | |
442 | 248 |
1261 | 249 ;; Check if we need to rebuild the auto-autoloads.el files -- that is, |
250 ;; if ANY .el files have changed. | |
1330 | 251 (let ((dirs-to-check (list source-lisp source-lisp-mule))) |
1261 | 252 (while dirs-to-check |
253 (let* ((dir (car dirs-to-check)) | |
254 (full-dir (expand-file-name dir)) | |
255 (all-files-in-dir (directory-files full-dir t "\\.el$" nil t)) | |
256 (autoload-file | |
257 (expand-file-name "auto-autoloads.el" full-dir)) | |
1330 | 258 (autoload-is-mule (equal dir source-lisp-mule))) |
1261 | 259 (while all-files-in-dir |
260 (let* ((full-arg (car all-files-in-dir))) | |
1298 | 261 ;; custom-load.el always gets regenerated so don't let that |
262 ;; trigger us. | |
263 (when (and (not | |
264 (member | |
265 (file-name-nondirectory full-arg) | |
266 lisp-files-ignored-when-checking-for-autoload-updating | |
267 )) | |
268 (file-newer-than-file-p full-arg autoload-file)) | |
1261 | 269 (if autoload-is-mule |
270 (setq need-to-rebuild-mule-autoloads t) | |
271 (setq need-to-rebuild-autoloads t)))) | |
272 (setq all-files-in-dir (cdr all-files-in-dir)))) | |
273 (setq dirs-to-check (cdr dirs-to-check)))) | |
274 | |
1330 | 275 (if dump-target-out-of-date-wrt-dump-files |
442 | 276 (condition-case nil |
1330 | 277 (write-region-internal |
3511 | 278 "foo" nil (expand-file-name "src/NEEDTODUMP" build-directory)) |
442 | 279 (file-error nil))) |
280 | |
281 ) | |
428 | 282 |
528 | 283 (when (or need-to-rebuild-autoloads |
1298 | 284 ;; no real need for the following check either, because if the file |
285 ;; doesn't exist, need-to-rebuild-autoloads gets set above. but | |
286 ;; it's only one call, so it won't slow things down much and it keeps | |
287 ;; the logic cleaner. | |
1330 | 288 (not (file-exists-p aa-lisp)) |
1298 | 289 ;; no need to check for file-exists of .elc due to definition |
290 ;; of file-newer-than-file-p | |
1330 | 291 (file-newer-than-file-p aa-lisp aac-lisp)) |
528 | 292 (setq need-to-recompile-autoloads t)) |
293 | |
294 (when (or need-to-rebuild-mule-autoloads | |
1298 | 295 ;; not necessary but ... see comment above. |
1330 | 296 (not (file-exists-p aa-lisp-mule)) |
1298 | 297 ;; no need to check for file-exists of .elc due to definition |
298 ;; of file-newer-than-file-p | |
1330 | 299 (file-newer-than-file-p aa-lisp-mule aac-lisp-mule)) |
528 | 300 (setq need-to-recompile-mule-autoloads t)) |
301 | |
302 (when (not (featurep 'mule)) | |
303 ;; sorry charlie. | |
304 (setq need-to-rebuild-mule-autoloads nil | |
305 need-to-recompile-mule-autoloads nil)) | |
306 | |
428 | 307 (setq update-elc-files-to-compile (append update-elc-files-to-compile |
622 | 308 (nreverse processed))) |
428 | 309 |
1261 | 310 ;(print update-elc-files-to-compile) |
428 | 311 |
1261 | 312 (let ((do-autoload-commands |
313 (append | |
314 (if (or need-to-rebuild-autoloads | |
315 need-to-rebuild-mule-autoloads) | |
1330 | 316 (list "-l" "autoload")) |
1261 | 317 (if need-to-rebuild-autoloads |
2548 | 318 (list "-f" "batch-update-directory-autoloads" |
1330 | 319 "auto" source-lisp)) |
1261 | 320 (if need-to-rebuild-mule-autoloads |
2548 | 321 (list "-f" "batch-update-directory-autoloads" |
1330 | 322 "mule" source-lisp-mule)) |
1261 | 323 (if need-to-recompile-autoloads |
1330 | 324 (list "-f" "batch-byte-compile-one-file" |
325 aa-lisp)) | |
1261 | 326 (if need-to-recompile-mule-autoloads |
1330 | 327 (list "-f" "batch-byte-compile-one-file" |
328 aa-lisp-mule))))) | |
1298 | 329 (condition-case nil |
3511 | 330 (delete-file (expand-file-name "src/REBUILD_AUTOLOADS" build-directory)) |
1298 | 331 (file-error nil)) |
1261 | 332 (cond ((and (not update-elc-files-to-compile) |
333 (not need-to-rebuild-autoloads) | |
334 (not need-to-rebuild-mule-autoloads) | |
335 (not need-to-recompile-autoloads) | |
336 (not need-to-recompile-mule-autoloads)) | |
1315 | 337 ;; (1) Nothing to do at all. |
338 ) | |
1298 | 339 ((not update-elc-files-to-compile) |
1261 | 340 ;; (2) We have no files to byte-compile, but we do need to |
1298 | 341 ;; regenerate and compile the auto-autoloads file, so signal |
342 ;; update-elc-2 to do it. This is much faster than loading | |
343 ;; all the .el's and doing it here. (We only need to rebuild | |
344 ;; the autoloads here when we have files to compile, since | |
345 ;; they may depend on the updated autoloads.) | |
346 (condition-case nil | |
1330 | 347 (write-region-internal |
3511 | 348 "foo" nil (expand-file-name "src/REBUILD_AUTOLOADS" build-directory)) |
1298 | 349 (file-error nil)) |
1315 | 350 ) |
1261 | 351 (t |
352 (let ((bc-bootstrap | |
353 (mapcar #'(lambda (arg) | |
354 (concat (update-elc-chop-extension | |
355 (locate-library arg)) ".el")) | |
356 lisp-files-needed-for-byte-compilation)) | |
357 (bootstrap-other | |
358 (mapcar #'(lambda (arg) | |
359 (concat (update-elc-chop-extension | |
360 (locate-library arg)) ".el")) | |
361 lisp-files-needing-early-byte-compilation))) | |
362 (setq inhibit-autoloads t) | |
528 | 363 ;; if bytecomp or byte-optimize need recompiling, then load |
364 ;; the .el version of them first, recompile them, and reload | |
365 ;; the .elc versions to recompile everything else (so we won't | |
366 ;; be waiting until the cows come home). we need to set | |
367 ;; load-ignore-elc-files because byte-optimize gets autoloaded | |
368 ;; from bytecomp. | |
1261 | 369 (let ((recompile-bc-bootstrap |
370 (apply #'nconc | |
371 (mapcar | |
372 #'(lambda (arg) | |
373 (when (member arg update-elc-files-to-compile) | |
374 (append '("-f" "batch-byte-compile-one-file") | |
375 (list arg)))) | |
376 bc-bootstrap))) | |
377 (recompile-bootstrap-other | |
378 (apply #'nconc | |
379 (mapcar | |
380 #'(lambda (arg) | |
381 (when (member arg update-elc-files-to-compile) | |
382 (append '("-f" "batch-byte-compile-one-file") | |
383 (list arg)))) | |
384 bootstrap-other)))) | |
385 (mapc-internal | |
386 #'(lambda (arg) | |
387 (setq update-elc-files-to-compile | |
388 (delete arg update-elc-files-to-compile))) | |
389 (append bc-bootstrap bootstrap-other)) | |
390 (setq command-line-args | |
391 (append | |
392 '("-l" "loadup-el.el" "run-temacs" | |
393 "-batch" "-no-packages" "-no-autoloads" | |
394 "-eval" "(setq stack-trace-on-error t)" | |
395 "-eval" "(setq load-always-display-messages t)") | |
396 (when recompile-bc-bootstrap | |
397 (append | |
398 '("-eval" "(setq load-ignore-elc-files t)" | |
399 "-l" "bytecomp") | |
400 recompile-bc-bootstrap | |
401 '("-eval" "(setq load-ignore-elc-files nil)"))) | |
402 '("-l" "bytecomp") | |
403 ;; likewise, recompile autoload.el etc. if out-of-date. | |
404 recompile-bootstrap-other | |
405 ;; then generate autoloads for lisp and maybe lisp/mule. | |
406 do-autoload-commands | |
407 ;; now load the autoloads and compile alles anderes. | |
408 '("-eval" "(setq inhibit-autoloads nil)" | |
409 "-f" "startup-load-autoloads" | |
410 "-f" "batch-byte-compile") | |
411 update-elc-files-to-compile | |
412 )))) | |
413 | |
414 ;;(print command-line-args) | |
415 (load "loadup-el.el")))) | |
428 | 416 |
1303 | 417 (kill-emacs) |
428 | 418 |
419 ;;; update-elc.el ends here |