unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Emacs: make browsing URLs friendlier with Helm
@ 2020-04-24 19:46 Ori
  2020-04-25 15:01 ` David Edmondson
  0 siblings, 1 reply; 3+ messages in thread
From: Ori @ 2020-04-24 19:46 UTC (permalink / raw)
  To: notmuch


[-- Attachment #1.1: Type: text/plain, Size: 1555 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 2079 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Emacs: make browsing URLs friendlier with Helm
  2020-04-24 19:46 Emacs: make browsing URLs friendlier with Helm Ori
@ 2020-04-25 15:01 ` David Edmondson
  2020-04-25 16:24   ` Ori
  0 siblings, 1 reply; 3+ messages in thread
From: David Edmondson @ 2020-04-25 15:01 UTC (permalink / raw)
  To: Ori, notmuch

On Friday, 2020-04-24 at 15:46:20 -04, Ori wrote:

> 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.

Keegan Carruthers-Smith posted a patch with a suggested change for this
in id:m2r1wrxin8.fsf@gmail.com. Could you try that and see if it
addresses your concerns?

That patch is now in HEAD, but I presume not yet in a release.

> 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
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

dme.
-- 
Right across from where I'm standing, on the dance floor she was landing.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Emacs: make browsing URLs friendlier with Helm
  2020-04-25 15:01 ` David Edmondson
@ 2020-04-25 16:24   ` Ori
  0 siblings, 0 replies; 3+ messages in thread
From: Ori @ 2020-04-25 16:24 UTC (permalink / raw)
  To: David Edmondson, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 487 bytes --]

Hi David,

      Keegan Carruthers-Smith posted a patch with a suggested
      change for this in id:m2r1wrxin8.fsf@gmail.com. Could you
      try that and see if it addresses your concerns?

      That patch is now in HEAD, but I presume not yet in a
      release.

Yes that patch fixes the issue in Helm. My mistake for searching the
list archives for "helm" but not for "ivy"! I had suspected the issue
might be similar for other completion frameworks and Keegan confirms
this.

Ori

[-- Attachment #1.2: Type: text/html, Size: 1804 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-25 17:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-24 19:46 Emacs: make browsing URLs friendlier with Helm Ori
2020-04-25 15:01 ` David Edmondson
2020-04-25 16:24   ` Ori

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).