Discussion:
Anyone have elisp to unwind the agent groups list
Harry Putnam
2017-06-02 03:19:38 UTC
Permalink
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,":",$_;
}

Loading...