From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 5WfmD+NJpF7rDwAA0tVLHw (envelope-from ) for ; Sat, 25 Apr 2020 14:32:03 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id sGXdB+pJpF4bNgAA1q6Kng (envelope-from ) for ; Sat, 25 Apr 2020 14:32:10 +0000 Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8BC259433BF for ; Sat, 25 Apr 2020 14:32:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 96B716DE1417; Sat, 25 Apr 2020 07:32:03 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zd7okHhvx18f; Sat, 25 Apr 2020 07:32:03 -0700 (PDT) Received: from arlo.cworth.org (localhost [IPv6:::1]) by arlo.cworth.org (Postfix) with ESMTP id CA9546DE141E; Sat, 25 Apr 2020 07:32:01 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 5CB866DE13C1 for ; Fri, 24 Apr 2020 12:46:50 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FugTlaHpIJPb for ; Fri, 24 Apr 2020 12:46:49 -0700 (PDT) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by arlo.cworth.org (Postfix) with ESMTPS id 0456F6DE13BA for ; Fri, 24 Apr 2020 12:46:48 -0700 (PDT) Received: by mail-wm1-f45.google.com with SMTP id x4so11972239wmj.1 for ; Fri, 24 Apr 2020 12:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oribarbut-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=igPaP2Aw96KI/n0UqtMpHYAsra1Gy3mcZ5yB1iuhmMo=; b=Vj+xFeA7vErP6buNshfWiysidldpoeYG+sW2mOd3hLEZFby/3YH/WLR/2v64h64UV+ ASJgjrhF5h8Q+6ZSkHoW7qgchVWEJZx0OWmvN2+xLYh0OGBd8oDVoSC/hz3iBpZ8DyFG PPpV66wlWP0HenbxYeX9FEeXYK9fyt0xUBShDOi6iayeN9jiW26ErmL8XDm63LMWzrM9 hLXtD2oJqfla4m2tYICeAxKLxqLWXTjF/FNpL6RxlG6BC13NlABfaInK+GBrtJeAQFpk Rlm+ZYqAS5mI04RcAVwtIykZ3ruZN3rGCA/nlDmU3Xqa1G/njYfqg+7Y93A/7ohC7UnQ 78FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=igPaP2Aw96KI/n0UqtMpHYAsra1Gy3mcZ5yB1iuhmMo=; b=BNCtp4+hBtjdNhGUu0DN7RbZRxPMHDMx24IzScmfCYWF6Ne+iiGKsKwmYy+nQCR5DE YguPhpRZV+x262KovXiDWYXu/Nca+RjXh9fPNd1Jo4OwlENJZ+XxaOfIfj4eCi9Emly6 54MQiU7RNWiClgjAxFItzoCrW6AGgeP32K3JliFJy91XUn5FnuUjLq/yTHGkefHvWZ7l MPUngS6v3agiczVnj5tRcLNHM4v0r4UXiX0ATNjKlaZH+6jE0r5h7ERprBnA2HL26vLH yHD32ZinrgSL+ERg8KPJyTSh46oW23NbmPKxIXIoWZ2MmD270ktH8Wo/tUOmbbyJmrJ9 17Wg== X-Gm-Message-State: AGi0Pua5jb6pQ+qEGgObW8RIwP3Ss+Nw3Fp0V0/DAp5Thi9PZkU9/hsK NrTWNQNyNSmKb7yauViEUZhJYBNFkN8YvlJbfKIPhKPlAnHeJw== X-Google-Smtp-Source: APiQypL31EWW6li/Y6ysECFH0WRs0xthQSOgJwmGX7RJh4DxG9f5wVtu38GcWBRunDj/UerMWxOprUccr/FTyVYQ8og= X-Received: by 2002:a1c:e906:: with SMTP id q6mr11442189wmc.62.1587757606055; Fri, 24 Apr 2020 12:46:46 -0700 (PDT) MIME-Version: 1.0 From: Ori Date: Fri, 24 Apr 2020 15:46:20 -0400 Message-ID: Subject: Emacs: make browsing URLs friendlier with Helm To: notmuch@notmuchmail.org X-Mailman-Approved-At: Sat, 25 Apr 2020 07:32:00 -0700 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============3537499546704453841==" Errors-To: notmuch-bounces@notmuchmail.org Sender: "notmuch" X-Scanner: scn0 X-Spam-Score: 2.49 Authentication-Results: aspmx1.migadu.com; dkim=fail (body hash did not verify) header.d=oribarbut-com.20150623.gappssmtp.com header.s=20150623 header.b=Vj+xFeA7; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 50.126.95.6 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Scan-Result: default: False [2.49 / 13.00]; GENERIC_REPUTATION(0.00)[-0.46308361765493]; MX_INVALID(1.00)[]; DWL_DNSWL_BLOCKED(0.00)[50.126.95.6:from]; IP_REPUTATION_HAM(0.00)[asn: 27017(-0.19), country: US(-0.00), ip: 50.126.95.6(-0.46)]; R_DKIM_REJECT(1.00)[oribarbut-com.20150623.gappssmtp.com:s=20150623]; TO_DN_NONE(0.00)[]; R_SPF_ALLOW(-0.20)[+a]; DKIM_TRACE(0.00)[oribarbut-com.20150623.gappssmtp.com:-]; CTYPE_MIXED_BOGUS(1.00)[]; MAILLIST(-0.20)[mailman]; RCVD_IN_DNSWL_FAIL(0.00)[50.126.95.6:server fail]; MIME_TRACE(0.00)[0:+,1:+,2:+,3:~,4:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:27017, ipnet:50.126.64.0/18, country:US]; FROM_NEQ_ENVFROM(0.00)[ori@oribarbut.com,notmuch-bounces@notmuchmail.org]; ARC_NA(0.00)[]; URIBL_BLOCKED(0.00)[notmuchmail.org:email]; FROM_HAS_DN(0.00)[]; SPF_REPUTATION_HAM(0.00)[-0.45035868886075]; MIME_GOOD(-0.10)[multipart/mixed,multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[notmuch@notmuchmail.org]; DMARC_NA(0.00)[oribarbut.com]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; RCVD_COUNT_SEVEN(0.00)[8]; FORGED_SENDER_MAILLIST(0.00)[] X-TUID: QuXYL4ErQ+Dr Content-Transfer-Encoding: 7bit --===============3537499546704453841== Content-Type: multipart/alternative; boundary="00000000000019428805a40ea047" --00000000000019428805a40ea047 Content-Type: text/plain; charset="UTF-8" Hi, This is a fairly small point and was easy for me to locally address, and that in itself may be valuable in sharing, but I wondered if it would be worth putting a change behind a defcustom option, or depending on how this works with other completion frameworks, changing it altogether? The "B" shortcut calls notmuch-show-browse-urls, which calls completing-read with an INITIAL-INPUT of the first URL in the message. On Helm, this shows a near-blank list (blank unless other URLs have the first one as a substring). It's a nicer behavior for Helm to start off with no initial input, as that first URL is highlighted automatically anyway. Locally I simply redefine the function with a minor change (highlighted) after loading notmuch: (defun notmuch-show-browse-urls (&optional kill) "Offer to browse any URLs in the current message. With a prefix argument, copy the URL to the kill ring rather than browsing." (interactive "P") (let ((urls (notmuch-show--gather-urls)) (prompt (if kill "Copy URL to kill ring: " "Browse URL: ")) (fn (if kill #'kill-new #'browse-url))) (if urls (funcall fn (completing-read prompt urls)) (message "No URLs found.")))) For reference, in notmuch-show.el that highlighted part is: (completing-read prompt (cdr urls) nil nil (car urls)) As I said, I'm not sure how this works with other popular completion alternatives like ivy and if the redefined function is better or worse with those. Perhaps this post is only here to be useful for other Helm users! Ori --00000000000019428805a40ea047 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

