Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
From: Harry Putnam <reader@newsguy.com>
To: info-gnus-english@gnu.org
Subject: Anyone have elisp to unwind the agent groups list
Date: Thu, 01 Jun 2017 23:19:38 -0400	[thread overview]
Message-ID: <86o9u7oyu7.fsf@local.lan> (raw)

Wondering if anyone has a code snippet that unwinds the list of groups
under the agent; accessable at `J C' (opens the agent buffer)

  press `g' on the predicate of choice (press `p' if you need to see
  all or your predicates)

And up pops a list of groups all on one line.  If you have more than 3
or 4 it can be a bit taxing to read thru the list.

Since I'm a starkly illiterate elisper I wrote a primitive perl script
to do it... but wondered if any of you might have a snippet you've
kept that does that from gnus.

Being elisp challenged, I am rarely able to contribute here. So, even
at rist of being stoned by the perl community, I offer my sorry little
perl script that can be run against that list using the `alt-shift |'
command.  (shell-command-on-region)

-------       -------       ---=---       -------       -------

#!/usr/bin/perl

# Keywords: unwind_agent_groups
#        Keydate: 170601_192930 4
#
# Usage: `unwind_agent_groups' [Used in a pipe inside emacs/gnus]
#

use strict;
use warnings;

my ($myscript) = $0 =~ m{([^/]+)$};

my $usage = "
Purpose: print out agent groups in a list, one per line
  Usage: `$myscript'  <no args> [expected to be used in a pipe]
         inside emacs/gnus in J C buffer
";

if (@ARGV){
  if ($ARGV[0] eq "help") {
    warn "$usage\n";
    exit;
  }
}

my (@a, $parenless);
while (<>) {
  if (/\(/) {
     ($parenless) = $_  =~ m/[(]["](.*)["][)]$/;
     @a = split(/"\s+"/,$parenless);
   }
}
my $cnt = 0;
for (sort @a) {
  $cnt++;
  printf "%4d%s %s\n", $cnt,":",$_;
}




                 reply	other threads:[~2017-06-02  3:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86o9u7oyu7.fsf@local.lan \
    --to=reader@newsguy.com \
    --cc=info-gnus-english@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).