X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fdgnushack.el;h=0fa112477078496b5976595727c91ada6fceb6e5;hb=27688c4fe73986a46e3f2cb9051170f41ef82f4c;hp=0e4ecf3f2762df00ed6d91d08bc4689cf00c00a2;hpb=d1b6d13953a652e136e4f86647dc1935cc7997b1;p=elisp%2Fgnus.git- diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index 0e4ecf3..0fa1124 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -1,5 +1,6 @@ ;;; dgnushack.el --- a hack to set the load path for byte-compiling -;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, +;; 2004, 2005 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen @@ -21,8 +22,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: @@ -56,6 +57,7 @@ (load "cl-macs" nil t)) (defvar srcdir (or (getenv "srcdir") ".")) +(defvar loaddir (and load-file-name (file-name-directory load-file-name))) (defvar dgnushack-w3-directory (let ((w3dir (getenv "W3DIR"))) (unless (zerop (length w3dir)) @@ -99,7 +101,7 @@ (when (and (not (featurep 'xemacs)) (= emacs-major-version 21) - (= emacs-minor-version 3) + (>= emacs-minor-version 3) (condition-case code (let ((byte-compile-error-on-warn t)) (byte-optimize-form (quote (pop x)) t) @@ -134,20 +136,13 @@ than subr.el." (put 'car 'side-effect-free tmp))) ad-do-it)))) -(setq max-specpdl-size 3000) - -(when (equal - (cadr - (byte-optimize-form - '(and - (< 0 1) - (message "The subform `(< 0 1)' should be optimized to t")) - 'for-effect)) - '(< 0 1)) +(when (and (not (featurep 'xemacs)) + (byte-optimize-form '(and (> 0 1) foo) t)) (defadvice byte-optimize-form-code-walker (around fix-bug-in-and/or-forms (form for-effect) activate) - "Fix a bug in the optimizing and/or forms. -It has already been fixed in XEmacs since 1999-12-06." + "Optimize the rest of the and/or forms. +It has been fixed in XEmacs before releasing 21.4 and also has been +fixed in Emacs after 21.3." (if (and for-effect (memq (car-safe form) '(and or))) (let ((fn (car form)) (backwards (reverse (cdr form)))) @@ -164,41 +159,22 @@ It has already been fixed in XEmacs since 1999-12-06." (setq ad-return-value (cons fn (nreverse backwards)))) ad-do-it))) -(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)))) - -;; Add `early-package-load-path' to `load-path' for XEmacs. Those paths +;; Add `configure-package-path' to `load-path' for XEmacs. Those paths ;; won't appear in `load-path' when XEmacs starts with the `-no-autoloads' -;; option because of a bug. :< +;; option or the `-vanilla' option because of a bug. :< (when (and (featurep 'xemacs) - (string-match "--package-path=\\([^ ]+\\)" - system-configuration-options)) + (boundp 'configure-package-path) + (listp configure-package-path)) (let ((paths (apply 'nconc (mapcar (lambda (path) - (when (file-directory-p - (setq path (expand-file-name "lisp" path))) + (when (and (stringp path) + (not (string-equal path "")) + (file-directory-p + (setq path (expand-file-name "lisp" path)))) (directory-files path t))) - (split-string (match-string 1 system-configuration-options) - "::")))) + configure-package-path))) path adds) (while paths (setq path (car paths) @@ -211,49 +187,34 @@ It has already been fixed in XEmacs since 1999-12-06." (push (file-name-as-directory path) adds))) (setq load-path (nconc (nreverse adds) load-path)))) -(load (expand-file-name "dgnuspath.el" srcdir) nil nil t) +(if (file-exists-p (expand-file-name "dgnuspath.el" srcdir)) + (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))) +(when (featurep 'xemacs) + (condition-case nil + (require 'timer-funcs) + (error " +You should upgrade your XEmacs packages, especially xemacs-base.\n")) + + ;; The reason that to load `advice' is necessary is: + ;; 1. `path-util' loads poe.elc. + ;; 2. poe.elc requires the `ad-add-advice' function which is expanded + ;; from `defadvice'. + ;; 3. XEmacs is running with the -no-autoloads option. + (require 'advice)) + ;; 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 'advice) - (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))) +(condition-case nil + (require 'path-util) + (error "\nIn %s, +APEL was not found or an error occurred. You will need to run the +configure script again adding the --with-addpath=APEL_PATH option.\n" + load-path)) (unless (locate-library "mel") (add-path "flim")) @@ -263,17 +224,36 @@ Try to re-configure with --with-addpath=APEL_PATH and run make again. (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. -" + (error "In %s, +FLIM was not found. You will need to run the configure script again +adding the --with-addpath=FLIM_PATH option.\n" load-path))) (add-path "semi") -(push srcdir load-path) -(load (expand-file-name "lpath.el" srcdir) nil t t) +(when (and (featurep 'xemacs) + (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table))) + (modify-syntax-entry ?= " " table) + (with-temp-buffer + (with-syntax-table table + (insert "foo=bar") + (goto-char (point-min)) + (forward-sexp 1) + (eolp))))) + ;; The original `with-syntax-table' uses `copy-syntax-table' which + ;; doesn't seem to copy modified syntax entries in XEmacs 21.5. + (defmacro with-syntax-table (syntab &rest body) + "Evaluate BODY with the SYNTAB as the current syntax table." + `(let ((stab (syntax-table))) + (unwind-protect + (progn + ;;(set-syntax-table (copy-syntax-table ,syntab)) + (set-syntax-table ,syntab) + ,@body) + (set-syntax-table stab))))) -(load (expand-file-name "gnus-clfns.el" srcdir) nil t t) +(push srcdir load-path) +(push loaddir load-path) +(load (expand-file-name "lpath.el" loaddir) nil t) (require 'custom) @@ -288,123 +268,6 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. 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 ((coding-system-for-read 'binary) - (coding-system-for-write 'binary) - (default-process-coding-system - '(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))) - (when (listp form) - (while form - (setq elem (car-safe form) - form (cdr-safe 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) - (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))) - ;; Unknown variables and functions. (unless (featurep 'xemacs) (defalias 'Custom-make-dependencies 'ignore) @@ -419,11 +282,6 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (eval-and-compile (when (featurep 'xemacs) - ;; XEmacs 21.1 needs some extra hand holding - (when (eq emacs-minor-version 1) - (autoload 'custom-declare-face "cus-face" nil t) - (autoload 'cl-compile-time-init "cl-macs" nil t) - (autoload 'defadvice "advice" nil nil 'macro)) (unless (fboundp 'defadvice) (autoload 'defadvice "advice" nil nil 'macro)) (autoload 'Info-directory "info" nil t) @@ -433,13 +291,19 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (autoload 'apropos-command "apropos" nil t) (autoload 'bbdb-complete-name "bbdb-com" nil t) (autoload 'browse-url "browse-url" nil t) + (autoload 'c-mode "cc-mode" nil t) (autoload 'customize-apropos "cus-edit" nil t) (autoload 'customize-save-variable "cus-edit" nil t) + (autoload 'customize-set-variable "cus-edit" nil t) (autoload 'customize-variable "cus-edit" nil t) (autoload 'delete-annotation "annotations") (autoload 'dolist "cl-macs" nil nil 'macro) (autoload 'enriched-decode "enriched") + (autoload 'executable-find "executable") + (autoload 'font-lock-fontify-buffer "font-lock" nil t) (autoload 'info "info" nil t) + (autoload 'mail-extract-address-components "mail-extr") + (autoload 'mail-fetch-field "mail-utils") (autoload 'make-annotation "annotations") (autoload 'make-display-table "disp-table") (autoload 'pp "pp") @@ -449,9 +313,13 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (autoload 'read-passwd "passwd") (autoload 'regexp-opt "regexp-opt") (autoload 'reporter-submit-bug-report "reporter") - (if (emacs-version>= 21 5) + (if (and (emacs-version>= 21 5) + (not (featurep 'sxemacs))) (autoload 'setenv "process" nil t) (autoload 'setenv "env" nil t)) + (autoload 'sgml-mode "psgml" nil t) + (autoload 'sha1 "sha1") + (autoload 'sha1-binary "sha1") (autoload 'smtpmail-send-it "smtpmail") (autoload 'sort-numeric-fields "sort" nil t) (autoload 'sort-subr "sort") @@ -470,7 +338,6 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (defalias 'overlays-in 'ignore) (defalias 'replace-dehighlight 'ignore) (defalias 'replace-highlight 'ignore) - (defalias 'run-with-idle-timer 'ignore) (defalias 'w3-coding-system-for-mime-charset 'ignore))) ;; T-gnus stuff. @@ -487,7 +354,8 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (autoload 'std11-unfold-region "nnheader")) (defconst dgnushack-unexporting-files - (append '("dgnushack.el" "dgnuspath.el" "dgnuskwds.el" "lpath.el") + (append '("dgnushack.el" "dgnuspath.el" "dgnuskwds.el" "lpath.el" + "legacy-gnus-agent.el") (unless (or (condition-case code (require 'w3-parse) (error @@ -567,8 +435,8 @@ Try to re-configure with --with-addpath=FLIM_PATH and run make again. (defconst dgnushack-dont-compile-files '("gnus-load.el" "mm-bodies.el" "mm-decode.el" "mm-encode.el" "mm-extern.el" - "mm-partial.el" "mm-url.el" "mm-uu.el" "mm-view.el" "mml-sec.el" - "mml-smime.el" "mml.el" "mml1991.el" "mml2015.el") + "mm-partial.el" "mm-uu.el" "mm-view.el" "mml-sec.el" "mml-smime.el" + "mml.el" "mml1991.el" "mml2015.el") "Files which should not be byte-compiled.") (defun dgnushack-compile-verbosely () @@ -583,14 +451,6 @@ dgnushack-compile." (unless warn (setq byte-compile-warnings '(free-vars unresolved callargs redefine))) - (unless (locate-library "cus-edit") - (error "You do not seem to have Custom installed. -Fetch it from . -You also then need to add the following to the lisp/dgnushack.el file: - - (push \"~/lisp/custom\" load-path) - -Modify to suit your needs.")) ;; Show `load-path'. (message "load-path=(\"%s\")" @@ -817,21 +677,22 @@ Modify to suit your needs.")) t) 'string-lessp)) (while (setq file (pop files)) - (insert "info/" file "\n")))))) - - -(define-compiler-macro describe-key-briefly (&whole form key &optional insert) - (if (condition-case nil - (progn - (describe-key-briefly '((())) nil) - t) - (wrong-number-of-arguments nil);; Old Emacsen. - (error t)) - form - (if insert - `(if ,insert - (insert (funcall 'describe-key-briefly ,key)) - (funcall 'describe-key-briefly ,key)) - `(funcall 'describe-key-briefly ,key)))) + (insert "info/" file "\n")) + (insert "etc/gnus-tut.txt\n") + (setq files + (sort (directory-files "../etc/images/gnus/" nil + "\\.\\(pbm\\|xbm\\|xpm\\)\\'" + t) + 'string-lessp)) + (while (setq file (pop files)) + (insert "etc/images/gnus/" file "\n")) + (insert "etc/images/gnus/x-splash\n") + (setq files + (sort (directory-files "../etc/images/smilies/" nil + "\\.\\(pbm\\|xpm\\)\\'" + t) + 'string-lessp)) + (while (setq file (pop files)) + (insert "etc/images/smilies/" file "\n")))))) ;;; dgnushack.el ends here