From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/88339 Path: news.gmane.org!.POSTED.ciao.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: Re: Command for browsing article URLs? Date: Tue, 22 Jan 2019 15:45:14 -0800 Message-ID: <87pnso9rzp.fsf@ericabrahamsen.net> References: <878szwwdjw.fsf@ericabrahamsen.net> <87a7k8wg9k.fsf@ericabrahamsen.net> <87wonbts5s.fsf@ucl.ac.uk> <87fttzc4lo.fsf@ericabrahamsen.net> <87sgxpzvsr.fsf@ericabrahamsen.net> <87r2d8c3az.fsf@ucl.ac.uk> <874la1yjjo.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.org; posting-host="ciao.gmane.org:195.159.176.228"; logging-data="183218"; mail-complaints-to="usenet@ciao.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) To: ding@gnus.org Original-X-From: ding-owner+M36549@lists.math.uh.edu Wed Jan 23 00:46:18 2019 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from lists1.math.uh.edu ([129.7.128.208]) by ciao.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gm5kH-000lW6-En for ding-account@gmane.org; Wed, 23 Jan 2019 00:46:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.91) (envelope-from ) id 1gm5jc-0000rr-VY; Tue, 22 Jan 2019 17:45:37 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.91) (envelope-from ) id 1gm5jX-0000p9-72 for ding@lists.math.uh.edu; Tue, 22 Jan 2019 17:45:31 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.91) (envelope-from ) id 1gm5jV-0004Nl-Kq for ding@lists.math.uh.edu; Tue, 22 Jan 2019 17:45:31 -0600 Original-Received: from [195.159.176.228] (helo=ciao.gmane.org) by quimby.gnus.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gm5jR-0007jE-TE for ding@gnus.org; Wed, 23 Jan 2019 00:45:27 +0100 Original-Received: from list by ciao.gmane.org with local (Exim 4.89) (envelope-from ) id 1gm5jP-000kiN-IL for ding@gnus.org; Wed, 23 Jan 2019 00:45:23 +0100 X-Injected-Via-Gmane: http://gmane.org/ Cancel-Lock: sha1:fN8QackdW6FbKGVHDl7Ss8eAAok= List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:88339 Archived-At: Eric Abrahamsen writes: > Eric S Fraga writes: > >> On Friday, 18 Jan 2019 at 10:04, Eric Abrahamsen wrote: >>> I'll filter those out in advance, but would also like to know what was >>> producing that particular gnus-data. What message were you on when you >>> got that error? I.e., the offending data was: >> >> These were the active places (i.e. where I can TAB to and do something >> on) in an email that includes previous messages, things highlighted by >> gnus especially when using the mechanisms in gnus for hiding part of a >> citation. The particular message was the previous one you had posted to >> this group (mailing list but I'm reading it via gwene/gmane). > > Well that's weird, when I use the command on that message, it offers me > the "Eric Abrahamsen wrote:" text as a link I can click, and toggles > visibility of the quote as you'd expect. I'll try to figure this out. Nope, wasn't able to figure it out. I can't find any messages that return that kind of marker structure for me. Here's one more version that might handle that case properly for you, and at the very least shouldn't error. (defun gnus-article-browse-url (arg) "Scan the current article body for links, and offer to browse them. With prefix ARG, also collect links from message headers. Links are opened using `widget-button-press'. If only one link is found, browse that directly, otherwise use completion to select a link." (interactive "P") (let ((opened (and (gnus-buffer-live-p gnus-article-buffer) (get-buffer-window gnus-article-buffer t) ;; We might have opened an article, but then moved to ;; a different summary line. (= gnus-current-article (gnus-summary-article-number)))) pt urls target) (unless opened (gnus-summary-select-article) (gnus-configure-windows 'article)) (gnus-with-article-buffer (if arg (goto-char (point-min)) (article-goto-body) ;; Back up a char, in case body starts with a widget. (backward-char)) (setq pt (point)) (while (progn (widget-forward 1) (> (point) pt)) (setq pt (point)) (when-let ((u (cond ((get-text-property (point) 'shr-url)) ((get-text-property (point) 'gnus-string)) ((let ((dat (get-text-property (point) 'gnus-data))) (pcase dat ('nil nil) ((and (pred stringp) (pred (string-match-p "^>"))) ;; This is a "so-and-so wrote:" quote. (buffer-substring-no-properties (line-beginning-position) (line-end-position))) ;; Does a marker always signify the ;; signature? We may never know. ((pred markerp) "") ;; What is this, exactly? (`(((,(and (pred markerp) start) . ,(and (pred markerp) end))) _) (buffer-substring-no-properties start end)) ;; There are more weird cases, add as ;; necessary. ((pred stringp) dat))))))) (push (cons u pt) urls))) (setq target (assoc (cond ((= (length urls) 1) (caar urls)) ((> (length urls) 1) (completing-read "URL to browse: " (setq urls (nreverse (delete-dups urls))) nil t))) urls)) (if target (funcall-interactively #'widget-button-press (1+ (cdr target))) (message "No URLs found."))) ;; Now what? If we're not in the *Summary* buffer anymore (i.e., ;; pressing the button created a new buffer), do nothing. ;; Otherwise, if the article wasn't opened to begin with, close it ;; after we follow the link. (when (get-buffer-window gnus-summary-buffer) (gnus-summary-expand-window opened))))