unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url)
@ 2023-01-26 20:52 Daniel Kahn Gillmor
  2023-01-27 11:42 ` David Bremner
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Daniel Kahn Gillmor @ 2023-01-26 20:52 UTC (permalink / raw)
  To: Notmuch Mail


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

Hey notmuch folks--

When using notmuch-emacs, and looking at a text/html part, i sometimes
want to know where a given link is pointing to without clicking on it --
e.g. to open it in an alternate browser.

it appears that by positioning the point somewhere within the link and
doing "M-x shr-copy-url" i can copy the target of the link to the kill
ring.

This seems useful enough to me (and i'm now receiving enough
text/html-only messages) that i'd like to have some sort of keybinding
to make that easier to operate.

I think it can be added to the mode-map in emacs/notmuch-show.el.  does
anyone have a preference about what keybinding to use for it?  Or is
there some reason to not provide a default keybinding to this
functionality in notmuch-show mode at all?

       --dkg

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

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



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

* Re: emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url)
  2023-01-26 20:52 emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url) Daniel Kahn Gillmor
@ 2023-01-27 11:42 ` David Bremner
  2023-01-27 13:33 ` Gregor Zattler
  2023-01-27 14:05 ` Greg Minshall
  2 siblings, 0 replies; 6+ messages in thread
From: David Bremner @ 2023-01-27 11:42 UTC (permalink / raw)
  To: Daniel Kahn Gillmor, Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> writes:

> it appears that by positioning the point somewhere within the link and
> doing "M-x shr-copy-url" i can copy the target of the link to the kill
> ring.

> I think it can be added to the mode-map in emacs/notmuch-show.el.  does
> anyone have a preference about what keybinding to use for it?  Or is
> there some reason to not provide a default keybinding to this
> functionality in notmuch-show mode at all?

Having a key-binding seems reasonable enough. What about "c u" ? It's
not exactly like the other "c" bindings of course, because it depends on
the cursor position, but maybe that is less important than general
mnemonic of 'c' for copy.

d

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

* Re: emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url)
  2023-01-26 20:52 emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url) Daniel Kahn Gillmor
  2023-01-27 11:42 ` David Bremner
@ 2023-01-27 13:33 ` Gregor Zattler
  2023-01-27 14:05 ` Greg Minshall
  2 siblings, 0 replies; 6+ messages in thread
From: Gregor Zattler @ 2023-01-27 13:33 UTC (permalink / raw)
  To: notmuch

Hi Daniel,
* Daniel Kahn Gillmor <dkg@fifthhorseman.net> [2023-01-26; 15:52 -05]:
> Hey notmuch folks--
>
> When using notmuch-emacs, and looking at a text/html part, i sometimes
> want to know where a given link is pointing to without clicking on it --
> e.g. to open it in an alternate browser.
>
> it appears that by positioning the point somewhere within the link and
> doing "M-x shr-copy-url" i can copy the target of the link to the kill
> ring.

"w" is bound to shr-maybe-probe-and-copy-url, in
notmuch-show-mode.

I remember that somebody answered on the list to my same
request and that I got this key binding from a reply.  But
I do not find this any more.


Ciao; Gregor
--
 -... --- .-. . -.. ..--.. ...-.-

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

* Re: emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url)
  2023-01-26 20:52 emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url) Daniel Kahn Gillmor
  2023-01-27 11:42 ` David Bremner
  2023-01-27 13:33 ` Gregor Zattler
@ 2023-01-27 14:05 ` Greg Minshall
  2023-01-28 11:02   ` inwit
  2023-01-30 15:00   ` Greg Minshall
  2 siblings, 2 replies; 6+ messages in thread
From: Greg Minshall @ 2023-01-27 14:05 UTC (permalink / raw)
  To: Daniel Kahn Gillmor; +Cc: Notmuch Mail

Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:

> When using notmuch-emacs, and looking at a text/html part, i sometimes
> want to know where a given link is pointing to without clicking on it --
> e.g. to open it in an alternate browser.

you might think of using the link-hint
----
https://github.com/noctuid/link-hint.el
----
package.

cheers, Greg

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

* Re: emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url)
  2023-01-27 14:05 ` Greg Minshall
@ 2023-01-28 11:02   ` inwit
  2023-01-30 15:00   ` Greg Minshall
  1 sibling, 0 replies; 6+ messages in thread
From: inwit @ 2023-01-28 11:02 UTC (permalink / raw)
  To: Greg Minshall, Daniel Kahn Gillmor; +Cc: Notmuch Mail

On Fri Jan 27, 2023 at 3:05 PM CET, Greg Minshall wrote:
> you might think of using the link-hint package.
I was going to say the same thing. link-hint is an essential part of my
workflow. Since I mostly use notmuch-tree, I have this:

```
  (defun inwit/notmuch-tree-open-link ()
    "Avy select link in message window."
    (interactive)
    (when (window-live-p notmuch-tree-message-window)
      (with-selected-window notmuch-tree-message-window
        (link-hint-open-link))))
```

Properly bound, it saves me a lot of time.

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

* Re: emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url)
  2023-01-27 14:05 ` Greg Minshall
  2023-01-28 11:02   ` inwit
@ 2023-01-30 15:00   ` Greg Minshall
  1 sibling, 0 replies; 6+ messages in thread
From: Greg Minshall @ 2023-01-30 15:00 UTC (permalink / raw)
  To: Daniel Kahn Gillmor; +Cc: Notmuch Mail

Daniel,

too late, i realized that my suggestion of link-hint isn't exactly a
match, as it is "missing" a "link-hint-display-hint" (or some such)
function.

i just now suggested such a function, but the below, which is *not*
fully formed, might occasionally be helpful if you do install link-hint
(which i also find very useful in daily use).

cheers, Greg

----
(defun link-hint-display-link ()
      "Display a visible link of a supported type."
      (interactive)
      (require 'link-hint)
      (avy-with link-hint-display-link
        (let* ((link-hint-types (link-hint--valid-types :copy))
               (links (link-hint--get-links))
               link)
          (when links
            (setq link (link-hint--process links))
            (when link
              (message (format "link: %s" (plist-get link ':args))))))))
----

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

end of thread, other threads:[~2023-01-30 15:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-26 20:52 emacs: keybindings in notmuch-show for copying the target of a link for a text/html part? (M-x shr-copy-url) Daniel Kahn Gillmor
2023-01-27 11:42 ` David Bremner
2023-01-27 13:33 ` Gregor Zattler
2023-01-27 14:05 ` Greg Minshall
2023-01-28 11:02   ` inwit
2023-01-30 15:00   ` Greg Minshall

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