emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/ebdb 688917f 04/16: Use previous object as default when


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 688917f 04/16: Use previous object as default when editing anniversary field
Date: Sun, 16 Jun 2019 12:23:06 -0400 (EDT)

branch: externals/ebdb
commit 688917f4a1123f298e84ee374b93e3efc98cce5d
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    Use previous object as default when editing anniversary field
    
    * ebdb.el (ebdb-read): Most of the other fields already did this...
---
 ebdb.el | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ebdb.el b/ebdb.el
index d094d40..f7edfad 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -1943,13 +1943,18 @@ Eventually this method will go away."
 (cl-defmethod ebdb-read ((class (subclass ebdb-field-anniversary)) &optional 
slots obj)
   ;; Fake `calendar-read-date' to make the year optional.
   (let* ((year (ebdb-with-exit
-               (read-number "Year (C-g to omit): ")))
+               (read-number "Year (C-g to omit): "
+                            (when obj (nth 2 (slot-value obj 'date))))))
         (month (cdr (assoc-string
                      (completing-read
                       "Month: "
                       (mapcar 'list (append
                                      calendar-month-name-array nil))
-                      nil t)
+                      nil t (when obj
+                              (aref
+                               calendar-month-name-array
+                               (1- (nth 0 (slot-value obj 'date)))))
+                      nil)
                      (calendar-make-alist
                       calendar-month-name-array 1)
                      t)))
@@ -1958,7 +1963,9 @@ Eventually this method will go away."
                month (or year 2017)))
         (day (calendar-read (format "Day (1-%d): " last)
                             (lambda (x) (and (< 0 x)
-                                             (<= x last))))))
+                                             (<= x last)))
+                            (when obj (number-to-string
+                                       (nth 1 (slot-value obj 'date)))))))
     (cl-call-next-method class
                         (plist-put slots :date
                                    (list month day year))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]