* Best way to execute a function on article view?
@ 2017-04-19 10:43 Tim Landscheidt
2017-04-19 14:55 ` Eric Abrahamsen
0 siblings, 1 reply; 2+ messages in thread
From: Tim Landscheidt @ 2017-04-19 10:43 UTC (permalink / raw)
To: ding
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.
Are 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)).
Tim
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Best way to execute a function on article view?
2017-04-19 10:43 Best way to execute a function on article view? Tim Landscheidt
@ 2017-04-19 14:55 ` Eric Abrahamsen
0 siblings, 0 replies; 2+ messages in thread
From: Eric Abrahamsen @ 2017-04-19 14:55 UTC (permalink / raw)
To: ding
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-19 14:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 10:43 Best way to execute a function on article view? Tim Landscheidt
2017-04-19 14:55 ` Eric Abrahamsen
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).