This is a fairly small point and was easy for m= e to locally address, and that in itself may be valuable in sharing, but I = wondered if it would be worth putting a change behind a defcustom=C2=A0option, or depending on how this works with oth= er completion frameworks, changing it altogether?

The "B" = shortcut calls notmuch-show-browse-urls, wh= ich calls completing-read with an INITIAL-INPUT of the first URL in the message. On He= lm, this shows a near-blank list (blank unless other URLs have the first on= e as a substring). It's a nicer behavior for Helm to start off with no = initial input, as that first URL is highlighted automatically anyway.
Locally I simply redefine the function with a minor change (highlighted) = after loading notmuch:

(defun notmuch-show-= browse-urls (&optional kill)
=C2=A0 =C2=A0 "Offer to browse any= URLs in the current message.
With a prefix argument, copy the URL to th= e kill ring rather than
browsing."
=C2=A0 =C2=A0 (interactive &q= uot;P")
=C2=A0 =C2=A0 (let ((urls (notmuch-show--gather-urls))
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (prompt (if kill "Copy URL to kill = ring: " "Browse URL: "))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (fn (if kill #'kill-new #'browse-url)))
=C2=A0 =C2=A0 =C2=A0= (if urls
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (funcall fn (completing-read prompt urls))=C2=A0 =C2=A0 =C2=A0 =C2=A0 (message "No URLs found."))))
=

For reference, in notmuch-show.el t= hat highlighted part is:
(completing-read prompt (cdr urls) nil nil (car urls= ))

As I said, I'm not sure how this works with other popu= lar completion alternatives like ivy and if the redefined function is bette= r or worse with those. Perhaps this post is only here to be useful for othe= r Helm users!

Ori
--00000000000019428805a40ea047-- --===============3537499546704453841== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============3537499546704453841==--