From 942dbaec1846849afa6f8e787ff4db1bbd4b2d7e Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Wed, 22 Sep 2010 17:21:41 +0200 Subject: [PATCH] Try to keep the server/method cache unique. * gnus.el (gnus-method-to-server): Don't push things to the cache unless it's unique. (gnus-server-to-method): Ditto. --- lisp/ChangeLog | 6 ++++++ lisp/gnus.el | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 82103864c..0299df05e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2010-09-22 Lars Magne Ingebrigtsen + + * gnus.el (gnus-method-to-server): Don't push things to the cache + unless it's unique. + (gnus-server-to-method): Ditto. + 2010-09-22 Teodor Zlatanov * nnimap.el (nnimap-delete-article): Tell user if expunge won't happen. diff --git a/lisp/gnus.el b/lisp/gnus.el index eb20575dc..ba790fb63 100644 --- a/lisp/gnus.el +++ b/lisp/gnus.el @@ -3565,7 +3565,7 @@ that that variable is buffer-local to the summary buffers." (nth 1 method)))) method))) -(defsubst gnus-method-to-server (method &optional nocache) +(defsubst gnus-method-to-server (method &optional nocache no-enter-cache) (catch 'server-name (setq method (or method gnus-select-method)) @@ -3591,7 +3591,9 @@ that that variable is buffer-local to the summary buffers." (format "%s" (car method)) (format "%s:%s" (car method) (cadr method)))) (name-method (cons name method))) - (unless (member name-method gnus-server-method-cache) + (when (and (not (member name-method gnus-server-method-cache)) + (not no-enter-cache) + (not (assoc (car name-method) gnus-server-method-cache))) (push name-method gnus-server-method-cache)) name))) @@ -3633,11 +3635,13 @@ that that variable is buffer-local to the summary buffers." (while alist (setq method (gnus-info-method (pop alist))) (when (and (not (stringp method)) - (equal server (gnus-method-to-server method))) + (equal server + (gnus-method-to-server method nil t))) (setq match method alist nil))) match)))) - (when result + (when (and result + (not (assoc server gnus-server-method-cache))) (push (cons server result) gnus-server-method-cache)) result))) -- 2.25.1