From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/81611 Path: news.gmane.org!not-for-mail From: Dave Abrahams Newsgroups: gmane.emacs.gnus.general Subject: [PATCH 4/5] Add `gnus-try-warping-via-registry()' Date: Thu, 15 Mar 2012 14:23:12 -0400 Message-ID: <1331835793-70228-5-git-send-email-dave@boostpro.com> References: <1331835793-70228-1-git-send-email-dave@boostpro.com> NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1331835934 18870 80.91.229.3 (15 Mar 2012 18:25:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 15 Mar 2012 18:25:34 +0000 (UTC) Cc: Dave Abrahams To: ding@gnus.org Original-X-From: ding-owner+M29887@lists.math.uh.edu Thu Mar 15 19:25:30 2012 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1S8FMX-0008ND-Se for ding-account@gmane.org; Thu, 15 Mar 2012 19:25:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1S8FLT-0003fj-UD; Thu, 15 Mar 2012 13:24:15 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1S8FLQ-0003fN-Pv for ding@lists.math.uh.edu; Thu, 15 Mar 2012 13:24:12 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1S8FLP-0001Tc-1d for ding@lists.math.uh.edu; Thu, 15 Mar 2012 13:24:12 -0500 Original-Received: from mail-gy0-f172.google.com ([209.85.160.172]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1S8FLN-0000h1-H0 for ding@gnus.org; Thu, 15 Mar 2012 19:24:09 +0100 Original-Received: by ghbg16 with SMTP id g16so4439659ghb.17 for ; Thu, 15 Mar 2012 11:24:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=M7UVEz1XrwuCBxD2doNBD8+053Rs08/f1xLlQT+m090=; b=lH3M1lx0nC/Tn7F2FqITqvtmAb7lWRreq66+6/TIuf1gwIBui1yfx4X9PIaNMOun/m 2raI811LYp9KP9x8dn0BxVqrHuCpZv+0pwwz8mVnXe/A99kGKOK4S6hRBLLTBu/H87uW 5UqPa4em6cbt3vXSN2HJTKeTXZrT6VU+SyFDKCmZbYUdV47Ct7w0rRT/ciIyQmfP5JpN yb5ztXae6PAFd9/gv6SBV/Rh4yIIN/3lAGawcTCwYL/COPKgW8zZqi3syGmMug91YjiZ 53Dw5RvjfgQAx1FvubGTkSrq5pDkubMnCRhxHXfzwm9mgHhiL2JamrMXbMnD3Q3bDnL+ 5YYg== Original-Received: by 10.229.106.83 with SMTP id w19mr2650479qco.106.1331835843512; Thu, 15 Mar 2012 11:24:03 -0700 (PDT) Original-Received: from pluto.luannocracy.com (207-172-223-249.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com. [207.172.223.249]) by mx.google.com with ESMTPS id z6sm5378736qap.17.2012.03.15.11.24.02 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Mar 2012 11:24:03 -0700 (PDT) X-Mailer: git-send-email 1.7.9.2 In-Reply-To: <1331835793-70228-1-git-send-email-dave@boostpro.com> X-Gm-Message-State: ALoCoQkUCTzmSIYsQHAPn1hXVjBwIUSn1L5vvEmYna8Hmher0QYWlfdUMElGa8P76LTnKU+VCIPC X-Spam-Score: -2.9 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:81611 Archived-At: The new function attempts to warp to the article based on group information stored for the article in the registry. --- lisp/gnus-int.el | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el index 8a00c4a..4ae6e2a 100644 --- a/lisp/gnus-int.el +++ b/lisp/gnus-int.el @@ -576,6 +576,56 @@ the group's summary. (error (when group-is-new (gnus-summary-exit)) (apply 'signal err))))) +(defun gnus-simplify-group-name (group) + "Return the simplest representation of the name of GROUP. +This is the string that Gnus uses to identify the group." + (gnus-group-prefixed-name + (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." -- 1.7.5.4