From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KEweJwroV196XAAA0tVLHw (envelope-from ) for ; Tue, 08 Sep 2020 20:22:34 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id ILDuIgroV19bAwAAbx9fmQ (envelope-from ) for ; Tue, 08 Sep 2020 20:22:34 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 273DE94028F for ; Tue, 8 Sep 2020 20:22:33 +0000 (UTC) Received: from localhost ([::1]:39158 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kFk8O-0005NV-2z for larch@yhetil.org; Tue, 08 Sep 2020 16:22:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kFk50-0008FW-HA for emacs-orgmode@gnu.org; Tue, 08 Sep 2020 16:19:02 -0400 Received: from mout-p-201.mailbox.org ([80.241.56.171]:25686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1kFk4x-0006DT-A9; Tue, 08 Sep 2020 16:19:01 -0400 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:105:465:1:2:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4BmGgv4JfXzQkm4; Tue, 8 Sep 2020 22:18:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id zbeVPAhnQs-D; Tue, 8 Sep 2020 22:18:48 +0200 (CEST) Date: Tue, 8 Sep 2020 22:18:45 +0200 From: Vasilij Schneidermann To: Bastien Subject: Re: Bug: [PATCH] org-datetree-insert-line doesn't honor headline spacing customization [9.3 (release_9.3 @ /usr/share/emacs/27.1/lisp/org/)] Message-ID: <20200908201845.GA1346@odonien.localdomain> References: <20200903085054.GA21638@odonien.localdomain> <87v9gsff0g.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IrhDeMKUP4DT/M7F" Content-Disposition: inline In-Reply-To: <87v9gsff0g.fsf@gnu.org> X-MBO-SPAM-Probability: X-Rspamd-Score: -6.75 / 15.00 / 15.00 X-Rspamd-Queue-Id: 95DB026C X-Rspamd-UID: 6dd2c8 Received-SPF: pass client-ip=80.241.56.171; envelope-from=mail@vasilij.de; helo=mout-p-201.mailbox.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/08 16:18:51 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -3.11 X-TUID: BS1vV/2P/15S --IrhDeMKUP4DT/M7F Content-Type: multipart/mixed; boundary="SLDf9lqlvOQaIe6s" Content-Disposition: inline --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Bastien, > Thanks for the patch. I tried it and these two tests fail: >=20 > FAILED test-org-datetree/find-date-create > FAILED test-org-datetree/find-iso-week-create >=20 > Perhaps you can check the value of `org-blank-before-new-entry' and > insert a blank line only if needed? I've looked at the tests and concluded that your proposed approach is better and updated the patch accordingly. Vasilij --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename="0001-Ensure-blank-line-if-needed-for-datetrees.patch" Content-Transfer-Encoding: quoted-printable =46rom 47085037a1882a2a723076a47972feb35cc42a7b Mon Sep 17 00:00:00 2001 =46rom: Vasilij Schneidermann Date: Tue, 8 Sep 2020 22:15:25 +0200 Subject: [PATCH] Ensure blank line if needed for datetrees --- lisp/org-datetree.el | 2 ++ testing/lisp/test-org-datetree.el | 56 +++++++++++++++---------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/lisp/org-datetree.el b/lisp/org-datetree.el index ce91591f1..d4ccc84bb 100644 --- a/lisp/org-datetree.el +++ b/lisp/org-datetree.el @@ -185,6 +185,8 @@ inserted into the buffer." =20 (defun org-datetree-insert-line (year &optional month day text) (delete-region (save-excursion (skip-chars-backward " \t\n") (point)) (p= oint)) + (when (assq 'heading org-blank-before-new-entry) + (insert "\n")) (insert "\n" (make-string org-datetree-base-level ?*) " \n") (backward-char) (when month (org-do-demote)) diff --git a/testing/lisp/test-org-datetree.el b/testing/lisp/test-org-date= tree.el index 5557d5e23..daebcaace 100644 --- a/testing/lisp/test-org-datetree.el +++ b/testing/lisp/test-org-datetree.el @@ -26,7 +26,7 @@ ;; When date is missing, create it. (should (string-match - "\\`\\* 2012\n\\*\\* 2012-03 .*\n\\*\\*\\* 2012-03-29 .*\\'" + "\\`\\* 2012\n\n\\*\\* 2012-03 .*\n\n\\*\\*\\* 2012-03-29 .*\\'" (org-test-with-temp-text "" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-date-create '(3 29 2012))) @@ -34,7 +34,7 @@ ;; Do not create new year node when one exists. (should (string-match - "\\`\\* 2012\n\\*\\* 2012-03 .*\n\\*\\*\\* 2012-03-29 .*\\'" + "\\`\\* 2012\n\n\\*\\* 2012-03 .*\n\n\\*\\*\\* 2012-03-29 .*\\'" (org-test-with-temp-text "* 2012\n" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-date-create '(3 29 2012))) @@ -42,24 +42,24 @@ ;; Do not create new month node when one exists. (should (string-match - "\\`\\* 2012\n\\*\\* 2012-03 .*\n\\*\\*\\* 2012-03-29 .*\\'" - (org-test-with-temp-text "* 2012\n** 2012-03 month" + "\\`\\* 2012\n\n\\*\\* 2012-03 .*\n\n\\*\\*\\* 2012-03-29 .*\\'" + (org-test-with-temp-text "* 2012\n\n** 2012-03 month" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-date-create '(3 29 2012))) (org-trim (buffer-string))))) ;; Do not create new day node when one exists. (should (string-match - "\\`\\* 2012\n\\*\\* 2012-03 .*\n\\*\\*\\* 2012-03-29 .*\\'" - (org-test-with-temp-text "* 2012\n** 2012-03 month\n*** 2012-03-29 day" + "\\`\\* 2012\n\n\\*\\* 2012-03 .*\n\n\\*\\*\\* 2012-03-29 .*\\'" + (org-test-with-temp-text "* 2012\n\n** 2012-03 month\n\n*** 2012-03-29= day" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-date-create '(3 29 2012))) (org-trim (buffer-string))))) ;; Sort new entry in right place. (should (string-match - "\\`\\* 2012\n\\*\\* 2012-02 .*\n\\*\\*\\* 2012-02-01 .*\n\n\\*\\* 201= 2-03 .*\n\\*\\*\\* 2012-03-29 .*\\'" - (org-test-with-temp-text "* 2012\n** 2012-03 month\n*** 2012-03-29 day" + "\\`\\* 2012\n\n\\*\\* 2012-02 .*\n\n\\*\\*\\* 2012-02-01 .*\n\n\\*\\*= 2012-03 .*\n\n\\*\\*\\* 2012-03-29 .*\\'" + (org-test-with-temp-text "* 2012\n\n** 2012-03 month\n\n*** 2012-03-29= day" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-date-create '(3 29 2012)) (org-datetree-find-date-create '(2 1 2012))) @@ -68,14 +68,14 @@ ;; in entry. When set to `inactive', insert an inactive one. (should (string-match - "\\`\\* 2012\n\\*\\* 2012-03 .*\n\\*\\*\\* \\(2012-03-29\\) .*\n[ \t]*= <\\1.*?>\\'" + "\\`\\* 2012\n\n\\*\\* 2012-03 .*\n\n\\*\\*\\* \\(2012-03-29\\) .*\n[ = \t]*<\\1.*?>\\'" (org-test-with-temp-text "* 2012\n" (let ((org-datetree-add-timestamp t)) (org-datetree-find-date-create '(3 29 2012))) (org-trim (buffer-string))))) (should (string-match - "\\`\\* 2012\n\\*\\* 2012-03 .*\n\\*\\*\\* \\(2012-03-29\\) .*\n[ \t]*= \\[\\1.*?\\]\\'" + "\\`\\* 2012\n\n\\*\\* 2012-03 .*\n\n\\*\\*\\* \\(2012-03-29\\) .*\n[ = \t]*\\[\\1.*?\\]\\'" (org-test-with-temp-text "* 2012\n" (let ((org-datetree-add-timestamp 'inactive)) (org-datetree-find-date-create '(3 29 2012))) @@ -91,9 +91,9 @@ (org-trim (buffer-string))))) (should (string-match - "\\*\\* H1.1\n:PROPERTIES:\n:DATE_TREE: t\n:END:\n\\*\\*\\* 2012" + "\\*\\* H1.1\n:PROPERTIES:\n:DATE_TREE: t\n:END:\n\n\\*\\*\\* 2012" (org-test-with-temp-text - "* H1\n** H1.1\n:PROPERTIES:\n:DATE_TREE: t\n:END:\n* H2" + "* H1\n\n** H1.1\n:PROPERTIES:\n:DATE_TREE: t\n:END:\n\n* H2" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-date-create '(3 29 2012))) (org-trim (buffer-string))))) @@ -101,14 +101,14 @@ (should (string-match "\\*\\*\\* 2012-03-29" - (org-test-with-temp-text "* 2012\n** 2012-03 month\n*** 2012-03-29 day" + (org-test-with-temp-text "* 2012\n\n** 2012-03 month\n\n*** 2012-03-29= day" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-date-create '(3 29 2012))) (buffer-substring (point) (line-end-position))))) (should (string-match "\\*\\*\\* 2012-03-29" - (org-test-with-temp-text "* 2012\n** 2012-03 month\n*** 2012-03-29 day" + (org-test-with-temp-text "* 2012\n\n** 2012-03 month\n\n*** 2012-03-29= day" (let ((org-datetree-add-timestamp t)) (org-datetree-find-date-create '(3 29 2012))) (buffer-substring (point) (line-end-position)))))) @@ -118,7 +118,7 @@ ;; When date is missing, create it with the entry under month. (should (string-match - "\\`\\* 2012\n\\*\\* 2012-03 .*\\'" + "\\`\\* 2012\n\n\\*\\* 2012-03 .*\\'" (org-test-with-temp-text "" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-month-create '(3 29 2012))) @@ -129,7 +129,7 @@ ;; When date is missing, create it. (should (string-match - "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\\'" + "\\`\\* 2015\n\n\\*\\* 2015-W01\n\n\\*\\*\\* 2014-12-31 .*\\'" (org-test-with-temp-text "" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-iso-week-create '(12 31 2014))) @@ -137,7 +137,7 @@ ;; Do not create new year node when one exists. (should (string-match - "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\\'" + "\\`\\* 2015\n\n\\*\\* 2015-W01\n\n\\*\\*\\* 2014-12-31 .*\\'" (org-test-with-temp-text "* 2015\n" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-iso-week-create '(12 31 2014))) @@ -145,23 +145,23 @@ ;; Do not create new month node when one exists. (should (string-match - "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\\'" - (org-test-with-temp-text "* 2015\n** 2015-W01" + "\\`\\* 2015\n\n\\*\\* 2015-W01\n\n\\*\\*\\* 2014-12-31 .*\\'" + (org-test-with-temp-text "* 2015\n\n** 2015-W01" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-iso-week-create '(12 31 2014))) (org-trim (buffer-string))))) ;; Do not create new day node when one exists. (should (string-match - "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\\'" - (org-test-with-temp-text "* 2015\n** 2015-W01\n*** 2014-12-31 day" + "\\`\\* 2015\n\n\\*\\* 2015-W01\n\n\\*\\*\\* 2014-12-31 .*\\'" + (org-test-with-temp-text "* 2015\n\n** 2015-W01\n\n*** 2014-12-31 day" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-iso-week-create '(12 31 2014))) (org-trim (buffer-string))))) ;; Sort new entry in right place. (should (string-match - "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* 2014-12-31 .*\n\n\\*\\* 2015-= W36\n\\*\\*\\* 2015-09-01 .*\\'" + "\\`\\* 2015\n\n\\*\\* 2015-W01\n\n\\*\\*\\* 2014-12-31 .*\n\n\\*\\* 2= 015-W36\n\n\\*\\*\\* 2015-09-01 .*\\'" (org-test-with-temp-text "* 2015" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-iso-week-create '(9 1 2015)) @@ -171,14 +171,14 @@ ;; in entry. When set to `inactive', insert an inactive one. (should (string-match - "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* \\(2014-12-31\\) .*\n[ \t]*<\= \1.*?>\\'" + "\\`\\* 2015\n\n\\*\\* 2015-W01\n\n\\*\\*\\* \\(2014-12-31\\) .*\n[ \t= ]*<\\1.*?>\\'" (org-test-with-temp-text "* 2015\n" (let ((org-datetree-add-timestamp t)) (org-datetree-find-iso-week-create '(12 31 2014))) (org-trim (buffer-string))))) (should (string-match - "\\`\\* 2015\n\\*\\* 2015-W01\n\\*\\*\\* \\(2014-12-31\\) .*\n[ \t]*\\= [\\1.*?\\]\\'" + "\\`\\* 2015\n\n\\*\\* 2015-W01\n\n\\*\\*\\* \\(2014-12-31\\) .*\n[ \t= ]*\\[\\1.*?\\]\\'" (org-test-with-temp-text "* 2015\n" (let ((org-datetree-add-timestamp 'inactive)) (org-datetree-find-iso-week-create '(12 31 2014))) @@ -194,9 +194,9 @@ (org-trim (buffer-string))))) (should (string-match - "\\*\\* H1.1\n:PROPERTIES:\n:WEEK_TREE: t\n:END:\n\\*\\*\\* 2015" + "\\*\\* H1.1\n:PROPERTIES:\n:WEEK_TREE: t\n:END:\n\n\\*\\*\\* 2015" (org-test-with-temp-text - "* H1\n** H1.1\n:PROPERTIES:\n:WEEK_TREE: t\n:END:\n* H2" + "* H1\n** H1.1\n:PROPERTIES:\n:WEEK_TREE: t\n:END:\n\n* H2" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-iso-week-create '(12 31 2014))) (org-trim (buffer-string))))) @@ -204,14 +204,14 @@ (should (string-match "\\*\\*\\* 2014-12-31" - (org-test-with-temp-text "* 2015\n** 2015-W01\n*** 2014-12-31 day" + (org-test-with-temp-text "* 2015\n\n** 2015-W01\n\n*** 2014-12-31 day" (let ((org-datetree-add-timestamp nil)) (org-datetree-find-iso-week-create '(12 31 2014))) (buffer-substring (point) (line-end-position))))) (should (string-match "\\*\\*\\* 2014-12-31" - (org-test-with-temp-text "* 2015\n** 2015-W01\n*** 2014-12-31 day" + (org-test-with-temp-text "* 2015\n\n** 2015-W01\n\n*** 2014-12-31 day" (let ((org-datetree-add-timestamp t)) (org-datetree-find-iso-week-create '(12 31 2014))) (buffer-substring (point) (line-end-position)))))) --=20 2.28.0 --SLDf9lqlvOQaIe6s-- --IrhDeMKUP4DT/M7F Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEE0dAcySl3bqM8O17WFmfJg6zCifoFAl9X5xwACgkQFmfJg6zC ifqpEQf7BPG/MO+dJDDuUjhUi/4gNTwzxPEg6uYNbrqOymFVmGbfJV8+S4HOZBFa IbzVhM/BHNIvL9M2pxxn+S94cdJpJa/bSofya3/FquZYGy+iHqzIGd5hfMjiOWLf qR4KpBKOXVTDFkLnIYhEC/74x4jO6HTzWne+14mzJ1onJa8eEHJnQf8ZAzgqY7C9 KfBnImvtP3LzmMzO2OrnP1+aR97Y3DO+7dOmuyZF2bnwxKCSZkqJZwhSxxH7JE1J I6etdplzzNgmYajqwiErE0d2Bx2hrgLV4hi2IVpIqUxy3VCALdwCxcil2KYt5GeI ZknUsSXFITak5M86fRiq+JB10jP7IA== =srpc -----END PGP SIGNATURE----- --IrhDeMKUP4DT/M7F--