From: yamaoka Date: Fri, 26 Dec 2003 05:46:28 +0000 (+0000) Subject: Synch to Gnus 200312260545. X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=c8f4f52409e4d7b3d65b2e0672cb9340f5cb33c1;p=elisp%2Fgnus.git- Synch to Gnus 200312260545. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index be20d47..a69d4c8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2003-12-26 Katsumi Yamaoka + + * dgnushack.el: Add an advice to byte-optimize-form-code-walker to + avoid the warning ``...called for effect'' for the pop form when + running Emacs 21.3. + 2003-12-26 Jesper Harder * mm-bodies.el (mm-body-encoding): Don't use 7bit if the body diff --git a/lisp/dgnushack.el b/lisp/dgnushack.el index acbe183..97670f4 100644 --- a/lisp/dgnushack.el +++ b/lisp/dgnushack.el @@ -99,6 +99,43 @@ ; (cons 'progn (cdr form))) ;(defalias 'byte-compile-file-form-defsubst 'byte-compile-file-form-defun) +(when (and (not (featurep 'xemacs)) + (= emacs-major-version 21) + (= emacs-minor-version 3) + (condition-case code + (let ((byte-compile-error-on-warn t)) + (byte-optimize-form (quote (pop x)) t) + nil) + (error (string-match "called for effect" + (error-message-string code))))) + (defadvice byte-optimize-form-code-walker (around silence-warn-for-pop + (form for-effect) + activate) + "Silence the warning \"...called for effect\" for the `pop' form. +It is effective only when the `pop' macro is defined by cl.el rather +than subr.el." + (let (tmp) + (if (and (eq (car-safe form) 'car) + for-effect + (setq tmp (get 'car 'side-effect-free)) + (not byte-compile-delete-errors) + (not (eq tmp 'error-free)) + (eq (car-safe (cadr form)) 'prog1) + (let ((var (cadr (cadr form))) + (last (nth 2 (cadr form)))) + (and (symbolp var) + (null (nthcdr 3 (cadr form))) + (eq (car-safe last) 'setq) + (eq (cadr last) var) + (eq (car-safe (nth 2 last)) 'cdr) + (eq (cadr (nth 2 last)) var)))) + (progn + (put 'car 'side-effect-free 'error-free) + (unwind-protect + ad-do-it + (put 'car 'side-effect-free tmp))) + ad-do-it)))) + (when (boundp 'MULE) (let (current-load-list) ;; Make the function to be silent at compile-time.