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 [thread overview]
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
>this?
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."
(interactive)
(if my-gnus-article-wash
(apply
(function call-process-region)
(point-min)
(point-max)
(car my-gnus-article-wash)
t
t
nil
(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
file:
Assign a value to the variable:
(setq-default
my-gnus-article-wash
'("the_external_python_script" "and" "its" "parameters"))
Put the function into the gnus-part-display-hook:
(add-hook
'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
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english
prev parent reply other threads:[~2020-06-23 8:25 UTC|newest]
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:
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=835zbiw5xr.fsf@helmutwaitzmann.news.arcor.de \
--to=nn.throttle@xoxy.net \
--cc=info-gnus-english@gnu.org \
--cc=oe.throttle@xoxy.net \
/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).