X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fdgnushack.el;h=ea3d548a70f7faba413ec02ed88dd38ba6c1f52e;hb=9b741e050b400987d68ff761c6cc3276c932839c;hp=349603572058c3ab82faed89be967df41ee9a28c;hpb=43b351789ef4a46244f82b806efa2b3eeceaeba2;p=elisp%2Fgnus.git- diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index 3496035..ea3d548 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -1,5 +1,5 @@ ;;; dgnushack.el --- a hack to set the load path for byte-compiling -;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -55,15 +55,17 @@ (defvar srcdir (or (getenv "srcdir") ".")) -(let ((urldir (getenv "URLDIR"))) - (unless (zerop (length urldir)) - (push (file-name-as-directory urldir) load-path))) - (defvar dgnushack-w3-directory (let ((w3dir (getenv "W3DIR"))) (unless (zerop (length w3dir)) (file-name-as-directory w3dir)))) -(when dgnushack-w3-directory - (push dgnushack-w3-directory load-path)) + +(let ((urldir (getenv "URLDIR"))) + (unless (zerop (length urldir)) + (setq urldir (file-name-as-directory urldir)) + (push (file-name-as-directory urldir) load-path)) + (when (and dgnushack-w3-directory + (not (string-equal urldir dgnushack-w3-directory))) + (push dgnushack-w3-directory load-path))) ;; If we are building w3 in a different directory than the source ;; directory, we must read *.el from source directory and write *.elc @@ -84,6 +86,14 @@ (t (concat filename ".elc")))) (require 'bytecomp) +;; To avoid having defsubsts and inlines happen. +;(if (featurep 'xemacs) +; (require 'byte-optimize) +; (require 'byte-opt)) +;(defun byte-optimize-inline-handler (form) +; "byte-optimize-handler for the `inline' special-form." +; (cons 'progn (cdr form))) +;(defalias 'byte-compile-file-form-defsubst 'byte-compile-file-form-defun) (when (boundp 'MULE) (let (current-load-list) @@ -223,6 +233,14 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (load (expand-file-name "gnus-clfns.el" srcdir) nil t t) +(when (boundp 'MULE) + ;; Bind the function `base64-encode-string' before loading canlock. + ;; Since canlock will bind it as an autoloaded function, it causes + ;; damage to define the function by MEL. + (load (expand-file-name "base64.el" srcdir) nil t t) + ;; 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'. @@ -323,22 +341,22 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (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))))))) + (when (listp form) + (while form + (setq elem (pop form)) + (unless (memq (car-safe elem) + '(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) @@ -357,17 +375,16 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (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) + (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 @@ -412,7 +429,18 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (car (cdr args)))))) (setq args (cdr (cdr args)))) newform) - form)))) + form))) + + (defadvice byte-compile-inline-expand (around ignore-built-in-functions + (form) activate) + "Ignore built-in functions." + (let* ((name (car form)) + (fn (and (fboundp name) + (symbol-function name)))) + (if (subrp fn) + ;; Give up on inlining. + (setq ad-return-value form) + ad-do-it)))) ;; Unknown variables and functions. (unless (boundp 'buffer-file-coding-system) @@ -434,10 +462,13 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (progn (require 'shimbun) nil) (error '("nnshimbun.el"))) (unless (or (condition-case code - (require 'w3-forms) + (require 'w3-parse) (error - (message "No w3: %s %s retrying..." code - (locate-library "w3-forms")) + (message "No w3: %s%s, retrying..." + (error-message-string code) + (if (setq code (locate-library "w3-parse")) + (concat " (" code ")") + "")) nil)) ;; Maybe mis-configured Makefile is used (e.g. ;; configured for FSFmacs but XEmacs is running). @@ -445,33 +476,57 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (copy-sequence load-path)))) (if (let ((load-path lp)) (condition-case nil - (require 'w3-forms) + (require 'w3-parse) (error nil))) ;; If success, fix `load-path' for compiling. (progn (setq load-path lp) (message " => fixed; W3DIR=%s" (file-name-directory - (locate-library "w3-forms"))) + (locate-library "w3-parse"))) t) (message " => ignored") nil))) - '("nnweb.el" "nnlistserv.el" "nnultimate.el" - "nnslashdot.el" "nnwarchive.el" "webmail.el" - "nnwfm.el" "nnrss.el")) - (condition-case nil + '("nnultimate.el" "webmail.el" "nnwfm.el")) + (condition-case code + (progn (require 'mh-e) nil) + (error + (message "No mh-e: %s%s (ignored)" + (error-message-string code) + (if (setq code (locate-library "mh-e")) + (concat " (" code ")") + "")) + '("gnus-mh.el"))) + (condition-case code + (progn (require 'xml) nil) + (error + (message "No xml: %s%s (ignored)" + (error-message-string code) + (if (setq code (locate-library "xml")) + (concat " (" code ")") + "")) + '("nnrss.el"))) + (condition-case code (progn (require 'bbdb) nil) - (error '("gnus-bbdb.el"))) + (error + (message "No bbdb: %s%s (ignored)" + (error-message-string code) + (if (setq code (locate-library "bbdb")) + (concat " (" code ")") + "")) + '("gnus-bbdb.el"))) (unless (featurep 'xemacs) - '("gnus-xmas.el" "gnus-picon.el" "messagexmas.el" - "nnheaderxm.el" "smiley.el")) - (when (or (featurep 'xemacs) (<= emacs-major-version 20)) - '("smiley-ems.el")) + '("gnus-xmas.el" "messagexmas.el" "nnheaderxm.el")) + (when (and (not (featurep 'xemacs)) + (<= emacs-major-version 20)) + '("smiley.el")) (when (and (fboundp 'base64-decode-string) (subrp (symbol-function 'base64-decode-string))) '("base64.el")) (when (and (fboundp 'md5) (subrp (symbol-function 'md5))) - '("md5.el"))) + '("md5.el")) + (unless (boundp 'MULE) + '("canlock-om.el"))) "Files which will not be installed.") (defconst dgnushack-exporting-files @@ -642,7 +697,19 @@ Modify to suit your needs.")) ;;; no-byte-compile: t ;;; no-update-autoloads: t ;;; End: -;;; gnus-load.el ends here\n")) +;;; gnus-load.el ends here +") + ;; Workaround the bug in some version of XEmacs. + (when (featurep 'xemacs) + (condition-case nil + (require 'cus-load) + (error nil)) + (goto-char (point-min)) + (when (and (fboundp 'custom-add-loads) + (not (search-forward "\n(autoload 'custom-add-loads " nil t))) + (search-forward "\n;;; Code:" nil t) + (forward-line 1) + (insert "\n(autoload 'custom-add-loads \"cus-load\")\n")))) (message (format "Compiling %s..." dgnushack-gnus-load-file)) (byte-compile-file dgnushack-gnus-load-file))