From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/85086 Path: news.gmane.org!not-for-mail From: Alexander Baier Newsgroups: gmane.emacs.gnus.general Subject: Re: Deleting mail in virtual group Date: Sun, 05 Oct 2014 20:28:11 +0200 Message-ID: <87tx3il6bo.fsf@mailbox.org> References: <87mw9cfazu.fsf@mailbox.org> <87zjdcyp8o.fsf@ericabrahamsen.net> <874mvkexiw.fsf@mailbox.org> <87a95a9ald.fsf@ericabrahamsen.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1412533788 15431 80.91.229.3 (5 Oct 2014 18:29:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 5 Oct 2014 18:29:48 +0000 (UTC) Cc: ding@gnus.org To: Eric Abrahamsen Original-X-From: ding-owner+M33330@lists.math.uh.edu Sun Oct 05 20:29:42 2014 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 1XaqYu-0006Gn-NT for ding-account@gmane.org; Sun, 05 Oct 2014 20:29:41 +0200 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 1XaqY6-0004w3-Il; Sun, 05 Oct 2014 13:28:50 -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 1XaqY3-0004vZ-5X for ding@lists.math.uh.edu; Sun, 05 Oct 2014 13:28:47 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) (envelope-from ) id 1XaqXx-0005DC-DB for ding@lists.math.uh.edu; Sun, 05 Oct 2014 13:28:46 -0500 Original-Received: from mx2.mailbox.org ([80.241.60.215]) by quimby.gnus.org with esmtp (Exim 4.80) (envelope-from ) id 1XaqXt-0001by-RK for ding@gnus.org; Sun, 05 Oct 2014 20:28:38 +0200 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 58F0D43C9F; Sun, 5 Oct 2014 20:28:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-type:content-type:mime-version:user-agent:message-id :in-reply-to:date:date:references:subject:subject:from:from :received; s=mail20140220; t=1412533705; bh=UYdtB/KaqwU7Wk/DyeJr Dq/3vQMk0I/kgihOq00VTXI=; b=X+ZvSsxgCZdD/yf2HD0lSQd4XpSHPmSutJNR qReD6jUybnySRVzqCaAxj5HANkM79mHFd3TzGnIKi7aZQupnbJ3eIFqZUWLmJ0Ia qMDKViulGBDUEv67mQFe21R6zEY8BNcbbu1/pQgS1MUwOrRY/mHBldlE1GY7gvtI hPOhdrgEkjUSY1gMdI4CRiufjQ7sJvG08MW1FJqwF90jcPqzhneI/+mHh4+3uMle j2vPRhIDv8uHk20S5dv0dj5VBtQk8HnGW0AGfdnrq5g+ovYlctZEVcM/MWOjU583 ZCuDi8i0WB71x3zTHH9HdCqylujn+sqZxf+xzRMog9WgBxxemIHLVnIuSvqZSdmU PBZ9nDzwpsA1XG9+Yz8SsgGf/BJN1ZPrla474Lqma0WjusUkAJCAHSJ811Uve966 4roUENlR6lKtNYvE7pHNWRjcAUueopvpe1ZNfLO7Zvo6PccPiGQtyyhSCLvK8coh oA6CyfZxoIGLpU7l3RYqWS9VaXMLZSwewp48qrp692BoDnjpKB2HiTgqinnDaF/c kCchhH04O0JhHYrLIWqN7HxfKZmNvEoUWDLrbAPtWmGPU X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) (using TLS with cipher AES256-GCM-SHA384) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTPS id rU_DQJGJVcY1; Sun, 5 Oct 2014 20:28:25 +0200 (CEST) Mail-Followup-To: Eric Abrahamsen , ding@gnus.org In-Reply-To: <87a95a9ald.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sun, 05 Oct 2014 16:36:46 +0800") User-Agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux) X-Spam-Score: -3.0 (---) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:85086 Archived-At: On 2014-10-05 10:36 Eric Abrahamsen wrote: > Alexander Baier writes: > >> On 2014-10-04 14:48 Eric Abrahamsen wrote: >>>> I want to write my own command that finds the original group of the >>>> article in question and executes the move in that group. Is there a >>>> function that gets me the original group of an article in a virtual >>>> group? >>> >>> I'm pretty sure that nnvirtual-find-group-art will do what you want. >>> Feed it the article number of the article under point, along with >>> gnus-newsgroup-name in the virtual Summary buffer. See how it works! >> >> Thank you for your quick reply! These to functions do what I want and I >> get the correct original group and article. But now I am stuck and do >> not know how to get to the original group. This is what I tried: >> >> #+BEGIN_SRC emacs-lisp >> (defun my-nnvirtual-delete-article () >> (interactive) >> (let ((original (nnvirtual-find-group-art >> gnus-newsgroup-name >> (gnus-summary-article-number)))) >> (with-current-buffer gnus-group-buffer >> (gnus-group-goto-group (car original)) >> (gnus-summary-goto-article (cdr original))))) >> #+END_SRC > > All `gnus-group-goto-group' does is move to the group's line in the > *Group* buffer. Try `gnus-group-read-group' instead. That -- or > something involving that -- ought to do what you want. Yes, gnus-group-read-group works! The following code takes the current article and moves it from its original group to a specified trash group: #+BEGIN_SRC emacs-lisp (defun my-nnvirtual-delete-article () (interactive) (let* ((original (nnvirtual-find-group-art gnus-newsgroup-name (gnus-summary-article-number))) (group (car original)) (article (cdr original)) (trash (cl-assoc group my-gnus-trash-locations :test (lambda (item rx) (string-match-p rx item))))) (unless trash (error "No trash folder configured for group %s" group)) (with-current-buffer gnus-group-buffer (gnus-group-read-group nil nil group (list article)) (gnus-summary-move-article 1 (cdr trash))))) (defvar my-gnus-trash-locations '(("nnmaildir\\+mailbox:.*" . "nnmaildir+mailbox:Trash")) "Locations of trash folders.") #+END_SRC The problem with this code is that I end up in the original group after the moving/deleting is finished and not in the virtual group. This surprises me, as I always thought of `with-current-buffer' as a macro that save my window configuration. Apparently this is not the case, why is that? Regards, -- Alexander Baier