[gnus git] branch master updated: n0-17-348-g2960194 =1= Introduce gnus-registry-enabled and use it consistently.

Ted Zlatanov <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  2960194fb4cc6ad0af5b9a64c350110cd2509c54 (commit)
      from  ad0f048aaf5f8cac4312c55117171719d511ca13 (commit)


- Log -----------------------------------------------------------------
commit 2960194fb4cc6ad0af5b9a64c350110cd2509c54
Author: Ted Zlatanov <[email protected]>
Date:   Mon Oct 17 13:24:16 2011 -0400

    Introduce gnus-registry-enabled and use it consistently.
    
    * gnus-registry.el (gnus-registry-enabled): Add new variable.
    (gnus-registry-install-shortcuts): Set `gnus-registry-install' to 'ask
    only while we need to find out if it should be t or nil.
    (gnus-registry-initialize): Don't set `gnus-registry-install' to t.
    (gnus-registry-install-hooks): Set `gnus-registry-enabled' to t when
    the registry is installed.  Set it to nil when it's unloaded.
    (gnus-registry-install-p): Provide user guidance for the initial value
    of `gnus-registry-install' when it's 'ask, otherwise return its value.
    * nnregistry.el (nnregistry-open-server, nnregistry-server-opened): Use
    `gnus-registry-enabled' instead of `gnus-registry-install'.
    * nnmairix.el (nnmairix-determine-original-group-from-registry): Use
    `gnus-registry-enabled' instead of `gnus-registry-install'.
    * nnir.el (nnir-mode): Use `gnus-registry-enabled' instead of
    `gnus-registry-install'.
    From Dave Abrahams <[email protected]>.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f70fd1c..8dfe8f3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,21 @@
+2011-10-17  Teodor Zlatanov  <[email protected]>
+
+	* gnus-registry.el (gnus-registry-enabled): Add new variable.
+	(gnus-registry-install-shortcuts): Set `gnus-registry-install' to 'ask
+	only while we need to find out if it should be t or nil.
+	(gnus-registry-initialize): Don't set `gnus-registry-install' to t.
+	(gnus-registry-install-hooks): Set `gnus-registry-enabled' to t when
+	the registry is installed.  Set it to nil when it's unloaded.
+	(gnus-registry-install-p): Provide user guidance for the initial value
+	of `gnus-registry-install' when it's 'ask, otherwise return its value.
+	* nnregistry.el (nnregistry-open-server, nnregistry-server-opened): Use
+	`gnus-registry-enabled' instead of `gnus-registry-install'.
+	* nnmairix.el (nnmairix-determine-original-group-from-registry): Use
+	`gnus-registry-enabled' instead of `gnus-registry-install'.
+	* nnir.el (nnir-mode): Use `gnus-registry-enabled' instead of
+	`gnus-registry-install'.
+	From Dave Abrahams <[email protected]>.
+
 2011-10-17  Daiki Ueno  <[email protected]>
 
 	* mml2015.el (mml2015-epg-find-usable-key): Skip the whole key if the
diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el
index f8ff52f..652e816 100644
--- a/lisp/gnus-registry.el
+++ b/lisp/gnus-registry.el
@@ -164,6 +164,8 @@ nnmairix groups are specifically excluded because they are ephemeral."
                  (const :tag "Always Install" t)
                  (const :tag "Ask Me" ask)))
 
+(defvar gnus-registry-enabled)
+
 (defvar gnus-summary-misc-menu) ;; Avoid byte compiler warning.
 
 (defvar gnus-registry-misc-menus nil)   ; ugly way to keep the menus
@@ -873,8 +875,9 @@ Uses `gnus-registry-marks' to find what shortcuts to install."
 
                  ;; if this is called and the user doesn't want the
                  ;; registry enabled, we'll ask anyhow
-                 (when (eq gnus-registry-install nil)
-                   (setq gnus-registry-install 'ask))
+                 (unless gnus-registry-install
+                   (let ((gnus-registry-install 'ask))
+                     (gnus-registry-install-p)))
 
                  ;; now the user is asked if gnus-registry-install is 'ask
                  (when (gnus-registry-install-p)
@@ -1151,7 +1154,6 @@ only the last one's marks are returned."
 "Initialize the Gnus registry."
   (interactive)
   (gnus-message 5 "Initializing the registry")
-  (setq gnus-registry-install t)        ; in case it was 'ask or nil
   (gnus-registry-install-hooks)
   (gnus-registry-install-shortcuts)
   (gnus-registry-read))
@@ -1160,6 +1162,7 @@ only the last one's marks are returned."
 (defun gnus-registry-install-hooks ()
   "Install the registry hooks."
   (interactive)
+  (setq gnus-registry-enabled t)
   (add-hook 'gnus-summary-article-move-hook 'gnus-registry-action)
   (add-hook 'gnus-summary-article-delete-hook 'gnus-registry-action)
   (add-hook 'gnus-summary-article-expire-hook 'gnus-registry-action)
@@ -1181,23 +1184,25 @@ only the last one's marks are returned."
   (remove-hook 'gnus-save-newsrc-hook 'gnus-registry-save)
   (remove-hook 'gnus-read-newsrc-el-hook 'gnus-registry-read)
 
-  (remove-hook 'gnus-summary-prepare-hook 'gnus-registry-register-message-ids))
+  (remove-hook 'gnus-summary-prepare-hook 'gnus-registry-register-message-ids)
+  (setq gnus-registry-enabled nil))
 
 (add-hook 'gnus-registry-unload-hook 'gnus-registry-unload-hook)
 
 (defun gnus-registry-install-p ()
+  "If the registry is not already enabled, and `gnus-registry-install' is t,
+the registry is enabled.  If `gnus-registry-install' is `ask',
+the user is asked first.  Returns non-nil iff the registry is enabled."
   (interactive)
