From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/87464 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: Re: Best way to execute a function on article view? Date: Wed, 19 Apr 2017 07:55:33 -0700 Message-ID: <87k26g8n16.fsf@ericabrahamsen.net> References: <87wpagk85q.fsf@passepartout.tim-landscheidt.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1492613818 16852 195.159.176.226 (19 Apr 2017 14:56:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 19 Apr 2017 14:56:58 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: ding@gnus.org Original-X-From: ding-owner+m35685@lists.math.uh.edu Wed Apr 19 16:56:54 2017 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from mxfilter-048034.atla03.us.yomura.com ([107.189.48.34]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d0r2K-0004Ek-S9 for ding-account@gmane.org; Wed, 19 Apr 2017 16:56:52 +0200 X-Yomura-MXScrub: 1.0 Original-Received: from lists1.math.uh.edu (unknown [129.7.128.208]) by mxfilter-048034.atla03.us.yomura.com (Halon) with ESMTPS id 6e412179-2510-11e7-8ed1-b499baa2b07a; Wed, 19 Apr 2017 14:56:56 +0000 (UTC) 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 1d0r1h-00064t-AT; Wed, 19 Apr 2017 09:56:13 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1d0r1c-000649-St for ding@lists.math.uh.edu; Wed, 19 Apr 2017 09:56:08 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.87) (envelope-from ) id 1d0r1b-0003sA-IC for ding@lists.math.uh.edu; Wed, 19 Apr 2017 09:56:08 -0500 Original-Received: from [195.159.176.226] (helo=blaine.gmane.org) by quimby.gnus.org with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1d0r1Y-0002cz-7I for ding@gnus.org; Wed, 19 Apr 2017 16:56:04 +0200 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1d0r1P-0002xL-J1 for ding@gnus.org; Wed, 19 Apr 2017 16:55:55 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 50 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:T3gu8bbbWEPM+TAgpSHW7apFZ8Q= List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:87464 Archived-At: Tim Landscheidt 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