From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/87359 Path: news.gmane.org!.POSTED!not-for-mail From: John Magolske Newsgroups: gmane.emacs.gnus.general Subject: Re: writing a function that pipes the html mime part to an external script Date: Thu, 02 Feb 2017 00:33:32 -0800 Message-ID: <871svh3sbn.fsf@b79.net> References: <877f5qi5df.fsf@b79.net> <87efzy9fnw.fsf@linux-m68k.org> <87r33xhgic.fsf@b79.net> <8760l9aabr.fsf@linux-m68k.org> <87bmv1h9nu.fsf@b79.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1486026173 31445 195.159.176.226 (2 Feb 2017 09:02:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 2 Feb 2017 09:02:53 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.95 (gnu/linux) Cc: Andreas Schwab To: ding@gnus.org Original-X-From: ding-owner+M35580@lists.math.uh.edu Thu Feb 02 10:02:47 2017 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from lists1.math.uh.edu ([129.7.128.208]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZDHy-0007ur-FF for ding-account@gmane.org; Thu, 02 Feb 2017 10:02:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.87) (envelope-from ) id 1cZDGs-0000iU-ET; Thu, 02 Feb 2017 03:01:38 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1cZDGr-0000i4-6C for ding@lists.math.uh.edu; Thu, 02 Feb 2017 03:01:37 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.87) (envelope-from ) id 1cZDGo-0007JB-PU for ding@lists.math.uh.edu; Thu, 02 Feb 2017 03:01:37 -0600 Original-Received: from mail6.webfaction.com ([74.55.86.74] helo=smtp.webfaction.com) by quimby.gnus.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1cZDGl-0004SX-MJ for ding@gnus.org; Thu, 02 Feb 2017 10:01:31 +0100 Original-Received: from localhost (50-0-151-112.dsl.dynamic.fusionbroadband.com [50.0.151.112]) by smtp.webfaction.com (Postfix) with ESMTP id 54E45219B844; Thu, 2 Feb 2017 08:32:58 +0000 (UTC) In-Reply-To: <87bmv1h9nu.fsf@b79.net> (John Magolske's message of "Fri, 20 Jan 2017 10:24:21 -0800") List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:87359 Archived-At: > Andreas Schwab writes: >>> Andreas Schwab writes: >>>> On Jan 19 2017, John Magolske wrote: >>>> >>>>> and everything works as intended. But I'd like to do away with that last >>>>> step of having to manually enter the shell command, somehow placing that >>>>> "~/bin/pipe_to_tmp" directly into a function that could be mapped to a >>>>> key binding. I've been messing around with mm-pipe-part but haven't >>>>> found a way to do this. Any suggestions? >>>> >>>> Write a function that calls mm-pipe-part directly. >>> > >> Or pass gnus-article-part-wrapper a function that calls mm-pipe-part >> like above. This ended up working out rather well: (defun jfm-pipe-part-view-post (handle) (mm-pipe-part handle "~/bin/rss_post_view.sh")) (defun jfm-pipe-part-1-view-post () (interactive) (gnus-article-part-wrapper 1 'jfm-pipe-part-view-post) (gnus-switch-to-summary-buffer) (gnus-summary-goto-article gnus-current-article nil t)) (define-key gnus-summary-mode-map (kbd "C-@") 'jfm-pipe-part-1-view-post) and my rss_post_view.sh is as follows (uses ELinks running in tmux, note that document.browse.margin_width is used with a custom-patched ELinks): #!/bin/bash rm -rf /tmp/pipe-post1 mkfifo /tmp/pipe-post1 cat | grep "View post" | sed -e 's/^.*\(http.*\)".*/\1/g' >| /tmp/pipe-post1 & url=\"`cat /tmp/pipe-post1&`\" #echo $url #exit 0 if # check if there's an elinks running on session-ring 21 elinks -session-ring 21 -remote 'ping()' 2>&1 | grep 'No running ELinks' >/dev/null then # if not, then start one on tmux window 98 and open the URL called above tmux new-window -n rss -t 98 "elinks -force-html -touch-files 1 -session-ring 21 -eval 'set document.browse.margin_width = 18' -eval 'set document.browse.use_margin = 1' $url" sleep 3 else # otherwise open the URL in the existing session-ring 21 elinks... elinks -force-html -touch-files 1 -session-ring 21 -eval 'set document.browse.margin_width = 18' -eval 'set document.browse.use_margin = 1' -remote openURL\($url,new-tab\) fi That grabs the url to articles ("View post") in rss feeds and opens them in successive tabs in Elinks, allowing me to quickly go through a series of rss items, opening the main articles in a backround browser one after another without having Emacs "freeze" or wait while webpages load. To gather rss feeds I use https://github.com/sloonz/ua , which fetches rss feeds and loads them into a maidir. After trying a variety of the the "rss2maildir" packages out there, I've found ua to be quite nice. Regards, John -- John Magolske http://b79.net/contact