+2012-03-22 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * gnus.el: Register gnus-registry functions.
+
+ * gnus-registry.el (gnus-try-warping-via-registry): Moved here and
+ indent.
+
+ * gnus-int.el (gnus-warp-to-article): Check whether the registry is
+ enabled before warping.
+
2012-03-22 Dave Abrahams <dave@boostpro.com>
* gnus-sum.el (gnus-summary-insert-subject): Record information in the
(gnus-group-real-name group)
(gnus-group-method group)))
-;; largely based on nnir-warp-to-article
-(defun gnus-try-warping-via-registry ()
- "Attempt to warp to the current article's source group based on
-data stored in the registry."
- (interactive)
- (when (gnus-summary-article-header)
- (let* ((message-id (mail-header-id (gnus-summary-article-header)))
- ;; Retrieve the message's group(s) from the registry
- (groups (gnus-registry-get-id-key message-id 'group))
- ;; If starting from an ephemeral group, this describes
- ;; how to restore the window configuration
- (quit-config
- (gnus-ephemeral-group-p gnus-newsgroup-name))
- (seen-groups (list (gnus-group-group-name))))
-
- (catch 'found
- (dolist (group (mapcar 'gnus-simplify-group-name groups))
-
- ;; skip over any groups we really don't want to warp to.
- (unless (or (member group seen-groups)
- (gnus-ephemeral-group-p group) ;; any ephemeral group
- (memq (car (gnus-find-method-for-group group))
- '(nnir))) ;; Specific methods; this list may need to expand.
-
- ;; remember that we've seen this group already
- (push group seen-groups)
-
- ;; first exit from any ephemeral summary buffer.
- (when quit-config
- (gnus-summary-exit)
- ;; and if the ephemeral summary buffer in turn came from another
- ;; summary buffer we have to clean that summary up too.
- (when (eq (cdr quit-config) 'summary)
- (gnus-summary-exit))
- ;; remember that we've already done this part
- (setq quit-config nil))
-
- ;; Try to activate the group. If that fails, just move
- ;; along. We may have more groups to work with
- (ignore-errors
- (gnus-select-group-with-message-id group message-id))
- (throw 'found t)))))))
-
(defun gnus-warp-to-article ()
"Warps from an article in a virtual group to the article in its
real group. Does nothing on a real group."
(when (gnus-check-backend-function
'warp-to-article (car gnus-command-method))
(funcall (gnus-get-function gnus-command-method 'warp-to-article)))
- (gnus-try-warping-via-registry))))
+ (and (bound-and-true-p gnus-registry-enabled)
+ (gnus-try-warping-via-registry)))))
(defun gnus-request-head (article group)
"Request the head of ARTICLE in GROUP."
(gnus-registry-initialize)))
gnus-registry-enabled)
+;; largely based on nnir-warp-to-article
+(defun gnus-try-warping-via-registry ()
+ "Try to warp via the registry.
+This will be done via the current article's source group based on
+data stored in the registry."
+ (interactive)
+ (when (gnus-summary-article-header)
+ (let* ((message-id (mail-header-id (gnus-summary-article-header)))
+ ;; Retrieve the message's group(s) from the registry
+ (groups (gnus-registry-get-id-key message-id 'group))
+ ;; If starting from an ephemeral group, this describes
+ ;; how to restore the window configuration
+ (quit-config
+ (gnus-ephemeral-group-p gnus-newsgroup-name))
+ (seen-groups (list (gnus-group-group-name))))
+
+ (catch 'found
+ (dolist (group (mapcar 'gnus-simplify-group-name groups))
+
+ ;; skip over any groups we really don't want to warp to.
+ (unless (or (member group seen-groups)
+ (gnus-ephemeral-group-p group) ;; any ephemeral group
+ (memq (car (gnus-find-method-for-group group))
+ ;; Specific methods; this list may need to expand.
+ '(nnir)))
+
+ ;; remember that we've seen this group already
+ (push group seen-groups)
+
+ ;; first exit from any ephemeral summary buffer.
+ (when quit-config
+ (gnus-summary-exit)
+ ;; and if the ephemeral summary buffer in turn came from
+ ;; another summary buffer we have to clean that summary
+ ;; up too.
+ (when (eq (cdr quit-config) 'summary)
+ (gnus-summary-exit))
+ ;; remember that we've already done this part
+ (setq quit-config nil))
+
+ ;; Try to activate the group. If that fails, just move
+ ;; along. We may have more groups to work with
+ (ignore-errors
+ (gnus-select-group-with-message-id group message-id))
+ (throw 'found t)))))))
+
;; TODO: a few things
(provide 'gnus-registry)
("gnus-kill" gnus-kill gnus-apply-kill-file-internal
gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
+ ("gnus-registry" gnus-try-warping-via-registry
+ gnus-registry-handle-action)
("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
gnus-cache-possibly-remove-articles gnus-cache-request-article
gnus-cache-retrieve-headers gnus-cache-possibly-alter-active