[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/org-journal 46146e71cb 6/7: merged & reconciled existing P
|
From: |
ELPA Syncer |
|
Subject: |
[nongnu] elpa/org-journal 46146e71cb 6/7: merged & reconciled existing PRs #420 and #422 |
|
Date: |
Sat, 6 Jan 2024 13:00:05 -0500 (EST) |
branch: elpa/org-journal
commit 46146e71cb3be8e335addfe9bedb394e05c06919
Author: Jason May <jmay@pobox.com>
Commit: Jason May <jmay@pobox.com>
merged & reconciled existing PRs #420 and #422
---
org-journal.el | 16 +++++--
tests/org-journal-test.el | 120 +++++++++++++++++++++++-----------------------
2 files changed, 72 insertions(+), 64 deletions(-)
diff --git a/org-journal.el b/org-journal.el
index d97700cc99..ca747ecbe7 100644
--- a/org-journal.el
+++ b/org-journal.el
@@ -394,6 +394,10 @@ This prefix key is used for:
- `org-journal-search' (key \"s\")"
:type 'string)
+(defcustom org-journal-scheduled-string "" ; or org-scheduled-string
+ "String added before a time stamp for schedules."
+ :type 'string)
+
(defvar org-journal-after-entry-create-hook nil
"Hook called after journal entry creation.")
@@ -1125,7 +1129,8 @@ With non-nil prefix argument create a regular entry
instead of a TODO entry."
(insert (format-time-string org-journal-time-format time)))
(save-excursion
(insert "\n"
- org-scheduled-string " ") ; "SCHEDULED: "
+ org-journal-scheduled-string
+ (if (length> org-journal-scheduled-string 0) " " ""))
(org-insert-time-stamp
time org-time-was-given nil nil nil (list org-end-time-was-given)))))
@@ -1149,7 +1154,7 @@ With non-nil prefix argument create a regular entry
instead of a TODO entry."
"\\(TODO \\)?"
"\\("
(replace-regexp-in-string "[[:digit:]]" "[[:digit:]]"
- (format-time-string
org-journal-time-format '(0 0) t))
+ (format-time-string
org-journal-time-format '(0 0) t))
"\\)")))
(if (re-search-forward regexp (line-end-position) t)
(progn
@@ -1158,11 +1163,14 @@ With non-nil prefix argument create a regular entry
instead of a TODO entry."
(insert (format-time-string org-journal-time-format
time))))))
;; update time of timestamp (<...>)
(org-back-to-heading)
- (if (re-search-forward (concat org-scheduled-string "[[:blank:]]*"
org-ts-regexp) nil t)
+ (if (re-search-forward (concat (regexp-quote
org-journal-scheduled-string)
+ "[[:blank:]]*" org-ts-regexp)
+ nil t)
(replace-match "")
(org-end-of-subtree)
(insert "\n"))
- (insert org-scheduled-string " ")
+ (insert org-journal-scheduled-string
+ (if (length> org-journal-scheduled-string 0) " " ""))
(org-insert-time-stamp time org-time-was-given nil nil nil (list
org-end-time-was-given))
(org-cut-subtree))
(let (org-journal-carryover-items)
diff --git a/tests/org-journal-test.el b/tests/org-journal-test.el
index 090f64eca7..ff54f76ef3 100644
--- a/tests/org-journal-test.el
+++ b/tests/org-journal-test.el
@@ -323,66 +323,66 @@
(ert-deftest org-journal-scheduled-weekly-test ()
(org-journal-test-macro
- (let ((org-journal-file-type 'weekly)
- (org-journal-start-on-weekday 7) ;; sunday
- org-journal-encrypt-journal
- org-journal-enable-encryption
- org-journal-enable-cache
- org-journal-file-header
- day-offset)
+ (let ((org-journal-file-type 'weekly)
+ (org-journal-start-on-weekday 7) ;; sunday
+ org-journal-encrypt-journal
+ org-journal-enable-encryption
+ org-journal-enable-cache
+ org-journal-file-header
+ day-offset)
- ;; Compute correct day-offset, so future and today journal entry end
in the same file
- (let ((current-date (calendar-current-date))
- (current-date+1 (calendar-current-date 1)))
- (if (equal (org-journal--convert-time-to-file-type-time
- (org-journal--calendar-date->time current-date) )
- (org-journal--convert-time-to-file-type-time
- (org-journal--calendar-date->time current-date+1)))
- (setq day-offset 1)
- (setq day-offset 2)))
+ ;; Compute correct day-offset, so future and today journal entry end in
the same file
+ (let ((current-date (calendar-current-date))
+ (current-date+1 (calendar-current-date 1)))
+ (if (equal (org-journal--convert-time-to-file-type-time
+ (org-journal--calendar-date->time current-date) )
+ (org-journal--convert-time-to-file-type-time
+ (org-journal--calendar-date->time current-date+1)))
+ (setq day-offset 1)
+ (setq day-offset 2)))
- (let* ((scheduled-entry-date (calendar-current-date day-offset))
- (scheduled-entry-time (org-journal--calendar-date->time
scheduled-entry-date))
- (new-entry-date (calendar-current-date (if (= day-offset 1) nil
1)))
- (new-entry-time (org-journal--calendar-date->time
new-entry-date))
- ;; TODO(cschwarzgruber): For PR #338
- ;; " "
- ;; org-scheduled-string
- ;; " "
- (scheduled-string (concat "<" (format-time-string (cdr
org-time-stamp-formats) scheduled-entry-time) ">")))
- ;; Add first scheduled entry
- (org-journal-new-scheduled-entry nil scheduled-entry-time)
- (insert "Task 1")
- ;; Add a second scheduled entry
- (org-journal-new-scheduled-entry nil scheduled-entry-time)
- (insert "Task 2")
- ;; New today entry should be added at the beginning of the journal
file
- (org-journal-new-entry 4 new-entry-time)
- (should (equal (buffer-substring-no-properties (point-min)
(point-max))
- (with-temp-buffer
- (insert
- (concat
- ;; Today entry
- "* Test header\n"
- ":PROPERTIES:\n"
- (concat
- ":CREATED: "
- (format-time-string
org-journal-created-property-timestamp-format new-entry-time)
- "\n")
- ":END:\n"
+ (let* ((scheduled-entry-date (calendar-current-date day-offset))
+ (scheduled-entry-time (org-journal--calendar-date->time
scheduled-entry-date))
+ (new-entry-date (calendar-current-date (if (= day-offset 1) nil
1)))
+ (new-entry-time (org-journal--calendar-date->time new-entry-date))
+ ;; TODO(cschwarzgruber): For PR #338
+ ;; " "
+ ;; org-scheduled-string
+ ;; " "
+ (scheduled-string (concat "<" (format-time-string (car
org-time-stamp-formats) scheduled-entry-time) ">")))
+ ;; Add first scheduled entry
+ (org-journal-new-scheduled-entry nil scheduled-entry-time)
+ (insert "Task 1")
+ ;; Add a second scheduled entry
+ (org-journal-new-scheduled-entry nil scheduled-entry-time)
+ (insert "Task 2")
+ ;; New today entry should be added at the beginning of the journal file
+ (org-journal-new-entry 4 new-entry-time)
+ (should (equal (buffer-substring-no-properties (point-min) (point-max))
+ (with-temp-buffer
+ (insert
+ (concat
+ ;; Today entry
+ "* Test header\n"
+ ":PROPERTIES:\n"
+ (concat
+ ":CREATED: "
+ (format-time-string
org-journal-created-property-timestamp-format new-entry-time)
+ "\n")
+ ":END:\n"
- ;; Scheduled entries
- "* Test header\n"
- ":PROPERTIES:\n"
- (concat
- ":CREATED: "
- (format-time-string
org-journal-created-property-timestamp-format scheduled-entry-time)
- "\n")
- ":END:\n"
- "** TODO Task 1\n"
- scheduled-string
- "\n"
- ;; (format-time-string " SCHEDULED: <%F %a>\n" )
- "** TODO Task 2\n"
- scheduled-string))
- (buffer-substring-no-properties (point-min)
(point-max)))))))))
+ ;; Scheduled entries
+ "* Test header\n"
+ ":PROPERTIES:\n"
+ (concat
+ ":CREATED: "
+ (format-time-string
org-journal-created-property-timestamp-format scheduled-entry-time)
+ "\n")
+ ":END:\n"
+ "** TODO Task 1\n"
+ scheduled-string
+ "\n"
+ ;; (format-time-string " SCHEDULED: <%F %a>\n" )
+ "** TODO Task 2\n"
+ scheduled-string))
+ (buffer-substring-no-properties (point-min)
(point-max)))))))))
- [nongnu] elpa/org-journal updated (7cf8922003 -> a834a5325e), ELPA Syncer, 2024/01/06
- [nongnu] elpa/org-journal eab8f64251 3/7: Merge branch 'fix-broken-tests' into fix-merge-420, ELPA Syncer, 2024/01/06
- [nongnu] elpa/org-journal 09541d9d04 2/7: revise tests so they run cleanly on emacs 29.1 #412, ELPA Syncer, 2024/01/06
- [nongnu] elpa/org-journal ff770e884c 5/7: Merge branch 'fix-broken-tests' into fix-merge-420, ELPA Syncer, 2024/01/06
- [nongnu] elpa/org-journal 46146e71cb 6/7: merged & reconciled existing PRs #420 and #422,
ELPA Syncer <=
- [nongnu] elpa/org-journal 81bd35f192 1/7: Improvements to org-journal-new-scheduled-entry and org-journal-reschedule-scheduled-entry, ELPA Syncer, 2024/01/06
- [nongnu] elpa/org-journal a834a5325e 7/7: Merge branch 'fix-merge-420', ELPA Syncer, 2024/01/06
- [nongnu] elpa/org-journal ae339d9024 4/7: applied patch from @TPKato - thanks!, ELPA Syncer, 2024/01/06