-  (when (eq gnus-registry-install 'ask)
-    (setq gnus-registry-install
+  (unless gnus-registry-enabled
+    (when (if (eq gnus-registry-install 'ask)
           (gnus-y-or-n-p
            (concat "Enable the Gnus registry?  "
                    "See the variable `gnus-registry-install' "
-                   "to get rid of this query permanently. ")))
-    (when gnus-registry-install
-      ;; we just set gnus-registry-install to t, so initialize the registry!
-      (gnus-registry-initialize)))
-;;; we could call it here: (customize-variable 'gnus-registry-install)
+                       "to get rid of this query permanently. "))
   gnus-registry-install)
+      (gnus-registry-initialize)))
+  gnus-registry-enabled)
 
 ;; TODO: a few things
 
diff --git a/lisp/nnir.el b/lisp/nnir.el
index 0be6a17..cbd3f74 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -290,8 +290,7 @@ is `(valuefunc member)'."
   (autoload 'nnimap-command "nnimap")
   (autoload 'nnimap-possibly-change-group "nnimap")
   (autoload 'nnimap-make-thread-query "nnimap")
-  (autoload 'gnus-registry-action "gnus-registry")
-  (defvar gnus-registry-install))
+  (autoload 'gnus-registry-action "gnus-registry"))
 
 
 (nnoo-declare nnir)
@@ -1741,8 +1740,7 @@ environment unless `not-global' is non-nil."
   (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir)
     (setq gnus-summary-line-format
 	  (or nnir-summary-line-format gnus-summary-line-format))
-    (when (and (boundp 'gnus-registry-install)
-		       (eq gnus-registry-install t))
+    (when (bound-and-true-p gnus-registry-enabled)
       (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t)
       (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t)
       (remove-hook 'gnus-summary-article-expire-hook 'gnus-registry-action t)
diff --git a/lisp/nnmairix.el b/lisp/nnmairix.el
index 3d1ac02..f81aa03 100644
--- a/lisp/nnmairix.el
+++ b/lisp/nnmairix.el
@@ -603,7 +603,6 @@ Other back ends might or might not work.")
     nil))
 
 ;; Silence byte-compiler.
-(defvar gnus-registry-install)
 (autoload 'gnus-registry-get-id-key "gnus-registry")
 
 (deffoo nnmairix-request-set-mark (group actions &optional server)
@@ -1636,8 +1635,7 @@ search in raw mode."
 
 (defun nnmairix-determine-original-group-from-registry (mid)
   "Try to determinale original group for message-id MID from the registry."
-  (when (and (boundp 'gnus-registry-install)
-	     gnus-registry-install)
+  (when (bound-and-true-p gnus-registry-enabled)
     (unless (string-match "^<" mid)
       (set mid (concat "<" mid)))
     (unless (string-match ">$" mid)
diff --git a/lisp/nnregistry.el b/lisp/nnregistry.el
index 359050c..75a640a 100644
--- a/lisp/nnregistry.el
+++ b/lisp/nnregistry.el
@@ -36,8 +36,11 @@
 
 (nnoo-declare nnregistry)
 
+;; Suppress byte-compiler warning `reference to free variable'
+(defvar gnus-registry-enabled)
+
 (deffoo nnregistry-server-opened (server)
-  (eq gnus-registry-install t))
+  gnus-registry-enabled)
 
 (deffoo nnregistry-close-server (server)
   t)
@@ -46,7 +49,7 @@
   nil)
 
 (deffoo nnregistry-open-server (server &optional defs)
-  (eq gnus-registry-install t))
+  gnus-registry-enabled)
 
 (defvar nnregistry-within-nnregistry nil)
 

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog        |   18 ++++++++++++++++++
 lisp/gnus-registry.el |   33 +++++++++++++++++++--------------
 lisp/nnir.el          |    6 ++----
 lisp/nnmairix.el      |    4 +---
 lisp/nnregistry.el    |    7 +++++--
 5 files changed, 45 insertions(+), 23 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.