Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* Anyone have elisp to unwind the agent groups list
@ 2017-06-02  3:19 Harry Putnam
  0 siblings, 0 replies; only message in thread
From: Harry Putnam @ 2017-06-02  3:19 UTC (permalink / raw)
  To: info-gnus-english

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,":",$_;
}




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-02  3:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-02  3:19 Anyone have elisp to unwind the agent groups list Harry Putnam

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).