Hi. Was investigating what I has thought to be a bug in org-agenda, but
turns out that it's something else in my setup. Ended up with a unit test
in the process, hope it's useful.

-- 
Dmitrii Gerasimov
From 9076dda07a4a5e55ac07a0ccd943ead51db7b793 Mon Sep 17 00:00:00 2001
From: Dima Gerasimov <karlic...@gmail.com>
Date: Sat, 13 Oct 2018 14:31:13 +0100
Subject: [PATCH] test-org-agenda: new test for setting priority

* testing/examples/agenda-file.org: add a subnote, make sure it has no
  impact on agenda
* testing/lisp/test-org-agenda.el (test-org-agenda/set-priority): new
  test
---
 testing/examples/agenda-file.org |  1 +
 testing/lisp/test-org-agenda.el  | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/testing/examples/agenda-file.org b/testing/examples/agenda-file.org
index 6579b1cc8..1c7264979 100644
--- a/testing/examples/agenda-file.org
+++ b/testing/examples/agenda-file.org
@@ -3,3 +3,4 @@
 <2017-03-10 Fri>
 * test agenda
 SCHEDULED: <2017-07-19 Wed>
+** subnote
diff --git a/testing/lisp/test-org-agenda.el b/testing/lisp/test-org-agenda.el
index 6aaa88fc3..b28e122e9 100644
--- a/testing/lisp/test-org-agenda.el
+++ b/testing/lisp/test-org-agenda.el
@@ -85,6 +85,23 @@
 	    (looking-at " *agenda-file:Scheduled: *test agenda"))))
   (org-test-agenda--kill-all-agendas))
 
+(ert-deftest test-org-agenda/set-priority ()
+  "One informative line in the agenda. Check that org-agenda-priority updates the agenda."
+  (cl-assert (not org-agenda-sticky) nil "precondition violation")
+  (cl-assert (not (org-test-agenda--agenda-buffers))
+	     nil "precondition violation")
+  (let ((org-agenda-span 'day)
+	(org-agenda-files `(,(expand-file-name "examples/agenda-file.org"
+					       org-test-dir))))
+    (org-agenda-list nil "<2017-07-19 Wed>")
+    (set-buffer org-agenda-buffer-name)
+
+    (should
+     (progn (goto-line 3)
+	    (org-agenda-priority ?B)
+	    (looking-at-p " *agenda-file:Scheduled: *\\[#B\\] test agenda"))))
+  (org-test-agenda--kill-all-agendas))
+
 (ert-deftest test-org-agenda/sticky-agenda-name ()
   "Agenda buffer name after having created one sticky agenda buffer."
   (cl-assert (not org-agenda-sticky) nil "precondition violation")
-- 
2.17.1

Reply via email to