* gnus-util.el (gnus-byte-compile): New.
(gnus-use-byte-compile): New.
(gnus-make-sort-function): Use it.
* nnmail.el (nnmail-get-new-mail): Use it.
* gnus-agent.el (gnus-category-make-function): Simple function or
compiled function.
(gnus-agent-fetch-group-1): Don't use (caaddr predicate).
* gnus-gl.el (bbb-build-rate-command): Remove quote before lambda.
* gnus-topic.el (gnus-topic-sort-topics-1): Ditto.
(gnus-topic-sort-topics-1): Use gnus-byte-compile.
* message.el (message-check-news-header-syntax): Remove quote.
+2001-07-25 11:00:00 ShengHuo ZHU <zsh@cs.rochester.edu>
+
+ * gnus-util.el (gnus-byte-compile): New.
+ (gnus-use-byte-compile): New.
+ (gnus-make-sort-function): Use it.
+
+ * nnmail.el (nnmail-get-new-mail): Use it.
+
+ * gnus-agent.el (gnus-category-make-function): Simple function or
+ compiled function.
+ (gnus-agent-fetch-group-1): Don't use (caaddr predicate).
+
+ * gnus-gl.el (bbb-build-rate-command): Remove quote before lambda.
+ * gnus-topic.el (gnus-topic-sort-topics-1): Ditto.
+ (gnus-topic-sort-topics-1): Use gnus-byte-compile.
+
+ * message.el (message-check-news-header-syntax): Remove quote.
+
2001-07-24 19:00:00 ShengHuo ZHU <zsh@cs.rochester.edu>
* message.el (message-use-mail-followup-to): `t' is not a
(gnus-get-predicate
(or (gnus-group-find-parameter group 'agent-predicate t)
(cadr category))))
- (if (memq (caaddr predicate) '(gnus-agent-true gnus-agent-false))
+ (if (memq predicate '(gnus-agent-true gnus-agent-false))
;; Simple implementation
(setq arts
- (and (eq (caaddr predicate) 'gnus-agent-true) articles))
+ (and (eq predicate 'gnus-agent-true) articles))
(setq arts nil)
(setq score-param
(or (gnus-group-get-parameter group 'agent-score t)
(defun gnus-category-make-function (cat)
"Make a function from category CAT."
- `(lambda () ,(gnus-category-make-function-1 cat)))
+ (let ((func (gnus-category-make-function-1 cat)))
+ (if (and (= (length func) 1)
+ (symbolp (car func)))
+ (car func)
+ (gnus-byte-compile `(lambda () ,func)))))
(defun gnus-agent-true ()
"Return t."
(defun bbb-build-rate-command (rate-alist)
(concat "putratings " grouplens-bbb-token " " grouplens-current-group " \r\n"
- (mapconcat '(lambda (this) ; form (mid . (score . time))
- (concat (car this)
- " :rating=" (cadr this) ".00"
- " :time=" (cddr this)))
+ (mapconcat (lambda (this) ; form (mid . (score . time))
+ (concat (car this)
+ " :rating=" (cadr this) ".00"
+ " :time=" (cddr this)))
rate-alist "\r\n")
"\r\n.\r\n"))
(defun gnus-topic-sort-topics-1 (top reverse)
(if (cdr top)
(let ((subtop
- (mapcar `(lambda (top)
- (gnus-topic-sort-topics-1 top ,reverse))
+ (mapcar (gnus-byte-compile
+ `(lambda (top)
+ (gnus-topic-sort-topics-1 top ,reverse)))
(sort (cdr top)
- '(lambda (t1 t2)
- (string-lessp (caar t1) (caar t2)))))))
+ (lambda (t1 t2)
+ (string-lessp (caar t1) (caar t2)))))))
(setcdr top (if reverse (reverse subtop) subtop))))
top)
;; A list of functions.
((or (cdr funs)
(listp (car funs)))
- `(lambda (t1 t2)
- ,(gnus-make-sort-function-1 (reverse funs))))
+ (gnus-byte-compile
+ `(lambda (t1 t2)
+ ,(gnus-make-sort-function-1 (reverse funs)))))
;; A list containing just one function.
(t
(car funs))))
(or (string-equal x y)
(string-equal (downcase x) (downcase y)))))
+(defcustom gnus-use-byte-compile t
+ "If non-nil, byte-compile crucial run-time codes."
+ :type 'boolean
+ :version "21.1"
+ :group 'gnus-various)
+
+(defun gnus-byte-compile (form)
+ "Byte-compile FORM if `gnus-use-byte-compile' is non-nil."
+ (if gnus-use-byte-compile
+ (progn
+ (require 'bytecomp)
+ (defalias 'gnus-byte-compile 'byte-compile)
+ (byte-compile form))
+ form))
+
(provide 'gnus-util)
;;; gnus-util.el ends here
(concat newsgroups "," followup-to)
newsgroups)))
(known-groups
- (mapcar '(lambda (n) (gnus-group-real-name n))
+ (mapcar (lambda (n) (gnus-group-real-name n))
(gnus-groups-from-server
(cond ((equal gnus-post-method 'current)
gnus-current-select-method)
((eq source 'procmail)
(message "Invalid value for nnmail-spool-file: `procmail'")
nil))
- ;; Hack to only fetch the contents of a single group's spool file.
+ ;; Hack to only fetch the contents of a single group's spool file.
(when (and (eq (car source) 'directory)
(null nnmail-scan-directory-mail-source-once)
group)
(setq source (append source
(list
:predicate
- `(lambda (file)
- (string-equal
- ,(concat group suffix)
- (file-name-nondirectory file))))))))
+ (gnus-byte-compile
+ `(lambda (file)
+ (string-equal
+ ,(concat group suffix)
+ (file-name-nondirectory file)))))))))
(when nnmail-fetched-sources
(if (member source nnmail-fetched-sources)
(setq source nil)
(when (setq new
(mail-source-fetch
source
- `(lambda (file orig-file)
- (nnmail-split-incoming
- file ',(intern (format "%s-save-mail" method))
- ',spool-func
- (if (equal file orig-file)
- nil
- (nnmail-get-split-group orig-file ',source))
- ',(intern (format "%s-active-number" method))))))
+ (gnus-byte-compile
+ `(lambda (file orig-file)
+ (nnmail-split-incoming
+ file ',(intern (format "%s-save-mail" method))
+ ',spool-func
+ (if (equal file orig-file)
+ nil
+ (nnmail-get-split-group orig-file ',source))
+ ',(intern (format "%s-active-number" method)))))))
(incf total new)
(incf i)))
;; If we did indeed read any incoming spools, we save all info.