[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 480fc95 02/16: Fix functions for browsing annivers
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 480fc95 02/16: Fix functions for browsing anniversary dates |
Date: |
Sun, 16 Jun 2019 12:23:06 -0400 (EDT) |
branch: externals/ebdb
commit 480fc95ef2cf667845f233e1304af3320dea79f6
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Fix functions for browsing anniversary dates
* ebdb.el (ebdb-field-anniversary-calendar,
ebdb-field-anniversary-agenda): Both of these should show the *next*
upcoming occurrence of the anniversary. Also, there was a bug in the
agenda function: it expects a string, not a list.
---
ebdb.el | 39 ++++++++++++++++++++++-----------------
1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/ebdb.el b/ebdb.el
index 57fb8ca..d094d40 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -2917,30 +2917,35 @@ or actual image data."
(field ebdb-field-anniversary))
"Go to the date of anniversary FIELD in the calendar.
If FIELD doesn't specify a year, use the current year."
- ;; This and the next function should be rethought. Do people really
- ;; want to look at the original date? Won't they usually want to
- ;; see the most recent, or the upcoming, occurrence of the date?
- (let ((date (slot-value field 'date)))
- (calendar)
- (calendar-goto-date
- (if (nth 2 date)
- date
- (pcase-let ((`(,month ,day) date)
- (cur-year (nth 5 (decode-time (current-time)))))
- (list month day cur-year))))))
+ (let* ((date (slot-value field 'date))
+ (this-year (nth 5 (decode-time (current-time))))
+ (year (+ this-year
+ ;; If this year's occurrence is already in the past,
+ ;; use next year's.
+ (if (time-less-p
+ (encode-time
+ 1 1 1 (nth 1 date) (nth 0 date) this-year)
+ nil)
+ 1 0))))
+ (calendar)
+ (calendar-goto-date
+ (append (seq-subseq date 0 2) (list year)))))
(cl-defmethod ebdb-field-anniversary-agenda ((_record ebdb-record)
(field ebdb-field-anniversary))
"Go to the date of anniversary FIELD in the Org agenda.
If FIELD doesn't specify a year, use the current year."
- (let ((date (slot-value field 'date)))
+ (let* ((date (slot-value field 'date))
+ (this-year (nth 5 (decode-time (current-time))))
+ (year (+ this-year
+ (if (time-less-p
+ (encode-time
+ 1 1 1 (nth 1 date) (nth 0 date) this-year)
+ nil)
+ 1 0))))
(org-agenda-list
nil
- (calendar-absolute-from-gregorian
- (if (nth 2 date)
- date
- (append date (list (nth 5 (decode-time
- (current-time))))))))))
+ (format "%d-%d-%d" year (nth 0 date) (nth 1 date)))))
(cl-defmethod ebdb-field-anniv-diary-entry ((field ebdb-field-anniversary)
(record ebdb-record))
- [elpa] externals/ebdb updated (05b3270 -> 22895a4), Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb b4e5cd4 03/16: Quit EBDB window after message is sent in mu4e, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 480fc95 02/16: Fix functions for browsing anniversary dates,
Eric Abrahamsen <=
- [elpa] externals/ebdb 4a5ac62 05/16: Fix some plist-get calls to use tags, not symbols, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 688917f 04/16: Use previous object as default when editing anniversary field, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 16185b5 07/16: Fix docstring of ebdb-popup-window, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 2568b9a 10/16: Fix dumb bug in gnus and message window config, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 7a6794b 08/16: Further error with slots as keyword vs symbol, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 838103e 01/16: New option ebdb-default-window-size to control popup sizes, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 48a311a 14/16: Fix bug in popup buffer window splitting, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 1bcfaa1 12/16: Remove EBDB-Message buffer after killing or postponing message, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb e98b18a 06/16: New command ebdb-create-record-and-role, Eric Abrahamsen, 2019/06/16
- [elpa] externals/ebdb 22895a4 16/16: Bump version to 0.6.9, Eric Abrahamsen, 2019/06/16