2001-02-23 Katsumi Yamaoka <yamaoka@jpl.org>
+ * mu-cite.el: (char-category): Force redefine as a function because
+ it may have been defined by emu.el; don't use `int-char' for
+ XEmacs if the function `char-category-list' returns a list of
+ characters; enclose the whole form with `eval-and-compile'.
+
+ * MU-CFG: Define the function `add-to-list' for a makeshift.
+
+ * MU-MK: Define byte-optimizer for replacing `sref' with `aref';
+ silence XEmacs not to say "bound but not referenced".
+ (byte-compile-file-form-custom-declare-variable): Define it for old
+ Emacsen.
+
+ * mu-cite.el: Undo the last change.
+
+2001-02-23 Katsumi Yamaoka <yamaoka@jpl.org>
+
* mu-cite.el: Require `emu' as well as `poem' because we have need
to pickup the function `char-category' for XEmacs.
(defvar default-load-path load-path)
+(condition-case nil
+ (require 'poe);; Attempt to pickup the function `add-to-list'.
+ (error
+ (if (fboundp 'add-to-list)
+ nil
+ ;; This function is limited to only manage the value of
+ ;; `load-path'. It will be overridden by the proper one later.
+ (defun add-to-list (list-var element)
+ (let ((paths (mapcar 'intern (delq nil (symbol-value list-var))))
+ (elem (if (string-match "/$" element)
+ (substring element 0 (1- (length element)))
+ element)))
+ (or (memq (intern elem) paths)
+ (memq (intern (concat elem "/")) paths)
+ (set list-var (cons element (symbol-value list-var))))))
+ (put 'add-to-list 'defun-maybe t))))
+
+;;; @ Please correct the directories where APEL or FLIM modules are
+;;; installed.
+
(add-to-list 'load-path
(expand-file-name "../../site-lisp/apel" data-directory))
(add-to-list 'load-path
(expand-file-name "../../site-lisp/flim" data-directory))
+(require 'poe)
+
(if (boundp 'LISPDIR)
(progn
(add-to-list 'default-load-path LISPDIR)
(let (prefix lisp-dir version-specific-lisp-dir)
(and (setq prefix (car command-line-args-left))
(or (string-equal "NONE" prefix)
- (defvar PREFIX prefix)
- ))
+ (defvar PREFIX prefix)))
(setq command-line-args-left (cdr command-line-args-left))
(and (setq lisp-dir (car command-line-args-left))
(or (string-equal "NONE" lisp-dir)
- (defvar LISPDIR lisp-dir)
- ))
+ (defvar LISPDIR lisp-dir)))
(setq command-line-args-left (cdr command-line-args-left))
(and (setq version-specific-lisp-dir (car command-line-args-left))
(or (string-equal "NONE" version-specific-lisp-dir)
(progn
(defvar VERSION_SPECIFIC_LISPDIR version-specific-lisp-dir)
(princ (format "VERSION_SPECIFIC_LISPDIR=%s\n"
- VERSION_SPECIFIC_LISPDIR)))
- ))
+ VERSION_SPECIFIC_LISPDIR)))))
(setq command-line-args-left (cdr command-line-args-left))
(load-file "MU-CFG")
(load-file "MU-ELS")
(princ (format "PREFIX=%s
-LISPDIR=%s\n" PREFIX LISPDIR))
- ))
+LISPDIR=%s\n" PREFIX LISPDIR))))
(defun compile-mu ()
(config-mu)
- (compile-elisp-modules mu-modules-to-compile ".")
- )
+ (compile-elisp-modules mu-modules-to-compile "."))
(defun install-mu ()
(config-mu)
- (install-elisp-modules mu-modules "./" MU_DIR)
- )
+ (install-elisp-modules mu-modules "./" MU_DIR))
(defun config-mu-package ()
(let (package-dir)
(and (setq package-dir (car command-line-args-left))
(or (string= "NONE" package-dir)
- (defvar PACKAGEDIR package-dir)
- ))
+ (defvar PACKAGEDIR package-dir)))
(setq command-line-args-left (cdr command-line-args-left))
(load-file "MU-CFG")
(load-file "MU-ELS")
(setq mu-modules (append mu-modules
- '(auto-autoloads custom-load)))
- (princ (format "PACKAGEDIR=%s\n" PACKAGEDIR))
- ))
+ '(auto-autoloads custom-load)))
+ (princ (format "PACKAGEDIR=%s\n" PACKAGEDIR))))
(defun compile-mu-package ()
(config-mu-package)
(add-to-list 'command-line-args-left ".")
(Custom-make-dependencies)
- (compile-elisp-modules mu-modules ".")
- )
+ (compile-elisp-modules mu-modules "."))
(defun install-mu-package ()
(config-mu-package)
"./"
(expand-file-name MU_PREFIX
(expand-file-name "lisp"
- PACKAGEDIR)))
- )
+ PACKAGEDIR))))
+
+(load "bytecomp" nil t)
+
+(if (fboundp 'byte-compile-file-form-custom-declare-variable)
+ nil
+ ;; Bind defcustom'ed variables when byte-compiling.
+ (put 'custom-declare-variable 'byte-hunk-handler
+ 'byte-compile-file-form-custom-declare-variable)
+ (defun byte-compile-file-form-custom-declare-variable (form)
+ (if (memq 'free-vars byte-compile-warnings)
+ (setq byte-compile-bound-variables
+ (cons (nth 1 (nth 1 form)) byte-compile-bound-variables)))
+ form))
+
+(cond ((featurep 'xemacs)
+ ;; Shut up!
+ (setq byte-compile-warnings
+ (delq 'unused-vars
+ (copy-sequence byte-compile-default-warnings))))
+ ((and (boundp 'emacs-major-version)
+ (or (> emacs-major-version 20)
+ (and (eq emacs-major-version 20)
+ (>= emacs-minor-version 3))))
+ ;; Compiler macro for replacing `sref' with `aref'.
+ (put 'sref 'byte-optimizer
+ (lambda (form)
+ (cons 'aref (cdr form))))))
;;; MU-MK ends here
;;; Code:
-;; We have need to pickup the function `char-category' for XEmacs which
-;; is defined in `emu'. It requires `poem' recursively for picking up
-;; the macros `char-next-index', `with-temp-buffer', etc.
-(require 'emu)
+;; For picking up the macros `char-next-index', `with-temp-buffer', etc.
+(require 'poem)
(require 'pcustom)
(require 'std11)
:type 'string
:group 'mu-cite)
-(defun-maybe-cond char-category (character)
- "Return a string of category mnemonics for CHAR in TABLE.
-CHAR can be any multilingual character,
+(eval-and-compile
+ ;; Force redefine the function `char-category' which may have been
+ ;; defined by emu.el. They can be distinguished by the number of
+ ;; arguments. Anyway, that is the best way not to use emu.el.
+ (if (and (fboundp 'char-category)
+ (subrp (symbol-function 'char-category)))
+ nil
+ (fmakunbound 'char-category)
+ (defun-maybe-cond char-category (character &optional table)
+ "Return a string of category mnemonics for CHAR in TABLE.
+CHAR can be any multilingual characters,
TABLE defaults to the current buffer's category table."
- ((and (subr-fboundp 'char-category-set)
- (subr-fboundp 'category-set-mnemonics))
- (category-set-mnemonics (char-category-set character))
- )
- ((fboundp 'char-category-list)
- (mapconcat (lambda (chr)
- (char-to-string (int-char chr)))
- (char-category-list character)
- "")
- )
- ((boundp 'NEMACS)
- (if (< (char-int character) 128)
- "al"
- "j")
- )
- (t
- (if (< (char-int character) 128)
- "al"
- "l")
- ))
+ ((and (subr-fboundp 'char-category-set)
+ (subr-fboundp 'category-set-mnemonics))
+ (category-set-mnemonics (char-category-set character)))
+ ((and (fboundp 'char-category-list)
+ ;; `char-category-list' returns a list of characters
+ ;; in XEmacs 21.2.25 and later, otherwise integers.
+ (characterp (car-safe (char-category-list ?a))))
+ (concat (char-category-list character)))
+ ((fboundp 'char-category-list)
+ (mapconcat (lambda (chr)
+ (char-to-string (int-char chr)))
+ (char-category-list character)
+ ""))
+ ((boundp 'NEMACS)
+ (if (< (char-int character) 128)
+ "al"
+ "j"))
+ (t
+ (if (< (char-int character) 128)
+ "al"
+ "l")))))
(defun detect-paragraph-cited-prefix ()
(save-excursion