+
+(when (boundp 'MULE)
+ (let (current-load-list)
+ ;; Make the function to be silent at compile-time.
+ (defun locate-library (library &optional nosuffix)
+ "Show the full path name of Emacs library LIBRARY.
+This command searches the directories in `load-path' like `M-x load-library'
+to find the file that `M-x load-library RET LIBRARY RET' would load.
+Optional second arg NOSUFFIX non-nil means don't add suffixes `.elc' or `.el'
+to the specified name LIBRARY (a la calling `load' instead of `load-library')."
+ (interactive "sLocate library: ")
+ (catch 'answer
+ (mapcar
+ '(lambda (dir)
+ (mapcar
+ '(lambda (suf)
+ (let ((try (expand-file-name (concat library suf) dir)))
+ (and (file-readable-p try)
+ (null (file-directory-p try))
+ (progn
+ (or noninteractive
+ (message "Library is file %s" try))
+ (throw 'answer try)))))
+ (if nosuffix '("") '(".elc" ".el" ""))))
+ load-path)
+ (or noninteractive
+ (message "No library %s in search path" library))
+ nil))
+ (byte-compile 'locate-library)))
+
+(unless (fboundp 'si:byte-optimize-form-code-walker)
+ (byte-optimize-form nil);; Load `byte-opt' or `byte-optimize'.
+ (setq max-specpdl-size 3000)
+ (defalias 'si:byte-optimize-form-code-walker
+ (symbol-function 'byte-optimize-form-code-walker))
+ (defun byte-optimize-form-code-walker (form for-effect)
+ (if (and for-effect (memq (car-safe form) '(and or)))
+ ;; Fix bug in and/or forms.
+ (let ((fn (car form))
+ (backwards (reverse (cdr form))))
+ (while (and backwards
+ (null (setcar backwards
+ (byte-optimize-form (car backwards) t))))
+ (setq backwards (cdr backwards)))
+ (if (and (cdr form) (null backwards))
+ (byte-compile-log
+ " all subforms of %s called for effect; deleted" form))
+ (if backwards
+ (let ((head backwards))
+ (while (setq backwards (cdr backwards))
+ (setcar backwards (byte-optimize-form (car backwards)
+ nil)))
+ (cons fn (nreverse head)))))
+ (si:byte-optimize-form-code-walker form for-effect)))
+ (byte-compile 'byte-optimize-form-code-walker))
+
+(condition-case nil
+ (char-after)
+ (wrong-number-of-arguments
+ ;; Optimize byte code for `char-after'.
+ (put 'char-after 'byte-optimizer 'byte-optimize-char-after)
+ (defun byte-optimize-char-after (form)
+ (if (null (cdr form))
+ '(char-after (point))
+ form))))
+
+(condition-case nil
+ (char-before)
+ (wrong-number-of-arguments
+ ;; Optimize byte code for `char-before'.
+ (put 'char-before 'byte-optimizer 'byte-optimize-char-before)
+ (defun byte-optimize-char-before (form)
+ (if (null (cdr form))
+ '(char-before (point))
+ form))))
+
+(load (expand-file-name "dgnuspath.el" srcdir) nil nil t)
+
+(condition-case err
+ (load "~/.lpath.el" t nil t)
+ (error (message "Error in \"~/.lpath.el\" file: %s" err)))
+
+;; Don't load path-util until `char-after' and `char-before' have been
+;; optimized because it requires `poe' and then modify the functions.
+
+;; If the APEL modules are installed under the non-standard directory,
+;; for example "/var/home/john/lisp/apel-VERSION/", you should add that
+;; name using the configure option "--with-addpath=".
+;; And also the directory where the EMU modules are installed, for
+;; example "/usr/local/share/mule/19.34/site-lisp/", it should be
+;; included in the standard `load-path' or added by the configure
+;; option "--with-addpath=".
+(let ((path (or (locate-library "path-util")
+ (locate-library "apel/path-util")));; backward compat.
+ parent lpath)
+ (if path
+ (progn
+ (when (string-match "/$" (setq path (file-name-directory path)))
+ (setq path (substring path 0 (match-beginning 0))))
+ ;; path == "/var/home/john/lisp/apel-VERSION"
+ (when (string-match "/$" (setq parent (file-name-directory path)))
+ (setq parent (substring path 0 (match-beginning 0))))
+ ;; parent == "/var/home/john/lisp"
+ (if (setq lpath (or (member path load-path)
+ (member (file-name-as-directory path) load-path)))
+ (unless (or (member parent load-path)
+ (member (file-name-as-directory parent) load-path))
+ (push parent (cdr lpath)))
+ (push path load-path)
+ (unless (or (member parent load-path)
+ (member (file-name-as-directory parent) load-path))
+ (push parent (cdr load-path))))
+ (require 'path-util))
+ (error "
+APEL modules are not found in %s.
+Try to re-configure with --with-addpath=APEL_PATH and run make again.
+"
+ load-path)))
+
+(unless (locate-library "mel")
+ (add-path "flim"))
+(unless (module-installed-p 'mel)
+ ;; FLIM 1.14 may have installed in two "flim" subdirectories.
+ (push (expand-file-name "flim"
+ (file-name-directory (get-latest-path "^apel$" t)))
+ load-path)
+ (unless (module-installed-p 'mel)
+ (error "
+FLIM modules does not found in %s.
+Try to re-configure with --with-addpath=FLIM_PATH and run make again.
+"
+ load-path)))
+(add-path "semi")
+
+(push srcdir load-path)
+(load (expand-file-name "lpath.el" srcdir) nil t t)
+
+(load (expand-file-name "gnus-clfns.el" srcdir) nil t t)
+
+(when (boundp 'MULE)
+ ;; Load special macros for compiling canlock.el.
+ (load (expand-file-name "canlock-om.el" srcdir) nil t t))
+
+(require 'custom)
+
+;; Bind functions defined by `defun-maybe'.
+(put 'defun-maybe 'byte-hunk-handler 'byte-compile-file-form-defun-maybe)
+(defun byte-compile-file-form-defun-maybe (form)
+ (if (and (not (fboundp (nth 1 form)))
+ (memq 'unresolved byte-compile-warnings))
+ (setq byte-compile-function-environment
+ (cons (cons (nth 1 form)
+ (cons 'lambda (cdr (cdr form))))
+ byte-compile-function-environment)))
+ form)
+
+(condition-case nil
+ :symbol-for-testing-whether-colon-keyword-is-available-or-not
+ (void-variable
+ (defun dgnushack-bind-colon-keywords ()
+ "Bind all the colon keywords for old Emacsen."
+ (let ((cache (expand-file-name "dgnuskwds.el" srcdir))
+ (makefile (expand-file-name "Makefile" srcdir))
+ (buffer (get-buffer-create " *colon keywords*"))
+ keywords ignores files file dirs dir form elem make-backup-files)
+ (save-excursion
+ (set-buffer buffer)
+ (let (buffer-file-format
+ format-alist
+ insert-file-contents-post-hook
+ insert-file-contents-pre-hook
+ jam-zcat-filename-list
+ jka-compr-compression-info-list)
+ (if (and (file-exists-p cache)
+ (file-exists-p makefile)
+ (file-newer-than-file-p cache makefile))
+ (progn
+ (insert-file-contents cache nil nil nil t)
+ (setq keywords (read buffer)))
+ (setq
+ ignores
+ '(:symbol-for-testing-whether-colon-keyword-is-available-or-not
+ ;; The following keywords will be bound by CUSTOM.
+ :get :group :initialize :link :load :options :prefix
+ :require :set :tag :type)
+ files (list (locate-library "semi-def")
+ (locate-library "mailcap")
+ (locate-library "mime-def")
+ (locate-library "path-util")
+ (locate-library "poem"))
+ dirs (list (file-name-as-directory (expand-file-name srcdir))))
+ (while files
+ (when (setq file (pop files))
+ (setq dir (file-name-directory file))
+ (unless (member dir dirs)
+ (push dir dirs))))
+ (message "Searching for all the colon keywords in:")
+ (while dirs
+ (setq dir (pop dirs))
+ (message " %s..." dir)
+ (setq files (directory-files dir t
+ "\\.el\\(\\.gz\\|\\.bz2\\)?$"))
+ (while files
+ (setq file (pop files))
+ (if (string-match "\\(\\.gz$\\)\\|\\.bz2$" file)
+ (let ((temp (expand-file-name "dgnustemp.el" srcdir)))
+ (when
+ (let* ((binary (if (boundp 'MULE)
+ '*noconv*
+ 'binary))
+ (coding-system-for-read binary)
+ (coding-system-for-write binary)
+ (input-coding-system binary)
+ (output-coding-system binary)
+ (default-process-coding-system
+ (cons binary binary))
+ call-process-hook)
+ (insert-file-contents file nil nil nil t)
+ (when
+ (condition-case code
+ (progn
+ (if (match-beginning 1)
+ (call-process-region
+ (point-min) (point-max)
+ "gzip" t buffer nil "-cd")
+ (call-process-region
+ (point-min) (point-max)
+ "bzip2" t buffer nil "-d"))
+ t)
+ (error
+ (erase-buffer)
+ (message "In file %s: %s" file code)
+ nil))
+ (write-region (point-min) (point-max) temp
+ nil 'silent)
+ t))
+ (unwind-protect
+ (insert-file-contents temp nil nil nil t)
+ (delete-file temp))))
+ (insert-file-contents file nil nil nil t))
+ (while (setq form (condition-case nil
+ (read buffer)
+ (error nil)))
+ (while form
+ (setq elem (pop form))
+ (unless (memq (car-safe elem)
+ '(\` backquote
+ defcustom defface defgroup
+ define-widget quote))
+ (while (consp elem)
+ (push (car elem) form)
+ (setq elem (cdr elem)))
+ (when (and elem
+ (symbolp elem)
+ (not (eq ': elem))
+ (eq ?: (aref (symbol-name elem) 0))
+ (not (memq elem ignores))
+ (not (memq elem keywords)))
+ (push elem keywords)))))))
+ (setq keywords (sort keywords
+ (lambda (a b)
+ (string-lessp (symbol-name a)
+ (symbol-name b)))))
+ (erase-buffer)
+ (insert (format "%s" keywords))
+ (write-region (point-min) (point) cache nil 'silent)
+ (message
+ "The following colon keywords will be bound at run-time:\n %s"
+ keywords))))
+ (kill-buffer buffer)
+ (defconst dgnushack-colon-keywords keywords)
+ (while keywords
+ (set (car keywords) (car keywords))
+ (setq keywords (cdr keywords)))))
+ (byte-compile 'dgnushack-bind-colon-keywords)
+ (dgnushack-bind-colon-keywords)))
+
+(if (boundp 'MULE)
+ (progn
+ (setq :version ':version
+ :set-after ':set-after)
+ (require 'custom)
+ (defadvice custom-handle-keyword
+ (around dont-signal-an-error-even-if-unsupported-keyword-is-given
+ activate)
+ "Don't signal an error even if unsupported keyword is given."
+ (if (not (memq (ad-get-arg 1) '(:version :set-after)))
+ ad-do-it))))
+
+(when (boundp 'MULE)
+ (put 'custom-declare-face 'byte-optimizer
+ 'byte-optimize-ignore-unsupported-custom-keywords)
+ (put 'custom-declare-group 'byte-optimizer
+ 'byte-optimize-ignore-unsupported-custom-keywords)
+ (defun byte-optimize-ignore-unsupported-custom-keywords (form)
+ (if (or (memq ':version (nthcdr 4 form))
+ (memq ':set-after (nthcdr 4 form)))
+ (let ((newform (list (car form) (nth 1 form)
+ (nth 2 form) (nth 3 form)))
+ (args (nthcdr 4 form)))
+ (while args
+ (or (memq (car args) '(:version :set-after))
+ (setq newform (nconc newform (list (car args)
+ (car (cdr args))))))
+ (setq args (cdr (cdr args))))
+ newform)
+ form))
+
+ (put 'custom-declare-variable 'byte-hunk-handler
+ 'byte-compile-file-form-custom-declare-variable)
+ (defun byte-compile-file-form-custom-declare-variable (form)
+ ;; Bind defcustom'ed variables.
+ (if (memq 'free-vars byte-compile-warnings)
+ (setq byte-compile-bound-variables
+ (cons (nth 1 (nth 1 form)) byte-compile-bound-variables)))
+ (if (memq ':version (nthcdr 4 form))
+ ;; Make the variable uncustomizable.
+ `(defvar ,(nth 1 (nth 1 form)) ,(nth 1 (nth 2 form))
+ ,(substring (nth 3 form) (if (string-match "^[\t *]+" (nth 3 form))
+ (match-end 0)
+ 0)))
+ ;; Ignore unsupported keyword(s).
+ (if (memq ':set-after (nthcdr 4 form))
+ (let ((newform (list (car form) (nth 1 form)
+ (nth 2 form) (nth 3 form)))
+ (args (nthcdr 4 form)))
+ (while args
+ (or (eq (car args) ':set-after)
+ (setq newform (nconc newform (list (car args)
+ (car (cdr args))))))
+ (setq args (cdr (cdr args))))
+ newform)
+ form))))
+
+;; Unknown variables and functions.
+(unless (boundp 'buffer-file-coding-system)
+ (defvar buffer-file-coding-system (symbol-value 'file-coding-system)))
+(unless (featurep 'xemacs)
+ (defalias 'Custom-make-dependencies 'ignore)
+ (defalias 'update-autoloads-from-directory 'ignore))