[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3c6b66c 075/135: Added next-sibling-wrap finder
From: |
Ian Dunn |
Subject: |
[elpa] master 3c6b66c 075/135: Added next-sibling-wrap finder |
Date: |
Mon, 17 Feb 2020 10:52:56 -0500 (EST) |
branch: master
commit 3c6b66c8e39444adeac432304f918e9594138422
Author: Ian Dunn <address@hidden>
Commit: Ian Dunn <address@hidden>
Added next-sibling-wrap finder
* org-edna.el (org-edna-finder/next-sibling-wrap): Added
* org-edna-tests.el (org-edna-finder/next-sibling-wrap-next):
(org-edna-finder/next-sibling-wrap-wrap): New tests.
* org-edna.org (next-sibling-wrap): Document new finder.
---
org-edna-tests.el | 24 +++++++++++++++++++++++-
org-edna.el | 10 +++++++++-
org-edna.org | 11 +++++++++++
3 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/org-edna-tests.el b/org-edna-tests.el
index bdbd49f..00a9a8d 100644
--- a/org-edna-tests.el
+++ b/org-edna-tests.el
@@ -254,6 +254,28 @@
(should (= (length targets) 1))
(should (equal siblings targets))))
+(ert-deftest org-edna-finder/next-sibling-wrap-next ()
+ (let* ((org-agenda-files `(,org-edna-test-file))
+ (current (org-id-find org-edna-test-sibling-two-id t))
+ (siblings (mapcar
+ (lambda (uuid) (org-id-find uuid t))
+ `(,org-edna-test-sibling-three-id)))
+ (targets (org-with-point-at current
+ (org-edna-finder/next-sibling-wrap))))
+ (should (= (length targets) 1))
+ (should (equal siblings targets))))
+
+(ert-deftest org-edna-finder/next-sibling-wrap-wrap ()
+ (let* ((org-agenda-files `(,org-edna-test-file))
+ (current (org-id-find org-edna-test-sibling-three-id t))
+ (siblings (mapcar
+ (lambda (uuid) (org-id-find uuid t))
+ `(,org-edna-test-sibling-one-id)))
+ (targets (org-with-point-at current
+ (org-edna-finder/next-sibling-wrap))))
+ (should (= (length targets) 1))
+ (should (equal siblings targets))))
+
(ert-deftest org-edna-finder/previous-sibling ()
(let* ((org-agenda-files `(,org-edna-test-file))
(current (org-id-find "06aca55e-ce09-46df-80d7-5b52e55d6505" t))
@@ -374,7 +396,7 @@
(org-edna-action/tag! nil "tag")
(should (equal (org-get-tags) '("tag")))
(org-edna-action/tag! nil "")
- (should-not (org-get-tags)))))
+ (should (equal (org-get-tags) '(""))))))
(ert-deftest org-edna-action-property ()
(let ((pom (org-edna-find-test-heading org-edna-test-id-heading-one)))
diff --git a/org-edna.el b/org-edna.el
index d11f5de..38d1a3c 100644
--- a/org-edna.el
+++ b/org-edna.el
@@ -241,7 +241,7 @@ is changing from a TODO state to a DONE state, run BODY."
(error
(if (eq (car err) 'invalid-read-syntax)
(org-edna--print-syntax-error (cdr err))
- (message "Edna Error: %s" (error-message-string err)))
+ (message "Edna Error at heading %s: %s" (org-get-heading t t t)
(error-message-string err)))
(setq org-block-entry-blocking (org-get-heading))
;; Block
nil))
@@ -370,6 +370,14 @@ IDS are all UUIDs as understood by `org-id-find'."
(and (org-get-next-sibling)
(list (point-marker)))))
+(defun org-edna-finder/next-sibling-wrap ()
+ (org-with-wide-buffer
+ (if (org-goto-sibling)
+ (list (point-marker))
+ (org-up-heading-safe)
+ (org-goto-first-child)
+ (list (point-marker)))))
+
(defun org-edna-finder/previous-sibling ()
(org-with-wide-buffer
(and (org-get-last-sibling)
diff --git a/org-edna.org b/org-edna.org
index ee2cd93..240acae 100644
--- a/org-edna.org
+++ b/org-edna.org
@@ -404,6 +404,17 @@ argument.
The ~next-sibling~ keyword returns the next sibling of the current heading, if
any.
+*** next-sibling-wrap
+:PROPERTIES:
+:CUSTOM_ID: next-sibling-wrap
+:DESCRIPTION: Find the next sibling, wrapping around
+:END:
+
+- Syntax: next-sibling-wrap
+
+Find the next sibling of the current heading, if any. If there isn't, wrap
back
+around to the first heading in the same subtree.
+
*** olp
:PROPERTIES:
:CUSTOM_ID: olp
- [elpa] master e6f88e7 069/135: Silenced byte-compiler, (continued)
- [elpa] master e6f88e7 069/135: Silenced byte-compiler, Ian Dunn, 2020/02/17
- [elpa] master ef302af 070/135: Added more docstrings, Ian Dunn, 2020/02/17
- [elpa] master 00abd93 073/135: Fixed tests copyright string, Ian Dunn, 2020/02/17
- [elpa] master c442e77 076/135: Only require subr-x during compilation, Ian Dunn, 2020/02/17
- [elpa] master 311e980 065/135: Compile targets before running tests, Ian Dunn, 2020/02/17
- [elpa] master 9d26430 072/135: Fixed copyright strings., Ian Dunn, 2020/02/17
- [elpa] master f83f47b 074/135: Updated documentation for ELPA release, Ian Dunn, 2020/02/17
- [elpa] master 88b59b3 089/135: Added section to documentation for changes, Ian Dunn, 2020/02/17
- [elpa] master 7e6913b 091/135: Fixed "Setting the Properties" custom_id and title, Ian Dunn, 2020/02/17
- [elpa] master 8e20fb9 098/135: Fixed failing effort test, Ian Dunn, 2020/02/17
- [elpa] master 3c6b66c 075/135: Added next-sibling-wrap finder,
Ian Dunn <=
- [elpa] master 0503710 080/135: Bumped version to beta1, Ian Dunn, 2020/02/17
- [elpa] master 7d30f60 088/135: Catch non-existent timestamps in planning action, Ian Dunn, 2020/02/17
- [elpa] master d0f7e21 085/135: Added two new forms for setting planning information, Ian Dunn, 2020/02/17
- [elpa] master f45f911 115/135: Mention consider in opening of Consideration section, Ian Dunn, 2020/02/17
- [elpa] master c4d1298 099/135: Added new forms for set-property! and fixed up build system, Ian Dunn, 2020/02/17
- [elpa] master 5cacf20 078/135: Updated documentation, Ian Dunn, 2020/02/17
- [elpa] master bad787d 128/135: Bumped version, Ian Dunn, 2020/02/17
- [elpa] master 6869846 130/135: Merged fix., Ian Dunn, 2020/02/17
- [elpa] master c50f484 106/135: Implemented finder cache, Ian Dunn, 2020/02/17
- [elpa] master 4142fb8 108/135: Updated tests for new form expansion, Ian Dunn, 2020/02/17