From 91cc94da2c62dc8166c087aa5730fd8c9ff84f0f Mon Sep 17 00:00:00 2001 From: yamaoka Date: Tue, 7 Dec 1999 09:20:26 +0000 Subject: [PATCH] (byte-optimize-form-code-walker): Replace with the bug fixed version rigidly instead of the use of `defcustom'. --- lisp/dgnushack.el | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index 7fe5347..b454f2b 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -111,19 +111,16 @@ (require 'bytecomp) -;; Load `byte-opt' or `byte-optimize'. -(byte-optimize-form nil) - -(setq max-specpdl-size 3000) - -(defadvice byte-optimize-form-code-walker (around fix-bug-in-and/or-forms - activate) - "Fix bug in and/or forms." - (if (and (ad-get-arg 1) - (memq (car-safe (ad-get-arg 0)) '(and or))) - (let* ((form (ad-get-arg 0)) - (fn (car form))) - (let ((backwards (reverse (cdr form)))) +(unless (fboundp 'si:byte-optimize-form-code-walker) + (byte-optimize-form nil);; Load `byte-opt' or `byte-optimize'. + (setq max-specpdl-size 3000) + (fset '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)))) @@ -131,14 +128,14 @@ (if (and (cdr form) (null backwards)) (byte-compile-log " all subforms of %s called for effect; deleted" form)) - (setq ad-return-value - (if backwards - (let ((head backwards)) - (while (setq backwards (cdr backwards)) - (setcar backwards (byte-optimize-form (car backwards) - nil))) - (cons fn (nreverse head))))))) - ad-do-it)) + (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)) (defvar srcdir (or (getenv "srcdir") ".")) -- 1.7.10.4