From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Loury Subject: [PATCH] Find a link after point in `org-open-at-point' Date: Mon, 26 Jan 2015 09:05:44 +0100 Message-ID: <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]:36689) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFegH-00083m-IH for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 03:06:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFegC-0006el-B3 for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 03:05:57 -0500 Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]:61085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFegC-0006eR-3m for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 03:05:52 -0500 Received: by mail-we0-f169.google.com with SMTP id u56so7569630wes.0 for ; Mon, 26 Jan 2015 00:05:50 -0800 (PST) Received: from localhost (162.48.7.109.rev.sfr.net. [109.7.48.162]) by mx.google.com with ESMTPSA id ud4sm12851475wib.0.2015.01.26.00.05.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Jan 2015 00:05:49 -0800 (PST) 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 Dear all, 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. 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=20ea1d4d061a74d7797bf5cf78dc2722eb0baaf7be 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. Now, the user doesn't have to move the cursor to the link to call `org-open-at-point'. =2D-- lisp/org.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index 1041c13..5373179 100755 =2D-- a/lisp/org.el +++ b/lisp/org.el @@ -10694,7 +10694,9 @@ 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 + ) t)) (type (org-element-type context)) (value (org-element-property :value context))) @@ -10870,6 +10872,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)) + (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 iQEcBAEBAgAGBQJUxfVZAAoJEHXSPO10ORBq9mgH/RazfWfQZZQ6XiOt3Tnm8LrD SR3v5h7pKZCk45S/wzploNLdLW9XkRHZ22FoK1bTrqWwrOnSI6BWv6W8GBnujELT PuXeQpFt0cY/ubSxLUC4NWX79ruPpsW9FLFvjHBhh+canczdS3T2pN28MFTzEenx JHNhF8BHFOi/DeuFVBoh78/UIfA5CrSfbJVmHGsTg74zxxILgp+WDVP/kkoo//y5 fQGfGiLKPipYc7uX8l2Q2SOr5lSE4eFYmru61iHsn9ZK04V15UVI7YqE5dBhYvx1 Tr+fzpPYSOxwsXw1hhefWC0YYhMB1U/b0TlxtjJVg1j1xJahoCLZqAQ9frgZkF0= =r4Bd -----END PGP SIGNATURE----- --==-=-=--