From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Loury Subject: Re: [PATCH] Find a link after point in `org-open-at-point' Date: Mon, 26 Jan 2015 16:50:19 +0100 Message-ID: <87mw55k0ck.fsf@konixwork.incubateur.ens-lyon.fr> References: <8761but19j.fsf@konixwork.incubateur.ens-lyon.fr> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49681) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFlvm-000815-AR for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 10:50:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFlvi-0000wq-QO for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 10:50:26 -0500 Received: from mail-wg0-x231.google.com ([2a00:1450:400c:c00::231]:62636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFlvi-0000wd-IT for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 10:50:22 -0500 Received: by mail-wg0-f49.google.com with SMTP id k14so9742658wgh.8 for ; Mon, 26 Jan 2015 07:50:21 -0800 (PST) Received: from localhost (162.48.7.109.rev.sfr.net. [109.7.48.162]) by mx.google.com with ESMTPSA id u7sm14450368wiy.18.2015.01.26.07.50.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jan 2015 07:50:20 -0800 (PST) In-Reply-To: <8761but19j.fsf@konixwork.incubateur.ens-lyon.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode List --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Samuel Loury writes: > I would like to propose a patch for `org-open-at-point' to find a link > after point when called inside a paragraph. It had this behavior at some > time and I think lost it during the org-element re-factoring. This patch > restores this ancient behavior with the new way the function is coded. > > Please find the patch attached in this mail. Actually, I just found out that the behavior could be the same in items. Please find attached the modified patch. Best regards, --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Find-a-link-after-point-in-org-open-at-point.patch Content-Transfer-Encoding: quoted-printable From=20e05f1a54af26f2eebc4b33fe961951af65e70195 Mon Sep 17 00:00:00 2001 From: Konubinix Date: Mon, 26 Jan 2015 08:44:06 +0100 Subject: [PATCH] Find a link after point in `org-open-at-point' * lisp/org.el (org-open-at-point): Look for a link after point but in the s= ame line as (point) when called inside a paragraph or an item. Now, the user doesn't have to move the cursor to the link to call `org-open-at-point'. =2D-- lisp/org.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 1041c13..73ff1fc 100755 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -10694,7 +10694,8 @@ link in a property drawer line." (org-element-lineage (org-element-context) '(comment comment-block footnote-definition footnote-reference =2D headline inlinetask link node-property timestamp) + headline inlinetask link node-property + timestamp paragraph item) t)) (type (org-element-type context)) (value (org-element-property :value context))) @@ -10870,6 +10871,12 @@ link in a property drawer line." (=3D (org-element-property :post-affiliated context) (line-beginning-position))))))) (org-footnote-action)) + ;; On a paragraph, find a link on the current line after point. + ((memq type '(paragraph item)) + (save-excursion + (if (re-search-forward org-any-link-re (line-end-position) t) + (org-open-at-point) + (user-error "No link found")))) (t (user-error "No link found"))))) (move-marker org-open-link-marker nil) (run-hook-with-args 'org-follow-link-hook))) =2D-=20 2.1.4 --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable =2D-=20 Konubinix GPG Key : 7439106A Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJUxmI7AAoJEHXSPO10ORBq/ZAH/jzvNpuu7R6nY0tFMtfK6WMa cPIp00GQ2Z99qbxlrCBJP6gZZmUW8lsy9mzTN7B+IkwmXqYqhnxo5M6ryi1KJyVe S1K6Xu9iicVrV+SCvvVzc1gfhXo+TGbIIDXwFj9zlnC5sQrh+GMJ66jZ7Y9mRGIc S0F9tmi7riqXNs2u69GZkOMCE9s548Ybu2ImIBWZauDq14xnjOW3SdKvki15ti66 DhMxlOf4sDVrauLwvzbKPKLtH0jf2ANrGASkIW8PmJMI1DeZqeaVhXgZzhHriwSl nqOEpBwdStLn86nfVaMg6+GaXoPUM35Qw8IQ0X/u5IDomi3naThUy7ncInXD14Y= =OfV1 -----END PGP SIGNATURE----- --==-=-=--