From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/87817 Path: news.gmane.org!.POSTED!not-for-mail From: Tim Landscheidt Newsgroups: gmane.emacs.gnus.general Subject: Re: how to make gnus print various group lists to stdout Date: Sat, 18 Nov 2017 18:08:04 +0000 Organization: http://www.tim-landscheidt.de/ Message-ID: <87mv3jjw8r.fsf@passepartout.tim-landscheidt.de> References: <86vanr7ei7.fsf@local.lan> <87h8zb5tfa.fsf@passepartout.tim-landscheidt.de> <86injr72ij.fsf@local.lan> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1511028571 17571 195.159.176.226 (18 Nov 2017 18:09:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 18 Nov 2017 18:09:31 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) To: ding@gnus.org Original-X-From: ding-owner+m36031@lists.math.uh.edu Sat Nov 18 19:09:27 2017 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from mxfilter-048035.atla03.us.yomura.com ([107.189.48.35]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eG7YV-0004E1-3T for ding-account@gmane.org; Sat, 18 Nov 2017 19:09:27 +0100 X-Yomura-MXScrub: 1.0 Original-Received: from lists1.math.uh.edu (unknown [129.7.128.208]) by mxfilter-048035.atla03.us.yomura.com (Halon) with ESMTPS id 9fcf84e8-cc8b-11e7-8154-b499baabecb2; Sat, 18 Nov 2017 18:09:32 +0000 (UTC) Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.89) (envelope-from ) id 1eG7Xc-0005G5-Ny; Sat, 18 Nov 2017 12:08:32 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eG7XZ-0005FL-J1 for ding@lists.math.uh.edu; Sat, 18 Nov 2017 12:08:29 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.89) (envelope-from ) id 1eG7XX-00042x-Hu for ding@lists.math.uh.edu; Sat, 18 Nov 2017 12:08:29 -0600 Original-Received: from [195.159.176.226] (helo=blaine.gmane.org) by quimby.gnus.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1eG7XW-0003xt-6G for ding@gnus.org; Sat, 18 Nov 2017 19:08:26 +0100 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1eG7XH-0008S4-6N for ding@gnus.org; Sat, 18 Nov 2017 19:08:11 +0100 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: ding@gnus.org Original-Lines: 63 Original-X-Complaints-To: usenet@blaine.gmane.org Mail-Copies-To: never Cancel-Lock: sha1:1jQPcRCWTUDqtu9g3Ia/eEPz2EQ= List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:87817 Archived-At: Harry Putnam wrote a long time ago: > […] >> you get a list of all groups. If you use: >> | (dolist (group gnus-newsrc-alist) >> | (if (equal (nth 4 group) '(nntp "news.gmane.org")) >> | (insert (format "%s\n" (car group))))) >> you get a list of all groups for Gmane. > This second one looks like it could be edited to make it produce a > list from any foreign groups too. > I'm curious what the `nth 4 group' is all about... is it a reference > to level 4? No, it returns the fifth element of the list referred to by group (C-h f nth RET). > Also I should say that the second example does nothing here.. well it > prints `nil' when evaluated with C-x C-e > I do have gmane in ~/.gnus like this: > (setq gnus-select-method '(nntp "news.gmane.org")) To be clear, my approach to gnus-newsrc-alist and other Gnus data structures is entirely example-based: I look at my data and see that my Gmane groups have the fifth element set to '(nntp "news.gmane.org"), so I search for that. That works for me because I have gnus-select-method set to '(nnml "private"), so Gmane groups are … foreign groups (?) which have their fifth element set to '(nntp "news.gmane.org"). With gnus-select-method set to Gmane, you will need to adapt the filter expression (maybe the fifth element is nil for native groups?). > Oh, and how would I go about making emacs/gnus send any list information > to stdout or to file? I would open a buffer with a new (empty) file and run the code above while in this buffer. This inserts the list of groups there and you can then save the buffer as usual. If you want to use the information in a pipe, that is a lot more complicated. For example, the code above assumes that Gnus is running, so you would have to call Emacs with --eval to start Gnus, output the list to stdout and then quit Gnus again which I would shy away from just because too much could go wrong (accidentally starting multiple Gnus in- stances at the same time can lead to data loss). You could also execute a script with --eval to open ~/.newsrc.eld, parse that buffer with read into a variable and then process that variable. But all solutions have in common that you will need to learn at least the basics of Emacs Lisp :-). So I would start with "An Introduction to Programming in Emacs Lisp" (C-h i g (eintr) RET). Tim