* Command for browsing article URLs? @ 2019-01-07 18:03 Eric Abrahamsen 2019-01-07 20:15 ` Eric S Fraga ` (2 more replies) 0 siblings, 3 replies; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-07 18:03 UTC (permalink / raw) To: ding I'd like to have a command, call it `gnus-article-browse-url', which collects all the links/URLs in the article body, and then offers to browse one of them (choosing with completion). Bound to "K l", naturally. Does anyone have anything like this already-written? I made a custom function to open links from my Hacker News gwene group, but realized it would be better to have something generalized. If no one has this written already, I can make one. Eric ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-07 18:03 Command for browsing article URLs? Eric Abrahamsen @ 2019-01-07 20:15 ` Eric S Fraga 2019-01-07 21:53 ` Eric Abrahamsen 2019-01-08 17:07 ` Haider Rizvi 2019-01-22 20:50 ` Clemens Schüller 2 siblings, 1 reply; 28+ messages in thread From: Eric S Fraga @ 2019-01-07 20:15 UTC (permalink / raw) To: ding On Monday, 7 Jan 2019 at 10:03, Eric Abrahamsen wrote: > I'd like to have a command, call it `gnus-article-browse-url', which > collects all the links/URLs in the article body, and then offers to > browse one of them (choosing with completion). Bound to "K l", > naturally. [...] > If no one has this written already, I can make one. Please do! I find myself tabbing through emails to get to the link I want... thanks, eric -- Eric S Fraga via Emacs 27.0.50 & org 9.1.14 on Debian buster/sid ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-07 20:15 ` Eric S Fraga @ 2019-01-07 21:53 ` Eric Abrahamsen 0 siblings, 0 replies; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-07 21:53 UTC (permalink / raw) To: ding Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Monday, 7 Jan 2019 at 10:03, Eric Abrahamsen wrote: >> I'd like to have a command, call it `gnus-article-browse-url', which >> collects all the links/URLs in the article body, and then offers to >> browse one of them (choosing with completion). Bound to "K l", >> naturally. > > [...] > >> If no one has this written already, I can make one. > > Please do! I find myself tabbing through emails to get to the link I > want... Yeah, it was when I realized I was developing muscle memory for finding links that I decided this would be a good idea... ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-07 18:03 Command for browsing article URLs? Eric Abrahamsen 2019-01-07 20:15 ` Eric S Fraga @ 2019-01-08 17:07 ` Haider Rizvi 2019-01-08 20:53 ` Eric Abrahamsen 2019-01-10 17:53 ` Eric Abrahamsen 2019-01-22 20:50 ` Clemens Schüller 2 siblings, 2 replies; 28+ messages in thread From: Haider Rizvi @ 2019-01-08 17:07 UTC (permalink / raw) To: ding Eric Abrahamsen <eric@ericabrahamsen.net> writes: > I'd like to have a command, call it `gnus-article-browse-url', which > collects all the links/URLs in the article body, and then offers to > browse one of them (choosing with completion). Bound to "K l", > naturally. I use two functions along these lines but not exactly what you asked for. 1. ace-link-gnus: I've it bound to M-o for some historical reason. In typical ace-fashion, it highlights all urls in the article and you use a key to browse the url in your browser. 2. my-gnus-browse function: Based on the newsgroup name, it calls various functions to find parent url for this article from the article headers. For example, gwene/gmane add a Archived-at header to point to the original article. I had various mailing lists that I found it useful for. Let me know if you want to see the latter. -- ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-08 17:07 ` Haider Rizvi @ 2019-01-08 20:53 ` Eric Abrahamsen 2019-01-10 18:47 ` Haider Rizvi 2019-01-10 17:53 ` Eric Abrahamsen 1 sibling, 1 reply; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-08 20:53 UTC (permalink / raw) To: ding Haider Rizvi <harizvi@gmail.com> writes: > Eric Abrahamsen <eric@ericabrahamsen.net> writes: > >> I'd like to have a command, call it `gnus-article-browse-url', which >> collects all the links/URLs in the article body, and then offers to >> browse one of them (choosing with completion). Bound to "K l", >> naturally. > > I use two functions along these lines but not exactly what you asked > for. > > 1. ace-link-gnus: I've it bound to M-o for some historical reason. In > typical ace-fashion, it highlights all urls in the article and you use > a key to browse the url in your browser. That's handy, thank you! I'm glad someone else has done the boring work for me :) > 2. my-gnus-browse function: Based on the newsgroup name, it calls > various functions to find parent url for this article from the article > headers. For example, gwene/gmane add a Archived-at header to point to > the original article. I had various mailing lists that I found it useful for. > > Let me know if you want to see the latter. Yes please; I think this is also useful, and on more than one occasion I've wanted to easily follow permalinks from Archived-At headers. Maybe there's a way to let users distinguish between links in the article headers and links in the article body. Thanks, Eric ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-08 20:53 ` Eric Abrahamsen @ 2019-01-10 18:47 ` Haider Rizvi 2019-01-10 22:27 ` Eric Abrahamsen 0 siblings, 1 reply; 28+ messages in thread From: Haider Rizvi @ 2019-01-10 18:47 UTC (permalink / raw) To: ding Eric Abrahamsen <eric@ericabrahamsen.net> writes: > Haider Rizvi <harizvi@gmail.com> writes: > >> Eric Abrahamsen <eric@ericabrahamsen.net> writes: >> >>> I'd like to have a command, call it `gnus-article-browse-url', which >>> collects all the links/URLs in the article body, and then offers to >>> browse one of them (choosing with completion). Bound to "K l", >>> naturally. >> >> I use two functions along these lines but not exactly what you asked >> for. >> >> 1. ace-link-gnus: I've it bound to M-o for some historical reason. In >> typical ace-fashion, it highlights all urls in the article and you use >> a key to browse the url in your browser. > > That's handy, thank you! I'm glad someone else has done the boring work > for me :) > >> 2. my-gnus-browse function: Based on the newsgroup name, it calls >> various functions to find parent url for this article from the article >> headers. For example, gwene/gmane add a Archived-at header to point to >> the original article. I had various mailing lists that I found it useful for. >> >> Let me know if you want to see the latter. > > Yes please; I think this is also useful, and on more than one occasion > I've wanted to easily follow permalinks from Archived-At headers. Maybe > there's a way to let users distinguish between links in the article > headers and links in the article body. Eric, Sorry, got busy elsewhere. I've posted snippet of my code at: https://gist.github.com/harizvi/97ee5564047206d6014301c3911d8fbb Pl take a look. -- ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-10 18:47 ` Haider Rizvi @ 2019-01-10 22:27 ` Eric Abrahamsen 0 siblings, 0 replies; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-10 22:27 UTC (permalink / raw) To: Haider Rizvi; +Cc: ding Haider Rizvi <harizvi@gmail.com> writes: > Eric Abrahamsen <eric@ericabrahamsen.net> writes: > >> Haider Rizvi <harizvi@gmail.com> writes: >> >>> Eric Abrahamsen <eric@ericabrahamsen.net> writes: >>> >>>> I'd like to have a command, call it `gnus-article-browse-url', which >>>> collects all the links/URLs in the article body, and then offers to >>>> browse one of them (choosing with completion). Bound to "K l", >>>> naturally. >>> >>> I use two functions along these lines but not exactly what you asked >>> for. >>> >>> 1. ace-link-gnus: I've it bound to M-o for some historical reason. In >>> typical ace-fashion, it highlights all urls in the article and you use >>> a key to browse the url in your browser. >> >> That's handy, thank you! I'm glad someone else has done the boring work >> for me :) >> >>> 2. my-gnus-browse function: Based on the newsgroup name, it calls >>> various functions to find parent url for this article from the article >>> headers. For example, gwene/gmane add a Archived-at header to point to >>> the original article. I had various mailing lists that I found it useful for. >>> >>> Let me know if you want to see the latter. >> >> Yes please; I think this is also useful, and on more than one occasion >> I've wanted to easily follow permalinks from Archived-At headers. Maybe >> there's a way to let users distinguish between links in the article >> headers and links in the article body. > > Eric, > > Sorry, got busy elsewhere. I've posted snippet of my code at: > https://gist.github.com/harizvi/97ee5564047206d6014301c3911d8fbb Thanks for this! It looks like you've made some pretty use-case-specific functions, though, and I'd ideally like this to be a single function, that's able to handle a variety of links with a single interface (I originally thought `browse-url', but now apparently `widget-button-press' is the way to go, except I can't make it work right). But thank you for this code! It will come in handy, and at the very least it's good to know that this is a common need. Eric ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-08 17:07 ` Haider Rizvi 2019-01-08 20:53 ` Eric Abrahamsen @ 2019-01-10 17:53 ` Eric Abrahamsen 2019-01-10 22:46 ` Eric Abrahamsen 2019-01-11 10:17 ` Eric S Fraga 1 sibling, 2 replies; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-10 17:53 UTC (permalink / raw) To: Haider Rizvi; +Cc: ding Haider Rizvi <harizvi@gmail.com> writes: > Eric Abrahamsen <eric@ericabrahamsen.net> writes: > >> I'd like to have a command, call it `gnus-article-browse-url', which >> collects all the links/URLs in the article body, and then offers to >> browse one of them (choosing with completion). Bound to "K l", >> naturally. > > I use two functions along these lines but not exactly what you asked > for. > > 1. ace-link-gnus: I've it bound to M-o for some historical reason. In > typical ace-fashion, it highlights all urls in the article and you use > a key to browse the url in your browser. > > 2. my-gnus-browse function: Based on the newsgroup name, it calls > various functions to find parent url for this article from the article > headers. For example, gwene/gmane add a Archived-at header to point to > the original article. I had various mailing lists that I found it useful for. > > Let me know if you want to see the latter. Okay, here's what I've got so far. It seems to work fine, except on links in the article headers (eg the List-Subscribe header contains a "mailto:" link). It's weird because if I click that link with the mouse, or move point to it and hit "<RET>", it works fine. But if I programmatically call `widget-button-press' (which is all "<RET>" is doing), nothing happens. Also, I have no idea what the difference between 'gnus-string and 'gnus-data text properties is: 'gnus-data in particular seems pretty complicated. Haider, is this something you've encountered (and maybe solved)? Thanks, Eric #+begin_src elisp (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 via `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))) pt urls target) (unless (and opened ;; We might have opened an article, but then moved to ;; a different summary line. (= gnus-current-article (gnus-summary-article-number))) (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 (or (get-text-property (point) 'gnus-string) (get-text-property (point) 'gnus-data) (get-text-property (point) 'shr-url)))) (push (cons u pt) urls))) (setq target (assoc (cond ((= (length urls) 1) (caar urls)) ((> (length urls) 1) (completing-read "URL to browse: " (delete-dups urls) nil t))) urls)) (if target (widget-button-press (1+ (cdr target))) (message "No URLs found."))) (gnus-summary-expand-window opened))) (with-eval-after-load "gnus-sum" (define-key gnus-summary-mime-map (kbd "l") #'gnus-article-browse-url)) #+end_src ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-10 17:53 ` Eric Abrahamsen @ 2019-01-10 22:46 ` Eric Abrahamsen 2019-01-11 10:17 ` Eric S Fraga 1 sibling, 0 replies; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-10 22:46 UTC (permalink / raw) To: ding Eric Abrahamsen <eric@ericabrahamsen.net> writes: > Haider Rizvi <harizvi@gmail.com> writes: > >> Eric Abrahamsen <eric@ericabrahamsen.net> writes: >> >>> I'd like to have a command, call it `gnus-article-browse-url', which >>> collects all the links/URLs in the article body, and then offers to >>> browse one of them (choosing with completion). Bound to "K l", >>> naturally. >> >> I use two functions along these lines but not exactly what you asked >> for. >> >> 1. ace-link-gnus: I've it bound to M-o for some historical reason. In >> typical ace-fashion, it highlights all urls in the article and you use >> a key to browse the url in your browser. >> >> 2. my-gnus-browse function: Based on the newsgroup name, it calls >> various functions to find parent url for this article from the article >> headers. For example, gwene/gmane add a Archived-at header to point to >> the original article. I had various mailing lists that I found it useful for. >> >> Let me know if you want to see the latter. > > Okay, here's what I've got so far. It seems to work fine, except on > links in the article headers (eg the List-Subscribe header contains a > "mailto:" link). [...] The prefix arg could also be used to say "open the Nth link in the article", which would be more in line with how Gnus' other mime-related commands work, but personally at least would be less usable. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-10 17:53 ` Eric Abrahamsen 2019-01-10 22:46 ` Eric Abrahamsen @ 2019-01-11 10:17 ` Eric S Fraga 2019-01-11 20:38 ` Eric Abrahamsen 1 sibling, 1 reply; 28+ messages in thread From: Eric S Fraga @ 2019-01-11 10:17 UTC (permalink / raw) To: ding Hi Eric, I tried your gnus-article-browse-url and I get the following error: sort: Wrong type argument: stringp, ((#<marker at 627 in *Article nntp+news.gwene.org:gmane.linux.debian.user*> . #<marker at 927 in *Article nntp+news.gwene.org:gmane.linux.debian.user*>) #<marker at 623 in *Article nntp+news.gwene.org:gmane.linux.debian.user*>) Not tried any serious debugging yet as I'm busy with work. In any case, the only reason for sort to complain, that I can see, is that somehow ivy (which I use) is confused, given that you use completing-read. Any suggestions welcome. thanks, eric -- Eric S Fraga via Emacs 27.0.50 & org 9.1.14 on Debian buster/sid ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-11 10:17 ` Eric S Fraga @ 2019-01-11 20:38 ` Eric Abrahamsen 2019-01-18 9:24 ` Eric S Fraga ` (2 more replies) 0 siblings, 3 replies; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-11 20:38 UTC (permalink / raw) To: ding Eric S Fraga <e.fraga@ucl.ac.uk> writes: > Hi Eric, > > I tried your gnus-article-browse-url and I get the following error: > > sort: Wrong type argument: stringp, ((#<marker at 627 in *Article > nntp+news.gwene.org:gmane.linux.debian.user*> . #<marker at 927 in > *Article nntp+news.gwene.org:gmane.linux.debian.user*>) #<marker at 623 > in *Article nntp+news.gwene.org:gmane.linux.debian.user*>) > > Not tried any serious debugging yet as I'm busy with work. In any case, > the only reason for sort to complain, that I can see, is that somehow > ivy (which I use) is confused, given that you use completing-read. Any > suggestions welcome. Thanks, that was helpful! When you have a moment, please try this updated version. I'm thinking it might be better named "gnus-article-click-button", since that's pretty much what it does now. #+begin_src elisp (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= ">")))) (buffer-substring (line-beginning-position) (line-end-position))) ;; Does a marker always signify the ;; signature? We may never know. ((pred (markerp)) "<signature>") ;; There are more weird cases, add as ;; necessary. (_ dat))))))) (push (cons u pt) urls))) (setq target (assoc (cond ((= (length urls) 1) (caar urls)) ((> (length urls) 1) (completing-read "URL to browse: " (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)))) (with-eval-after-load "gnus-sum" (define-key gnus-summary-mime-map (kbd "l") #'gnus-article-browse-url)) #+end_src ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-11 20:38 ` Eric Abrahamsen @ 2019-01-18 9:24 ` Eric S Fraga 2019-01-18 9:32 ` Eric S Fraga 2019-06-22 10:30 ` Lars Ingebrigtsen 2 siblings, 0 replies; 28+ messages in thread From: Eric S Fraga @ 2019-01-18 9:24 UTC (permalink / raw) To: ding On Friday, 11 Jan 2019 at 12:38, Eric Abrahamsen wrote: > Thanks, that was helpful! When you have a moment, please try this > updated version. Been very busy with work but will try this out today. > > I'm thinking it might be better named "gnus-article-click-button", since > that's pretty much what it does now. > > #+begin_src elisp > (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= ">")))) > (buffer-substring (line-beginning-position) (line-end-position))) > ;; Does a marker always signify the > ;; signature? We may never know. > ((pred (markerp)) > "<signature>") > ;; There are more weird cases, add as > ;; necessary. > (_ dat))))))) > (push (cons u pt) urls))) > (setq target > (assoc (cond ((= (length urls) 1) > (caar urls)) > ((> (length urls) 1) > (completing-read "URL to browse: " > (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)))) > > (with-eval-after-load "gnus-sum" > (define-key gnus-summary-mime-map (kbd "l") #'gnus-article-browse-url)) > #+end_src > -- Eric S Fraga via Emacs 27.0.50 & org 9.1.13 on Debian 9.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-11 20:38 ` Eric Abrahamsen 2019-01-18 9:24 ` Eric S Fraga @ 2019-01-18 9:32 ` Eric S Fraga 2019-01-18 18:04 ` Eric Abrahamsen 2019-06-22 10:30 ` Lars Ingebrigtsen 2 siblings, 1 reply; 28+ messages in thread From: Eric S Fraga @ 2019-01-18 9:32 UTC (permalink / raw) To: ding [-- Attachment #1: Type: text/plain, Size: 448 bytes --] On Friday, 11 Jan 2019 at 12:38, Eric Abrahamsen wrote: > Thanks, that was helpful! When you have a moment, please try this > updated version. Sorry for previous posting. My C-c key repeated itself and sent the post before I was done. In any case, trying your new version still doesn't work. It now fails explicitly in an ivy related function. See attached backtrace. Thanks, eric -- Eric S Fraga via Emacs 27.0.50 & org 9.1.13 on Debian 9.6 [-- Attachment #2: debug.txt --] [-- Type: text/plain, Size: 8653 bytes --] Debugger entered--Lisp error: (wrong-type-argument stringp ((#<marker at 285 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> . #<marker at 778 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) #<marker at 281 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>)) ivy-string<((#("Eric S Fraga <e.fraga@ucl.ac.uk> writes:" 14 31 (mouse-face highlight gnus-callback gnus-button-push gnus-data (#<marker at 240 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> (gnus-button-mid-or-mail-regexp 0 (>= gnus-button-message-level 5) gnus-button-handle-mid-or-mail 1)) gnus-string "e.fraga@ucl.ac.uk") 33 40 (mouse-face highlight gnus-callback gnus-cite-toggle gnus-data ">")) . 259) (((#<marker at 285 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> . #<marker at 778 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) #<marker at 281 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) . 281)) sort(((((#<marker at 285 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> . #<marker at 778 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) #<marker at 281 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) . 281)) ivy-string<) ivy--reset-state(#s(ivy-state :prompt "URL to browse: " :collection ((((#<marker at 285 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> . #<marker at 778 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) #<marker at 281 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) . 281) (#("Eric S Fraga <e.fraga@ucl.ac.uk> writes:" 14 31 (mouse-face highlight gnus-callback gnus-button-push gnus-data (#<marker at 240 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> (gnus-button-mid-or-mail-regexp 0 (>= gnus-button-message-level 5) gnus-button-handle-mid-or-mail 1)) gnus-string "e.fraga@ucl.ac.uk") 33 40 (mouse-face highlight gnus-callback gnus-cite-toggle gnus-data ">")) . 259) ("e.fraga@ucl.ac.uk" . 240)) :predicate nil :require-match t :initial-input nil :history nil :preselect nil :keymap nil :update-fn nil :sort t :frame #<frame emacs: *Summary nntp+news.gwene.org:gmane.emacs.gnus.general* 0x12cfc2d0> :window #<window 11 on *Summary nntp+news.gwene.org:gmane.emacs.gnus.general*> :buffer #<buffer *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> :text nil :action (1 ("o" identity "default") ("i" #f(compiled-function (x) #<bytecode 0x5135335>) "insert") ("w" #f(compiled-function (x) #<bytecode 0x5135345>) "copy")) :unwind nil :re-builder nil :matcher nil :dynamic-collection nil :display-transformer-fn nil :directory "~/" :caller gnus-article-browse-url :current nil :def nil)) ivy-read("URL to browse: " ((((#<marker at 285 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> . #<marker at 778 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) #<marker at 281 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) . 281) (#("Eric S Fraga <e.fraga@ucl.ac.uk> writes:" 14 31 (mouse-face highlight gnus-callback gnus-button-push gnus-data (#<marker at 240 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> (gnus-button-mid-or-mail-regexp 0 (>= gnus-button-message-level 5) gnus-button-handle-mid-or-mail 1)) gnus-string "e.fraga@ucl.ac.uk") 33 40 (mouse-face highlight gnus-callback gnus-cite-toggle gnus-data ">")) . 259) ("e.fraga@ucl.ac.uk" . 240)) :predicate nil :require-match t :initial-input nil :preselect nil :def nil :history nil :keymap nil :sort t :dynamic-collection nil :caller gnus-article-browse-url) ivy-completing-read("URL to browse: " ((((#<marker at 285 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> . #<marker at 778 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) #<marker at 281 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) . 281) (#("Eric S Fraga <e.fraga@ucl.ac.uk> writes:" 14 31 (mouse-face highlight gnus-callback gnus-button-push gnus-data (#<marker at 240 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> (gnus-button-mid-or-mail-regexp 0 (>= gnus-button-message-level 5) gnus-button-handle-mid-or-mail 1)) gnus-string "e.fraga@ucl.ac.uk") 33 40 (mouse-face highlight gnus-callback gnus-cite-toggle gnus-data ">")) . 259) ("e.fraga@ucl.ac.uk" . 240)) nil t nil nil nil nil) completing-read("URL to browse: " ((((#<marker at 285 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> . #<marker at 778 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) #<marker at 281 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) . 281) (#("Eric S Fraga <e.fraga@ucl.ac.uk> writes:" 14 31 (mouse-face highlight gnus-callback gnus-button-push gnus-data (#<marker at 240 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> (gnus-button-mid-or-mail-regexp 0 (>= gnus-button-message-level 5) gnus-button-handle-mid-or-mail 1)) gnus-string "e.fraga@ucl.ac.uk") 33 40 (mouse-face highlight gnus-callback gnus-cite-toggle gnus-data ">")) . 259) ("e.fraga@ucl.ac.uk" . 240)) nil t) (cond ((= (length urls) 1) (car (car urls))) ((> (length urls) 1) (completing-read "URL to browse: " (delete-dups urls) nil t))) (assoc (cond ((= (length urls) 1) (car (car urls))) ((> (length urls) 1) (completing-read "URL to browse: " (delete-dups urls) nil t))) urls) (setq target (assoc (cond ((= (length urls) 1) (car (car urls))) ((> (length urls) 1) (completing-read "URL to browse: " (delete-dups urls) nil t))) urls)) (let ((inhibit-read-only t)) (if arg (goto-char (point-min)) (article-goto-body) (backward-char)) (setq pt (point)) (while (progn (widget-forward 1) (> (point) pt)) (setq pt (point)) (let* ((u (and t (cond (...) (...) (...))))) (if u (setq urls (cons (cons u pt) urls)) nil))) (setq target (assoc (cond ((= (length urls) 1) (car (car urls))) ((> (length urls) 1) (completing-read "URL to browse: " (delete-dups urls) nil t))) urls)) (if target (funcall-interactively #'widget-button-press (1+ (cdr target))) (message "No URLs found."))) (save-current-buffer (set-buffer gnus-article-buffer) (let ((inhibit-read-only t)) (if arg (goto-char (point-min)) (article-goto-body) (backward-char)) (setq pt (point)) (while (progn (widget-forward 1) (> (point) pt)) (setq pt (point)) (let* ((u (and t (cond ... ... ...)))) (if u (setq urls (cons (cons u pt) urls)) nil))) (setq target (assoc (cond ((= (length urls) 1) (car (car urls))) ((> (length urls) 1) (completing-read "URL to browse: " (delete-dups urls) nil t))) urls)) (if target (funcall-interactively #'widget-button-press (1+ (cdr target))) (message "No URLs found.")))) (progn (save-current-buffer (set-buffer gnus-article-buffer) (let ((inhibit-read-only t)) (if arg (goto-char (point-min)) (article-goto-body) (backward-char)) (setq pt (point)) (while (progn (widget-forward 1) (> (point) pt)) (setq pt (point)) (let* ((u (and t ...))) (if u (setq urls (cons ... urls)) nil))) (setq target (assoc (cond ((= ... 1) (car ...)) ((> ... 1) (completing-read "URL to browse: " ... nil t))) urls)) (if target (funcall-interactively #'widget-button-press (1+ (cdr target))) (message "No URLs found."))))) (if (buffer-live-p (get-buffer gnus-article-buffer)) (progn (save-current-buffer (set-buffer gnus-article-buffer) (let ((inhibit-read-only t)) (if arg (goto-char (point-min)) (article-goto-body) (backward-char)) (setq pt (point)) (while (progn (widget-forward 1) (> (point) pt)) (setq pt (point)) (let* ((u ...)) (if u (setq urls ...) nil))) (setq target (assoc (cond (... ...) (... ...)) urls)) (if target (funcall-interactively #'widget-button-press (1+ (cdr target))) (message "No URLs found.")))))) (let ((opened (and (gnus-buffer-live-p gnus-article-buffer) (get-buffer-window gnus-article-buffer t) (= gnus-current-article (progn (let (...) (and to ...)) (or (get-text-property ... ...) (gnus-summary-last-subject)))))) pt urls target) (if opened nil (gnus-summary-select-article) (gnus-configure-windows 'article)) (if (buffer-live-p (get-buffer gnus-article-buffer)) (progn (save-current-buffer (set-buffer gnus-article-buffer) (let ((inhibit-read-only t)) (if arg (goto-char (point-min)) (article-goto-body) (backward-char)) (setq pt (point)) (while (progn (widget-forward 1) (> ... pt)) (setq pt (point)) (let* (...) (if u ... nil))) (setq target (assoc (cond ... ...) urls)) (if target (funcall-interactively #'widget-button-press (1+ ...)) (message "No URLs found.")))))) (if (get-buffer-window gnus-summary-buffer) (progn (gnus-summary-expand-window opened)))) gnus-article-browse-url(nil) funcall-interactively(gnus-article-browse-url nil) call-interactively(gnus-article-browse-url nil nil) command-execute(gnus-article-browse-url) ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-18 9:32 ` Eric S Fraga @ 2019-01-18 18:04 ` Eric Abrahamsen 2019-01-19 11:08 ` Eric S Fraga 0 siblings, 1 reply; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-18 18:04 UTC (permalink / raw) To: ding Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Friday, 11 Jan 2019 at 12:38, Eric Abrahamsen wrote: >> Thanks, that was helpful! When you have a moment, please try this >> updated version. > > Sorry for previous posting. My C-c key repeated itself and sent the post > before I was done. > > In any case, trying your new version still doesn't work. It now fails > explicitly in an ivy related function. See attached backtrace. Thanks for this! The built-in completion functions silently pass over non-string completion choices; looks like ivy doesn't (though it seems like it ought to). 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: ((#<marker at 285 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*> . #<marker at 778 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) #<marker at 281 in *Article nntp+news.gwene.org:gmane.emacs.gnus.general*>) Can you tell me what's at those markers? Thanks! Eric ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-18 18:04 ` Eric Abrahamsen @ 2019-01-19 11:08 ` Eric S Fraga 2019-01-21 18:03 ` Eric Abrahamsen 0 siblings, 1 reply; 28+ messages in thread From: Eric S Fraga @ 2019-01-19 11:08 UTC (permalink / raw) To: ding 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). HTH, eric -- Eric S Fraga via Emacs 27.0.50 & org 9.1.14 on Debian buster/sid ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-19 11:08 ` Eric S Fraga @ 2019-01-21 18:03 ` Eric Abrahamsen 2019-01-22 23:45 ` Eric Abrahamsen 0 siblings, 1 reply; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-21 18:03 UTC (permalink / raw) To: ding Eric S Fraga <e.fraga@ucl.ac.uk> 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. Eric ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-21 18:03 ` Eric Abrahamsen @ 2019-01-22 23:45 ` Eric Abrahamsen 2019-01-30 8:13 ` Eric S Fraga 0 siblings, 1 reply; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-22 23:45 UTC (permalink / raw) To: ding Eric Abrahamsen <eric@ericabrahamsen.net> writes: > Eric S Fraga <e.fraga@ucl.ac.uk> 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) "<signature>") ;; 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)))) ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-22 23:45 ` Eric Abrahamsen @ 2019-01-30 8:13 ` Eric S Fraga 2019-01-30 19:23 ` Eric Abrahamsen 0 siblings, 1 reply; 28+ messages in thread From: Eric S Fraga @ 2019-01-30 8:13 UTC (permalink / raw) To: ding On Tuesday, 22 Jan 2019 at 15:45, Eric Abrahamsen wrote: > 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. Hi Eric, You may not have been able to figure it out but your new version works! I haven't tested it extensively but it definitely works for at least one of my emails whereas the previous version did not work at all. I'll start using it in anger and will let you know if and when it fails. Thanks and sorry for the delay (very busy time of year for me). eric -- Eric S Fraga via Emacs 27.0.50 & org 9.2 on Debian buster/sid ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-30 8:13 ` Eric S Fraga @ 2019-01-30 19:23 ` Eric Abrahamsen 2019-01-31 8:38 ` Eric S Fraga 0 siblings, 1 reply; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-30 19:23 UTC (permalink / raw) To: ding Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Tuesday, 22 Jan 2019 at 15:45, Eric Abrahamsen wrote: >> 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. > > Hi Eric, > > You may not have been able to figure it out but your new version works! > > I haven't tested it extensively but it definitely works for at least one > of my emails whereas the previous version did not work at all. I'll > start using it in anger and will let you know if and when it fails. > > Thanks and sorry for the delay (very busy time of year for me). Not at all, thanks for testing. I'll probably add this as it is, then, and fix further bugs as they arise. I ended up thinking this was more appropriate for the gnus-summary-article-map rather than the mime map, so the command will probably live at "A l". Eric ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-30 19:23 ` Eric Abrahamsen @ 2019-01-31 8:38 ` Eric S Fraga 2019-01-31 17:18 ` Eric Abrahamsen 0 siblings, 1 reply; 28+ messages in thread From: Eric S Fraga @ 2019-01-31 8:38 UTC (permalink / raw) To: ding On Wednesday, 30 Jan 2019 at 11:23, Eric Abrahamsen wrote: > Not at all, thanks for testing. I'll probably add this as it is, then, > and fix further bugs as they arise. I modified your code. If the target is an http link, I explicitly ask to browse the url instead of activating the widget. I found that doing the latter would simply create a new buffer and not display it (I use eww for browsing the web). I probably should have used funcall but I'm not sure when one would or would not use such... I have much to learn about elisp. Alternatively, it may be that the final bit of your code could be adjusted as it may be that we should check for article as well as summary buffers? Sometimes, I will invoke the url browsing when viewing just the article buffer, especially on a small device. #+begin_src emacs-lisp (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) "<signature>") ;; 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 (let ((url (car target)) ) (if (string-match "^http" url) (browse-url url) (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)))) (with-eval-after-load "gnus-sum" (define-key gnus-summary-mime-map (kbd "l") #'gnus-article-browse-url)) #+end_src -- Eric S Fraga via Emacs 27.0.50 & org 9.2 on Debian 9.6 ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-31 8:38 ` Eric S Fraga @ 2019-01-31 17:18 ` Eric Abrahamsen 2019-01-31 17:25 ` Eric S Fraga 0 siblings, 1 reply; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-31 17:18 UTC (permalink / raw) To: ding Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Wednesday, 30 Jan 2019 at 11:23, Eric Abrahamsen wrote: >> Not at all, thanks for testing. I'll probably add this as it is, then, >> and fix further bugs as they arise. > > I modified your code. If the target is an http link, I explicitly ask to > browse the url instead of activating the widget. I found that doing the > latter would simply create a new buffer and not display it (I use eww > for browsing the web). I probably should have used funcall but I'm not > sure when one would or would not use such... I have much to learn about > elisp. > > Alternatively, it may be that the final bit of your code could be > adjusted as it may be that we should check for article as well as > summary buffers? Sometimes, I will invoke the url browsing when viewing > just the article buffer, especially on a small device. Oh, I hadn't tested it with eww, I should have. If you just click on the http url in the article buffer with your mouse (ie, don't use this function at all), what behavior do you get? I think you're right that the best approach is to modify how the windows are manipulated afterwards (or just drop that bit of the code altogether). I'd like this to behave exactly as if you'd clicked the mouse, and would rather not put special-casing in there. Thanks again, Eric ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-31 17:18 ` Eric Abrahamsen @ 2019-01-31 17:25 ` Eric S Fraga 2019-01-31 17:49 ` Eric Abrahamsen 0 siblings, 1 reply; 28+ messages in thread From: Eric S Fraga @ 2019-01-31 17:25 UTC (permalink / raw) To: ding On Thursday, 31 Jan 2019 at 09:18, Eric Abrahamsen wrote: > Oh, I hadn't tested it with eww, I should have. If you just click on the > http url in the article buffer with your mouse (ie, don't use this > function at all), what behavior do you get? (had to go and try this as I *never* use the mouse) The article window is replaced by the eww window. With your function as you wrote it, the eww window is created but hidden. This may be a function of executing that function from the summary window, not the article window. I assume that clicking on a link in the article window makes the article window active? -- Eric S Fraga via Emacs 27.0.50 & org 9.2 on Debian buster/sid ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-31 17:25 ` Eric S Fraga @ 2019-01-31 17:49 ` Eric Abrahamsen 2019-01-31 18:31 ` Eric S Fraga 0 siblings, 1 reply; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-31 17:49 UTC (permalink / raw) To: ding Eric S Fraga <e.fraga@ucl.ac.uk> writes: > On Thursday, 31 Jan 2019 at 09:18, Eric Abrahamsen wrote: >> Oh, I hadn't tested it with eww, I should have. If you just click on the >> http url in the article buffer with your mouse (ie, don't use this >> function at all), what behavior do you get? > > (had to go and try this as I *never* use the mouse) > > The article window is replaced by the eww window. > > With your function as you wrote it, the eww window is created but > hidden. This may be a function of executing that function from the > summary window, not the article window. I assume that clicking on a link > in the article window makes the article window active? That's a good question -- I think it does. But window is currently getting hidden because I'm only checking if the summary buffer went away. I need to check if either summary or article went away, and not touch anything if so. ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-31 17:49 ` Eric Abrahamsen @ 2019-01-31 18:31 ` Eric S Fraga 0 siblings, 0 replies; 28+ messages in thread From: Eric S Fraga @ 2019-01-31 18:31 UTC (permalink / raw) To: ding On Thursday, 31 Jan 2019 at 09:49, Eric Abrahamsen wrote: > That's a good question -- I think it does. But window is currently > getting hidden because I'm only checking if the summary buffer went > away. I need to check if either summary or article went away, and not > touch anything if so. Yes, that sounds reasonable. -- Eric S Fraga via Emacs 27.0.50 & org 9.2 on Debian buster/sid ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-11 20:38 ` Eric Abrahamsen 2019-01-18 9:24 ` Eric S Fraga 2019-01-18 9:32 ` Eric S Fraga @ 2019-06-22 10:30 ` Lars Ingebrigtsen 2 siblings, 0 replies; 28+ messages in thread From: Lars Ingebrigtsen @ 2019-06-22 10:30 UTC (permalink / raw) To: Eric Abrahamsen; +Cc: ding Eric Abrahamsen <eric@ericabrahamsen.net> writes: > (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. Sounds like a very useful command. > (funcall-interactively #'widget-button-press (1+ (cdr target))) But I don't understand this bit -- we're only interested in URLs, so why not call browse-url directly? Sounds less breakable. And instead of putting it on `A l', I think using a single-key keystroke would be warranted. Say, `w'? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-07 18:03 Command for browsing article URLs? Eric Abrahamsen 2019-01-07 20:15 ` Eric S Fraga 2019-01-08 17:07 ` Haider Rizvi @ 2019-01-22 20:50 ` Clemens Schüller 2019-01-22 20:59 ` Eric Abrahamsen 2 siblings, 1 reply; 28+ messages in thread From: Clemens Schüller @ 2019-01-22 20:50 UTC (permalink / raw) To: Eric Abrahamsen; +Cc: ding Hello! Eric Abrahamsen wrote: > I'd like to have a command, call it `gnus-article-browse-url', which > collects all the links/URLs in the article body, and then offers to > browse one of them (choosing with completion). Bound to "K l", > naturally. > > Does anyone have anything like this already-written? I made a custom > function to open links from my Hacker News gwene group, but realized it > would be better to have something generalized. > > If no one has this written already, I can make one. You remind me in this second on an error in my gnus config: I have following in my .gnus #+begin_src emacs-lisp (setq browse-url-browser-function 'browse-url-generic ;; browse-url-generic-program "/usr/bin/konqueror" ;; browse-url-generic-program "/usr/bin/chromium" browse-url-generic-program "/Applications/Safari.app/Contents/MacOS/Safari" browse-url-new-window-p t) #+end_src But, if I wanna open an URL, the URL is malformed and I got an error, that the website could not be opened. --8<---------------cut here---------------start------------->8--- file:///Users/mente/Library/Containers/com.apple.Safari/Data/http:/localhost:631 ^^ stands in the URL line in Safari http:/localhost:631 ^^ is the original one. --8<---------------cut here---------------end--------------->8--- How can I fix that? -- Best Regards, Clemens Schüller ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-22 20:50 ` Clemens Schüller @ 2019-01-22 20:59 ` Eric Abrahamsen 2019-02-10 8:55 ` Clemens Schüller 0 siblings, 1 reply; 28+ messages in thread From: Eric Abrahamsen @ 2019-01-22 20:59 UTC (permalink / raw) To: Clemens Schüller; +Cc: Clemens Schüller, ding On 01/22/19 21:50 PM, Clemens Schüller wrote: > Hello! > > Eric Abrahamsen wrote: > >> I'd like to have a command, call it `gnus-article-browse-url', which >> collects all the links/URLs in the article body, and then offers to >> browse one of them (choosing with completion). Bound to "K l", >> naturally. >> >> Does anyone have anything like this already-written? I made a custom >> function to open links from my Hacker News gwene group, but realized it >> would be better to have something generalized. >> >> If no one has this written already, I can make one. > > You remind me in this second on an error in my gnus config: > > I have following in my .gnus > > #+begin_src emacs-lisp > (setq browse-url-browser-function 'browse-url-generic > ;; browse-url-generic-program "/usr/bin/konqueror" > ;; browse-url-generic-program "/usr/bin/chromium" > browse-url-generic-program "/Applications/Safari.app/Contents/MacOS/Safari" > browse-url-new-window-p t) > #+end_src > > > But, if I wanna open an URL, the URL is malformed and I got an error, > that the website could not be opened. > > > file:///Users/mente/Library/Containers/com.apple.Safari/Data/http:/localhost:631 > ^^ > stands in the URL line in Safari > > > > http:/localhost:631 > ^^ > is the original one. I guess you're just missing a forward slash there? Try "http://localhost:631". Eric ^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: Command for browsing article URLs? 2019-01-22 20:59 ` Eric Abrahamsen @ 2019-02-10 8:55 ` Clemens Schüller 0 siblings, 0 replies; 28+ messages in thread From: Clemens Schüller @ 2019-02-10 8:55 UTC (permalink / raw) To: Eric Abrahamsen; +Cc: ding Hello! Eric Abrahamsen wrote: > On 01/22/19 21:50 PM, Clemens Schüller wrote: >> Eric Abrahamsen wrote: >>> I'd like to have a command, call it `gnus-article-browse-url', which >>> collects all the links/URLs in the article body, and then offers to >>> browse one of them (choosing with completion). Bound to "K l", >>> naturally. >>> >>> Does anyone have anything like this already-written? I made a custom >>> function to open links from my Hacker News gwene group, but realized it >>> would be better to have something generalized. >>> >>> If no one has this written already, I can make one. >> >> You remind me in this second on an error in my gnus config: >> >> I have following in my .gnus [...] > i guess you're just missing a forward slash there? try > "http://localhost:631". Just for the record: My code ist not necessary anymore - I commented it out and now I can open URLs in Safari. :-) -- best regards, clemens schüller ^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2019-06-22 10:30 UTC | newest] Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-01-07 18:03 Command for browsing article URLs? Eric Abrahamsen 2019-01-07 20:15 ` Eric S Fraga 2019-01-07 21:53 ` Eric Abrahamsen 2019-01-08 17:07 ` Haider Rizvi 2019-01-08 20:53 ` Eric Abrahamsen 2019-01-10 18:47 ` Haider Rizvi 2019-01-10 22:27 ` Eric Abrahamsen 2019-01-10 17:53 ` Eric Abrahamsen 2019-01-10 22:46 ` Eric Abrahamsen 2019-01-11 10:17 ` Eric S Fraga 2019-01-11 20:38 ` Eric Abrahamsen 2019-01-18 9:24 ` Eric S Fraga 2019-01-18 9:32 ` Eric S Fraga 2019-01-18 18:04 ` Eric Abrahamsen 2019-01-19 11:08 ` Eric S Fraga 2019-01-21 18:03 ` Eric Abrahamsen 2019-01-22 23:45 ` Eric Abrahamsen 2019-01-30 8:13 ` Eric S Fraga 2019-01-30 19:23 ` Eric Abrahamsen 2019-01-31 8:38 ` Eric S Fraga 2019-01-31 17:18 ` Eric Abrahamsen 2019-01-31 17:25 ` Eric S Fraga 2019-01-31 17:49 ` Eric Abrahamsen 2019-01-31 18:31 ` Eric S Fraga 2019-06-22 10:30 ` Lars Ingebrigtsen 2019-01-22 20:50 ` Clemens Schüller 2019-01-22 20:59 ` Eric Abrahamsen 2019-02-10 8:55 ` Clemens Schüller
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).