From 3fcc11ed8cf50946d90f9b98827e97ce2afda691 Mon Sep 17 00:00:00 2001 From: yamaoka Date: Thu, 6 Jun 2002 04:18:50 +0000 Subject: [PATCH] * pop3.el: Make it can be byte-compiled in the Gnus source tree with neither errors nor warnings. (pop3-md5): Fix the logic to check whether the built-in `md5' allows the 4th argument CODING-SYSTEM. --- ChangeLog | 7 +++++++ lisp/pop3.el | 45 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9accb76..9b48c9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-06-06 Katsumi Yamaoka + + * lisp/pop3.el: Make it can be byte-compiled in the Gnus source + tree with neither errors nor warnings. + (pop3-md5): Fix the logic to check whether the built-in `md5' + allows the 4th argument CODING-SYSTEM. + 2002-06-04 Katsumi Yamaoka * lisp/gnus-vers.el (gnus-revision-number): Increment to 01. diff --git a/lisp/pop3.el b/lisp/pop3.el index 2618211..8571f33 100644 --- a/lisp/pop3.el +++ b/lisp/pop3.el @@ -507,21 +507,44 @@ If NOW, use that time instead." (if (not (and response (string-match "+OK" response))) (pop3-quit process)))) -;; Note that `pop3-md5' won't encode a given string to use for the -;; apop authentication. +;; When this file is being compiled in the Gnus (not T-gnus) source +;; tree, `md5' might have been defined in w3/md5.el, ./lpath.el or one +;; of some other libraries and `md5' will accept only 3 arguments. We +;; will deceive the byte-compiler not to say warnings. (eval-and-compile - (if (and (fboundp 'md5) - (subrp (symbol-function 'md5))) + (if (fboundp 'eval-when) + ;; `eval-when' might not be provided when loading .el file. + (eval-when 'compile + (let ((def (assq 'md5 byte-compile-function-environment))) + (if def + (setcdr def '(lambda (object &optional start end + coding-system noerror))) + (setq byte-compile-function-environment + (cons '(md5 . (lambda (object &optional start end + coding-system noerror))) + byte-compile-function-environment))))))) + +;; Note that `pop3-md5' should never encode a given string to use for +;; the apop authentication. +(eval-and-compile + (if (fboundp 'md5) (if (condition-case nil - (md5 "Check whether the 3rd argument CODING is allowed" + (md5 "\ +Check whether the 4th argument CODING-SYSTEM is allowed" nil nil 'binary) (error nil)) - ;; XEmacs 20 - (defalias 'pop3-md5 'md5) - ;; Emacs 21 or XEmacs 21 - (defun pop3-md5 (string) - (md5 string nil nil 'binary))) - ;; The lisp function provided by FLIM + ;; Emacs 21 or XEmacs 21 + ;; (md5 OBJECT &optional START END CODING-SYSTEM NOERROR) + (defun pop3-md5 (string) + (md5 string nil nil 'binary)) + ;; The reason why the program reaches here: + ;; 1. XEmacs 20 is running and the built-in `md5' doesn't + ;; allow the 4th argument. + ;; 2. `md5' has been defined by one of some lisp libraries. + ;; 3. This file is being compiled in the Gnus source tree, + ;; and `md5' has been defined in lpath.el. + (defalias 'pop3-md5 'md5)) + ;; The lisp function will be provided by FLIM or other libraries. (autoload 'md5 "md5") (defalias 'pop3-md5 'md5))) -- 1.7.10.4