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

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

[elpa] externals/ebdb 4fd89fe 01/10: Make all address slots skippable


From: Eric Abrahamsen
Subject: [elpa] externals/ebdb 4fd89fe 01/10: Make all address slots skippable
Date: Fri, 8 Oct 2021 13:59:54 -0400 (EDT)

branch: externals/ebdb
commit 4fd89fe651b01727cf603ba185b01109b8443f7f
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>

    Make all address slots skippable
    
    * ebdb.el (ebdb-read): You never know what kind of data people will
    have to enter. Use `ebdb-with-exit' for everything, and use empty
    strings for null values.
---
 ebdb.el | 41 +++++++++++++++++++++++++++--------------
 1 file changed, 27 insertions(+), 14 deletions(-)

diff --git a/ebdb.el b/ebdb.el
index c7ff946..25ddb64 100644
--- a/ebdb.el
+++ b/ebdb.el
@@ -1861,31 +1861,44 @@ Primary sorts before normal sorts before defunct."
        (locality
         (if (plist-member slots :locality)
             (plist-get slots :locality)
-          (ebdb-read-string "Town/City"
-                            (when obj (ebdb-address-locality obj)) 
ebdb-locality-list)))
+          (or
+           (ebdb-with-exit
+            (ebdb-read-string "Town/City"
+                              (when obj (ebdb-address-locality obj)) 
ebdb-locality-list))
+           "")))
        (neighborhood
         (if (plist-member slots :neighborhood)
             (plist-get slots :neighborhood)
-          (ebdb-read-string "Neighborhood/Suburb/Zone"
-                            (when obj (ebdb-address-neighborhood obj)))))
+          (or
+           (ebdb-with-exit
+            (ebdb-read-string "Neighborhood/Suburb/Zone"
+                              (when obj (ebdb-address-neighborhood obj))))
+           "")))
        (region
         (if (plist-member slots :region)
             (plist-get slots :region)
-          (ebdb-read-string "State/Province"
-                            (when obj (ebdb-address-region obj)) 
ebdb-region-list)))
+          (or (ebdb-with-exit
+               (ebdb-read-string "State/Province"
+                                 (when obj (ebdb-address-region obj)) 
ebdb-region-list))
+              "")))
        (postcode
         (if (plist-member slots :postcode)
             (plist-get slots :postcode)
-          (ebdb-read-string "Postcode"
-                            (when obj (ebdb-address-postcode obj))
-                            ebdb-postcode-list)))
+          (or (ebdb-with-exit
+               (ebdb-read-string "Postcode"
+                                 (when obj (ebdb-address-postcode obj))
+                                 ebdb-postcode-list))
+              "")))
        (country
         (if (plist-member slots :country)
             (plist-get slots :country)
-          (ebdb-read-string "Country"
-                            (if obj (slot-value obj 'country)
-                              ebdb-default-country)
-                            ebdb-country-list))))
+          (or
+           (ebdb-with-exit
+            (ebdb-read-string "Country"
+                              (if obj (slot-value obj 'country)
+                                ebdb-default-country)
+                              ebdb-country-list))
+           ""))))
 
     (cl-call-next-method
      class
@@ -1905,7 +1918,7 @@ Primary sorts before normal sorts before defunct."
        (while t
          (setq street
                (ebdb-read-string
-                (format "Street, line %d: " (1+ n))
+                (format "Street, line %d" (1+ n))
                 (nth n streets) ebdb-street-list))
          (push street list)
          (setq n (1+ n)))



reply via email to

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