From mboxrd@z Thu Jan 1 00:00:00 1970 From: Samuel Loury Subject: Re: [PATCH] Fix uncaught error when trying to open a link at point Date: Sat, 16 Mar 2013 20:22:15 +0100 Message-ID: <87vc8r6tg8.fsf@gmail.com> References: <87ehjmvxk7.fsf@konixwork.incubateur.ens-lyon.fr> <87bodpdskd.fsf@bzg.ath.cx> <87wqvtrxcp.fsf@konixwork.incubateur.ens-lyon.fr> <87pq1lrssp.fsf@konixwork.incubateur.ens-lyon.fr> <87vc9wutfw.fsf@bzg.ath.cx> <87y5es88xo.fsf@konixwork.incubateur.ens-lyon.fr> <87k3qctayy.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57471) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGwgT-00029B-MF for emacs-orgmode@gnu.org; Sat, 16 Mar 2013 15:22:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGwgS-0002Cv-1R for emacs-orgmode@gnu.org; Sat, 16 Mar 2013 15:22:25 -0400 Received: from mail-we0-x22b.google.com ([2a00:1450:400c:c03::22b]:50165) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGwgR-0002Cr-Nv for emacs-orgmode@gnu.org; Sat, 16 Mar 2013 15:22:23 -0400 Received: by mail-we0-f171.google.com with SMTP id u54so3963148wey.30 for ; Sat, 16 Mar 2013 12:22:22 -0700 (PDT) In-Reply-To: <87k3qctayy.fsf@bzg.ath.cx> 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: Bastien Cc: OrgMode ML --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Hi, Bastien writes: > No problem at all. I decided to go and accept patches from people > that did not confirm they got the FSF papers because merging 8.0 > into Emacs trunk is not likely to happen to soon... So. Good news, I got the confirmation that my "assignment/disclaimer process with the FSF is currently complete". I do not know however if I have to do something to prove that in order to submit patches to this mailing list. I then propose in attachment a set of four tests testing the problem mentioned in this thread: the behavior of org-open-at-point in front of bracket links and plain links. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Test-the-org-open-at-point-function.patch Content-Transfer-Encoding: quoted-printable From=205bd8eb52cb047b5290300fe850fca894babf05ff Mon Sep 17 00:00:00 2001 From: Samuel Loury Date: Sat, 16 Mar 2013 20:12:42 +0100 Subject: [PATCH] Test the org-open-at-point function. * testing/examples/open-at-point.org: new file. * testing/lisp/test-org-open-at-point.el: new file. This tests only the function when inside or before bracket links and plain links. =2D-- testing/examples/open-at-point.org | 8 +++++ testing/lisp/test-org-open-at-point.el | 61 ++++++++++++++++++++++++++++= ++++ 2 files changed, 69 insertions(+) create mode 100644 testing/examples/open-at-point.org create mode 100644 testing/lisp/test-org-open-at-point.el diff --git a/testing/examples/open-at-point.org b/testing/examples/open-at-= point.org new file mode 100644 index 0000000..b3bb92d =2D-- /dev/null +++ b/testing/examples/open-at-point.org @@ -0,0 +1,8 @@ + +* Header 1 + :PROPERTIES: + :ID: header1_with_great_id + :END: +* Header 2 + [[id:header1_with_great_id][Header 1]] + id:header1_with_great_id diff --git a/testing/lisp/test-org-open-at-point.el b/testing/lisp/test-org= -open-at-point.el new file mode 100644 index 0000000..78724c8 =2D-- /dev/null +++ b/testing/lisp/test-org-open-at-point.el @@ -0,0 +1,61 @@ +;;; test-org-open-at-point.el + +;; Copyright (c) Samuel Loury +;; Authors: Samuel Loury + +;; Released under the GNU General Public License version 3 +;; see: http://www.gnu.org/licenses/gpl-3.0.html + +;;;; Comments: + +;; Test for the org-open-at-point function + +;;; Code: + +(save-excursion + (set-buffer (get-buffer-create "test-org-open-at-point.el")) + (setq ly-here + (file-name-directory + (or load-file-name (buffer-file-name))))) + +(defun test-org-open-at-point/goto-fixture () + (find-file-other-window + (concat ly-here "../examples/open-at-point.org")) + (set-buffer "open-at-point.org")) + +(ert-deftest test-org-open-at-point/bracket-link-inside () + "Test `org-open-at-point' from inside a bracket link." + (test-org-open-at-point/goto-fixture) + ;; go inside the bracket link + (goto-char 113) + (org-open-at-point) + ;; should now be in front of the header + (should (equal (point) 2))) + +(ert-deftest test-org-open-at-point/plain-link-inside () + "Test `org-open-at-point' from inside a plain link." + (test-org-open-at-point/goto-fixture) + ;; go inside the plain link + (goto-char 126) + (org-open-at-point) + ;; should now be in front of the header + (should (equal (point) 2))) + +(ert-deftest test-org-open-at-point/bracket-link-before () + "Test `org-open-at-point' from before a bracket link but in the same lin= e." + (test-org-open-at-point/goto-fixture) + ;; go before the bracket link + (goto-char 83) + (message "point %s" (point)) + (org-open-at-point) + ;; should now be in front of the header + (should (equal (point) 2))) + +(ert-deftest test-org-open-at-point/plain-link-before () + "Test `org-open-at-point' from before a plain link but in the same line." + (test-org-open-at-point/goto-fixture) + ;; go before the plain link + (goto-char 124) + (org-open-at-point) + ;; should now be in front of the header + (should (equal (point) 2))) =2D-=20 1.7.10.4 --=-=-= Content-Type: text/plain -- Konubinix GPG Key : 7439106A Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A --=-=-=-- --==-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJRRMZoAAoJEHXSPO10ORBqrIcH/3GjDLapUFYbEcejiqb+6LDi ZIkIKXh+iqDo5qlDOn6FYQACEwrvNABh8O08jaCOQy3F3t12OsJNDl0UWiYYaJzp RQVdZQJP9vtCUvPbvC20XUpJBf+oo28okg9LaEbQhLVoNGPqdzGrCktJXMj3fWD3 FZgMWbrJyRjBiTegyLZWj5ksrs3ie5dpX0GxXm2pBUdUUYC/xq+WsHLSpUzAPxE3 XXwiPW5NOwg85AvYduwhiF5vWilz0p1eSoasTwovB8kXxa1zH+vFqACjxRGuM2AE 1Uim29sQjQY2Hq9qHoySEkkLLlAdOPFpXMpL6AWPExFiWHCBTJsSiS/RUC1+jOA= =9qDP -----END PGP SIGNATURE----- --==-=-=--