From 780976c872e9b32a60864e2d8740ced560961a0e Mon Sep 17 00:00:00 2001 From: Suvayu Ali Date: Thu, 27 Aug 2015 12:53:29 +0200 Subject: [PATCH] Re: how to make return follow hyperlink? --- d4/85e7859c0dd3f9cca256a8338cf17dbc32798c | 121 ++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 d4/85e7859c0dd3f9cca256a8338cf17dbc32798c diff --git a/d4/85e7859c0dd3f9cca256a8338cf17dbc32798c b/d4/85e7859c0dd3f9cca256a8338cf17dbc32798c new file mode 100644 index 000000000..e91a57a0a --- /dev/null +++ b/d4/85e7859c0dd3f9cca256a8338cf17dbc32798c @@ -0,0 +1,121 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 7F6816DE0275 + for ; Thu, 27 Aug 2015 03:53:36 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.82 +X-Spam-Level: +X-Spam-Status: No, score=-0.82 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled +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 zY2RoCol4hcE for ; + Thu, 27 Aug 2015 03:53:34 -0700 (PDT) +Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com + [209.85.212.172]) + by arlo.cworth.org (Postfix) with ESMTPS id 796CC6DE0140 + for ; Thu, 27 Aug 2015 03:53:34 -0700 (PDT) +Received: by wicne3 with SMTP id ne3so70860103wic.0 + for ; Thu, 27 Aug 2015 03:53:32 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=sender:date:from:to:subject:message-id:mail-followup-to:references + :mime-version:content-type:content-disposition:in-reply-to + :user-agent; bh=nhVyFsrS1FEXTxmNnhLCOT3HT+wXBA3vpOmODW25TKc=; + b=eIQvfOzTCmcAmE9x+VS0P8eUJYKeBKvrLSZ/OJ/bp1g08QkrS4tPCSDf10wE6GIUkP + bx8izmVC9OiB3P8/JldRHZQk/vx2SM2f/TSZwA2dO/rkj3+YNy5bMZeuOVxIQVPg0jJP + sD+/QbUkgd8S9K2HcL9sMOoJi46a00GAq+yxAMjj31gzCY8jLxBhmw27NWXu52SyHLPz + xs4HOnK3FnQWbV27G2M1iCh8yGjL544bH7rYlpC9z3umKewwVSiCbL1MaMw9XrlvCd3/ + YJ8rqIcP+5n49BGAInS43kaDbS3yy5vxrIXC5Z4Iv/DXcnr3vKRW/YyzgaJgGntm7Lgt + WiRg== +X-Received: by 10.194.221.4 with SMTP id qa4mr4109426wjc.145.1440672812588; + Thu, 27 Aug 2015 03:53:32 -0700 (PDT) +Received: from chitra.no-ip.org (5072840E.static.ziggozakelijk.nl. + [80.114.132.14]) + by smtp.gmail.com with ESMTPSA id cw8sm2465523wjb.49.2015.08.27.03.53.31 + for + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Thu, 27 Aug 2015 03:53:31 -0700 (PDT) +Sender: Suvayu Ali +Date: Thu, 27 Aug 2015 12:53:29 +0200 +From: Suvayu Ali +To: notmuch@notmuchmail.org +Subject: Re: how to make return follow hyperlink? +Message-ID: <20150827105329.GT31789@chitra.no-ip.org> +Mail-Followup-To: notmuch@notmuchmail.org +References: + + +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: +User-Agent: Mutt/1.5.23.1 (2014-03-12) +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Thu, 27 Aug 2015 10:53:36 -0000 + +On Thu, Aug 27, 2015 at 09:35:26AM +0100, David Edmondson wrote: +> On Wed, Aug 26 2015, Peter Salazar 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. -- 2.26.2