how to make return follow hyperlink?
Suvayu Ali
fatkasuvayu+linux at gmail.com
Thu Aug 27 03:53:29 PDT 2015
On Thu, Aug 27, 2015 at 09:35:26AM +0100, David Edmondson wrote:
> On Wed, Aug 26 2015, Peter Salazar <cycleofsong at 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.
More information about the notmuch
mailing list