Unnamed repository; edit this file 'description' to name the repository.
 help / color / Atom feed
From: Tim Landscheidt <tim@tim-landscheidt.de>
To: Eric Abrahamsen <eric@ericabrahamsen.net>
Cc: info-gnus-english@gnu.org
Subject: Re: How to access HTML DOM/source of MIME part?
Date: Thu, 18 Jun 2020 02:50:30 +0000
Message-ID: <87lfklgk95.fsf@passepartout.tim-landscheidt.de> (raw)
In-Reply-To: <87bllibxug.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Tue, 16 Jun 2020 12:43:35 -0700")

Eric Abrahamsen <eric@ericabrahamsen.net> wrote:

>>> Something to be aware of is that, sometime not too long ago, Lars
>>> re-implemented links in article bodies using widgets instead of buttons.

>> The other way around -- they used to be widgets, and they're now
>> buttons.

> Sure enough, I didn't really know what I was talking about :) But at
> least that points to a likely source of Tim's problem: he's trying to
> use button commands in a version of Emacs/Gnus that is still using
> widgets?

Maybe :-).  Anyway, I found a solution for one of my news-
letters that states the number of entries in its subject and
then has two links per entry with one link containing one
information and the other link containing another informa-
tion and additional (older) entries following that:

| (let
|     ((subject (gnus-summary-article-subject)))
|   (if (string-match "^\\([0-9]+\\) new entries$" subject)
|       (let
|           ((number-of-entries-todo (string-to-number (match-string 1 subject))))
|         (gnus-with-article-buffer
|           (article-goto-body)
|           (let
|               ((article-body-start (point))
|                last-field1
|                last-url)
|             (while (> number-of-entries-todo 0)
|               (widget-forward 1)
|               (if (< (point) article-body-start)
|                   (error "Moved past the wrap!"))
|               (let
|                   ((url-at-point (button-get (button-at (point)) 'shr-url))
|                    (widget-label (let
|                                      ((widget-properties (cdr (widget-at))))
|                                    (buffer-substring-no-properties (plist-get widget-properties :from) (plist-get widget-properties :to)))))
|                 (when (string-match "^https://domain.com/some-prefix/" url-at-point)
|                   (if (not (string= last-url url-at-point))
|                       (setq last-field1 widget-label
|                             last-url url-at-point)
|                     (setq number-of-entries-todo (- number-of-entries-todo 1))
|                     (if (y-or-n-p (format "Browse %s (%s)? " widget-label last-field1))
|                         (browse-url url-at-point)))))))))))


a) The formula for widget-label feels way too complicated,
   but I did not find a predefined function for that pur-
   pose.  Did I miss something?

b) I use this code as part of gnus-select-article-hook.
   widget-forward does move point internally, but does not
   update/recenter the display.  Is this due to
   gnus-with-article-buffer?  What is the best way to make
   the *Article* buffer follow point's movement?


info-gnus-english mailing list

  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 22:36 Tim Landscheidt
2020-06-11 23:21 ` Eric Abrahamsen
2020-06-12  0:04   ` Tim Landscheidt
2020-06-16 15:34     ` Tim Landscheidt
2020-06-16 18:39       ` Eric Abrahamsen
2020-06-16 19:31         ` Lars Ingebrigtsen
2020-06-16 19:43           ` Eric Abrahamsen
2020-06-18  2:50             ` Tim Landscheidt [this message]
2020-06-26  9:30               ` Lars Ingebrigtsen

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lfklgk95.fsf@passepartout.tim-landscheidt.de \
    --to=tim@tim-landscheidt.de \
    --cc=eric@ericabrahamsen.net \
    --cc=info-gnus-english@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Unnamed repository; edit this file 'description' to name the repository.

Archives are clonable: git clone --mirror http://inbox.vuxu.org/info-gnus-english

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git