Unnamed repository; edit this file 'description' to name the repository.
 help / color / Atom feed
From: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c <nn.throttle@xoxy.net>
To: info-gnus-english@gnu.org
Subject: Re: Treat article with external script
Date: Tue, 23 Jun 2020 10:24:10 +0200
Message-ID: <835zbiw5xr.fsf@helmutwaitzmann.news.arcor.de> (raw)
In-Reply-To: <875zblivyo.fsf@uva.nl>

Breanndán Ó Nualláin <o@uva.nl>:

>I'd like to be able to do article washing by running the article 
>through an external python script. Is there an easy way to do 

You could define a function:  

   (defun my-gnus-article-wash nil
     "Invoke the program '(car my-gnus-article-wash)' on the current buffer.
   If the variable 'my-gnus-article-wash' is a non-nil list of a
   program name and positional parameters, run it as a filter on
   the current buffer's contents."
     (if my-gnus-article-wash
         (function call-process-region)
         (car my-gnus-article-wash)
         (cdr my-gnus-article-wash))))

… and a variable:  

   (defvar my-gnus-article-wash nil
     "*invocation list to be executed on contents of the article buffer.
   If non-nil, is a list containing an executable file name and argv1
   ... argvn invocation arguments to execute on the contents of
   the article buffer and replacing it. One example would be
   '(\"iconv\" \"-t\" \"ASCII//TRANSLIT\")
   to transliterate every non-ASCII character to its corresponding
     ASCII approximate character.")

You might put the function and variable definitions in a file, for 
example "~/my_emacs_libs/gnus_wash_articles.el".  Byte compile 
that file.  Have it loaded from the emacs startup file: 

   (load "~/my_emacs_libs/gnus_wash_articles")

You might put the following assignments into the gnus startup 

Assign a value to the variable:  

     '("the_external_python_script" "and" "its" "parameters"))

Put the function into the gnus-part-display-hook:  

     (function my-gnus-article-wash))

That will invoke the python script with the given parameters on 
the article content. 

info-gnus-english mailing list

      reply index

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-20 15:43 Breanndán Ó Nualláin
2020-06-23  8:24 ` Helmut Waitzmann Anti-Spam-Ticket.b.qc3c [this message]

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:

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

  git send-email \
    --in-reply-to=835zbiw5xr.fsf@helmutwaitzmann.news.arcor.de \
    --to=nn.throttle@xoxy.net \
    --cc=info-gnus-english@gnu.org \
    --cc=oe.throttle@xoxy.net \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Unnamed repository; edit this file 'description' to name the repository.

Archives are clonable: git clone --mirror http://inbox.vuxu.org/info-gnus-english

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git