From 0353b9d8bfcc8fb118d2be4cee2c9f92567c5ce7 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Fri, 11 Jun 1999 12:15:34 +0000 Subject: [PATCH] (TopLevel): Define some unknown functions for avoiding byte compile warnings. (TopLevel): Require `emu' for picking up some macros, bind some colon keywords, bind functions defined by `defun-maybe', bind defcustom'ed variables and optimize byte code for `char-after' and `char-before' for old Emacsen. (TopLevel): Attempt to load ~/.lpath.el. --- lisp/dgnushack.el | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index e2b30e4..1a423e7 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -31,9 +31,79 @@ (require 'cl) (require 'bytecomp) +(condition-case err + ;; Attempt to pickup the additional load-path(s). + (load "~/.lpath.el" t) + (error (message "Error in \"~/.lpath.el\" file: %s" err))) (push "." load-path) (load "./lpath.el" nil t) +(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)))) + +(unless (fboundp 'byte-compile-file-form-custom-declare-variable) + ;; Bind defcustom'ed variables. + (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)) + +(when (< emacs-major-version 20) + ;; 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 (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 + ;; Bind keywords. + (mapcar (lambda (keyword) (set keyword keyword)) + '(:button-keymap :data :mime-handle :path :predicate :user)))) + +;; Unknown variables and functions. +(unless (boundp 'buffer-file-coding-system) + (defvar buffer-file-coding-system (symbol-value 'file-coding-system))) +(autoload 'font-lock-set-defaults "font-lock") +(unless (featurep 'xemacs) + (defalias 'Custom-make-dependencies 'ignore)) +(defalias 'coding-system-get 'ignore) +(when (boundp 'MULE) + (defalias 'find-coding-system 'ignore)) +(defalias 'get-charset-property 'ignore) +(defalias 'toolbar-gnus 'ignore) +(unless (featurep 'xemacs) + (defalias 'update-autoloads-from-directory 'ignore)) + +(unless (fboundp 'with-temp-buffer) + ;; Pickup some macros. + (require 'emu)) + (defalias 'device-sound-enabled-p 'ignore) (defalias 'play-sound-file 'ignore) (defalias 'nndb-request-article 'ignore) -- 1.7.10.4