Gnus development mailing list
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: Best way to execute a function on article view?
Date: Wed, 19 Apr 2017 07:55:33 -0700	[thread overview]
Message-ID: <87k26g8n16.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87wpagk85q.fsf@passepartout.tim-landscheidt.de>

Tim Landscheidt <tim@tim-landscheidt.de> writes:

> Hi,
>
> I have a function along the lines of:
>
> | (gnus-with-article-buffer
> |   (while (search-forward-regexp "^Alle Änderungen auf einen Blick:\n\\(https://de\\.wikipedia\\.org/w/index\\.php\\?title=.*&diff=0&oldid=[0-9]+\\)$" (point-max) t)
> |     (browse-url (match-string 1)))
> |   (gnus-summary-next-unread-article))
>
> This searches the article for a URL and launches Firefox
> (and moves to the next article).
>
> Unfortunately this is somewhat orthogonal to my usual (most-
> ly SPC-oriented) workflow for reading things.  I therefore
> like to change my setup so that:
>
> 1. I select an article with SPC,
> 2. if the article contains such a URL, Gnus prompts me
>    (y-or-n-p) if I want to browse that URL,
> 3. if I press SPC (which is "y" for y-or-n-p), the URL is
>    browsed, and
> 4. if after that prompt I hit SPC again, the next unread ar-
>    ticle is selected.
>
> So in my "usual" workflow I wouldn't have to press anything
> but SPC.
>
> What is the best way to achieve that behaviour?  From a cur-
> sory look at the manual, gnus-article-prepare-hook seems to
> be the relevant hook.

I usually use `gnus-select-article-hook' for things like this, which run
a little later than the prepare hook. Probably either of them would be
fine, though.

> se there alternatives that are a better fit, for example a
> washing function or something else?  One thing that would be
> nice to have (additionally) is a similar behaviour to
> gnus-summary-save-article (browse the URL in this article,
> or in the next N, or in the previous - N, or in the articles
> in the region, or in the marked articles (but in all but the
> first case with no prompt)).

The function that does that is `gnus-summary-work-articles' -- it
takes into account marked articles, the prefix arg, etc, when returning
a list of articles to use.

Eric




      reply	other threads:[~2017-04-19 14:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-19 10:43 Tim Landscheidt
2017-04-19 14:55 ` Eric Abrahamsen [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=87k26g8n16.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=ding@gnus.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).