Unnamed repository; edit this file 'description' to name the repository.
 help / color / Atom feed
* Treat article with external script
@ 2020-06-20 15:43 Breanndán Ó Nualláin
  2020-06-23  8:24 ` Helmut Waitzmann Anti-Spam-Ticket.b.qc3c
  0 siblings, 1 reply; 2+ messages in thread
From: Breanndán Ó Nualláin @ 2020-06-20 15:43 UTC (permalink / raw)
  To: info-gnus-english

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?


_______________________________________________
info-gnus-english mailing list
info-gnus-english@gnu.org
https://lists.gnu.org/mailman/listinfo/info-gnus-english

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Treat article with external script
  2020-06-20 15:43 Treat article with external script Breanndán Ó Nualláin
@ 2020-06-23  8:24 ` Helmut Waitzmann Anti-Spam-Ticket.b.qc3c
  0 siblings, 0 replies; 2+ messages in thread
From: Helmut Waitzmann Anti-Spam-Ticket.b.qc3c @ 2020-06-23  8:24 UTC (permalink / raw)
  To: info-gnus-english

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-20 15:43 Treat article with external script Breanndán Ó Nualláin
2020-06-23  8:24 ` Helmut Waitzmann Anti-Spam-Ticket.b.qc3c

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:
	nntp://inbox.vuxu.org/vuxu.archive.emacs.gnus.user


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