Gnus development mailing list
 help / color / mirror / Atom feed
From: John Magolske <listmail@b79.net>
To: ding@gnus.org
Cc: Andreas Schwab <schwab@linux-m68k.org>
Subject: Re: writing a function that pipes the html mime part to an external script
Date: Thu, 02 Feb 2017 00:33:32 -0800	[thread overview]
Message-ID: <871svh3sbn.fsf@b79.net> (raw)
In-Reply-To: <87bmv1h9nu.fsf@b79.net> (John Magolske's message of "Fri, 20 Jan 2017 10:24:21 -0800")

> Andreas Schwab <schwab@linux-m68k.org> writes:
>>> Andreas Schwab <schwab@linux-m68k.org> writes:
>>>> On Jan 19 2017, John Magolske <listmail@b79.net> 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



  reply	other threads:[~2017-02-02  8:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20  6:59 John Magolske
2017-01-20 10:41 ` Andreas Schwab
2017-01-20 15:56   ` John Magolske
2017-01-20 17:51     ` Andreas Schwab
2017-01-20 18:24       ` John Magolske
2017-02-02  8:33         ` John Magolske [this message]
2017-01-20 18:07     ` Eric Abrahamsen
2017-01-20 20:04       ` John Magolske
2017-01-20 20:34         ` Eric Abrahamsen

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=871svh3sbn.fsf@b79.net \
    --to=listmail@b79.net \
    --cc=ding@gnus.org \
    --cc=schwab@linux-m68k.org \
    /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).