unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* how to make return follow hyperlink?
@ 2015-08-26 19:10 Peter Salazar
  2015-08-27  8:35 ` David Edmondson
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Peter Salazar @ 2015-08-26 19:10 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 240 bytes --]

How do I make it so that hitting RET on a hyperlink follows it? Is there a
setting analogous to org-return-follows-link? I often have links in
incoming emails, and I'd like to be able to open them in my browser with
one keystroke.

Thanks!

[-- Attachment #2: Type: text/html, Size: 276 bytes --]

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

* Re: how to make return follow hyperlink?
  2015-08-26 19:10 how to make return follow hyperlink? Peter Salazar
@ 2015-08-27  8:35 ` David Edmondson
  2015-08-27 10:53   ` Suvayu Ali
  2015-08-27 18:24 ` Mark Walters
  2015-08-28  5:55 ` Tomi Ollila
  2 siblings, 1 reply; 6+ messages in thread
From: David Edmondson @ 2015-08-27  8:35 UTC (permalink / raw)
  To: Peter Salazar, notmuch

On Wed, Aug 26 2015, Peter Salazar <cycleofsong@gmail.com> wrote:
> How do I make it so that hitting RET on a hyperlink follows it? Is there a
> setting analogous to org-return-follows-link? I often have links in
> incoming emails, and I'd like to be able to open them in my browser with
> one keystroke.

Having that binding would conflict badly with the existing binding for
`notmuch-show-toggle-message' (which has been in place for a long
time!).

Perhaps not what you want, but for me, clicking on the link with the
mouse opens the link.

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

* Re: how to make return follow hyperlink?
  2015-08-27  8:35 ` David Edmondson
@ 2015-08-27 10:53   ` Suvayu Ali
  0 siblings, 0 replies; 6+ messages in thread
From: Suvayu Ali @ 2015-08-27 10:53 UTC (permalink / raw)
  To: notmuch

On Thu, Aug 27, 2015 at 09:35:26AM +0100, David Edmondson wrote:
> On Wed, Aug 26 2015, Peter Salazar <cycleofsong@gmail.com> wrote:
> > How do I make it so that hitting RET on a hyperlink follows it? Is there a
> > setting analogous to org-return-follows-link? I often have links in
> > incoming emails, and I'd like to be able to open them in my browser with
> > one keystroke.
> 
> Having that binding would conflict badly with the existing binding for
> `notmuch-show-toggle-message' (which has been in place for a long
> time!).
> 
> Perhaps not what you want, but for me, clicking on the link with the
> mouse opens the link.

I think you can hack around by advicing notmuch-show-toggle-message and
making it context sensitive.  I don't really know the best way to
determine the context, but a quick hack would be to look at the
face-at-point.  Of course this requires font-lock-mode be active.

I once did something like this to expand abbreviations (below).  Of
course you will have to use a defadvice instead of a defun.

Hope this helps,


(defun sa-expand-abbrev-in-context (expand)
  "Expands abbreviations according to the context. Determines
whether within comments or source by looking at the face name. If
within comments the `basic-text-mode-abbrev-table' is used, the
major mode abbrev-table is used otherwise.

Expansion is done by the function passed as the argument. This is
controlled by the \"abnormal\" hook `abbrev-expand-functions'."
;; backward-char checks if end-of-buffer as when point at e-o-b face is `nil'
;; the function call expand does the expansion, usually `expand-abbrev'
  (if (save-excursion
	(string-match "comment\\|string"
		      (symbol-name (if (< (point) (point-max))
				       (face-at-point)
				     (backward-char)
				     (face-at-point)))))
      (let ((local-abbrev-table basic-text-mode-abbrev-table))
	(funcall expand))
    (funcall expand)))


-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: how to make return follow hyperlink?
  2015-08-26 19:10 how to make return follow hyperlink? Peter Salazar
  2015-08-27  8:35 ` David Edmondson
@ 2015-08-27 18:24 ` Mark Walters
  2015-08-28  5:55 ` Tomi Ollila
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Walters @ 2015-08-27 18:24 UTC (permalink / raw)
  To: Peter Salazar, notmuch


> How do I make it so that hitting RET on a hyperlink follows it? Is there a
> setting analogous to org-return-follows-link? I often have links in
> incoming emails, and I'd like to be able to open them in my browser with
> one keystroke.

A long time ago I posted a patch to do this: I don't know if it still
applies or how easy it is to update (nor do I remember how I got on with
the difficulties bremner mentioned in the the quoted bit of irc
conversation in the third message of that thread).

id:1377240695-825-1-git-send-email-markwalters1009@gmail.com

Incidentally, pressing RET on id: links already overrides the use of RET
to collapse a message so I don't see it as problematic to do the same
for http links.

Best wishes

Mark

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

* Re: how to make return follow hyperlink?
  2015-08-26 19:10 how to make return follow hyperlink? Peter Salazar
  2015-08-27  8:35 ` David Edmondson
  2015-08-27 18:24 ` Mark Walters
@ 2015-08-28  5:55 ` Tomi Ollila
  2015-08-28 18:13   ` Peter Salazar
  2 siblings, 1 reply; 6+ messages in thread
From: Tomi Ollila @ 2015-08-28  5:55 UTC (permalink / raw)
  To: Peter Salazar, notmuch

On Wed, Aug 26 2015, Peter Salazar <cycleofsong@gmail.com> wrote:

> How do I make it so that hitting RET on a hyperlink follows it? Is there a
> setting analogous to org-return-follows-link? I often have links in
> incoming emails, and I'd like to be able to open them in my browser with
> one keystroke.

BTW: the interesting thing is that in text/plain content id: links already
do something -- and e.g. https?: do not. in text/html content I get
'No usable browser found'(*) when pressing RET on top of http: link so it
must be doing something ;)

Tomi

(*) Note to self: hack something to show the link using (message ...) in this case.

>
> Thanks!

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

* Re: how to make return follow hyperlink?
  2015-08-28  5:55 ` Tomi Ollila
@ 2015-08-28 18:13   ` Peter Salazar
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Salazar @ 2015-08-28 18:13 UTC (permalink / raw)
  To: Tomi Ollila; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 958 bytes --]

Thanks for all the responses! Mark, where could we find the patch you
mentioned? I wouldn't know how to test/update it, but maybe someone else on
the list has the requisite hacking skills...

On Fri, Aug 28, 2015 at 1:55 AM, Tomi Ollila <tomi.ollila@iki.fi> wrote:

> On Wed, Aug 26 2015, Peter Salazar <cycleofsong@gmail.com> wrote:
>
> > How do I make it so that hitting RET on a hyperlink follows it? Is there
> a
> > setting analogous to org-return-follows-link? I often have links in
> > incoming emails, and I'd like to be able to open them in my browser with
> > one keystroke.
>
> BTW: the interesting thing is that in text/plain content id: links already
> do something -- and e.g. https?: do not. in text/html content I get
> 'No usable browser found'(*) when pressing RET on top of http: link so it
> must be doing something ;)
>
> Tomi
>
> (*) Note to self: hack something to show the link using (message ...) in
> this case.
>
> >
> > Thanks!
>

[-- Attachment #2: Type: text/html, Size: 1431 bytes --]

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

end of thread, other threads:[~2015-08-28 18:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-26 19:10 how to make return follow hyperlink? Peter Salazar
2015-08-27  8:35 ` David Edmondson
2015-08-27 10:53   ` Suvayu Ali
2015-08-27 18:24 ` Mark Walters
2015-08-28  5:55 ` Tomi Ollila
2015-08-28 18:13   ` Peter Salazar

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