branch: externals/ebdb commit 9e5eccb62eef72e46eb8506c6c2dd66bd72eb8af Author: Eric Abrahamsen <e...@ericabrahamsen.net> Commit: Eric Abrahamsen <e...@ericabrahamsen.net>
Start making use of ebdb-read-string-override, bump to 0.8.7 * ebdb.el (ebdb-read): Use prompt overrides in address and phone reading. (ebdb-read-string): Fix brain-o about meaning of "append" vs "prepend". * ebdb-i18n-basic.el (ebdb-read-i18n): Add "Address" string into prompt. Really we should be using a new :around method to set ebdb-read-string-override around everything, including the i18n machinery, but I can't be bothered, so we're faking it here. --- ebdb-i18n-basic.el | 2 +- ebdb.el | 100 +++++++++++++++++++++++++++-------------------------- 2 files changed, 52 insertions(+), 50 deletions(-) diff --git a/ebdb-i18n-basic.el b/ebdb-i18n-basic.el index 05ab0d2..b59c92b 100644 --- a/ebdb-i18n-basic.el +++ b/ebdb-i18n-basic.el @@ -138,7 +138,7 @@ number, and any remaining as an extension." slots :region (cdr (assoc-string (ebdb-read-string - "State" + "Address state" (when obj (rassoc (ebdb-address-region obj) ebdb-i18n-usa-states)) ebdb-i18n-usa-states t) diff --git a/ebdb.el b/ebdb.el index 7cd8f88..6841e39 100644 --- a/ebdb.el +++ b/ebdb.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2016-2021 Free Software Foundation, Inc. -;; Version: 0.8.6 +;; Version: 0.8.7 ;; Package-Requires: ((emacs "25.1") (seq "2.15")) ;; Maintainer: Eric Abrahamsen <e...@ericabrahamsen.net> @@ -1854,51 +1854,52 @@ Primary sorts before normal sorts before defunct." (ebdb-add-to-list ebdb-postcode-list postcode))) (cl-defmethod ebdb-read ((class (subclass ebdb-field-address)) &optional slots obj) - (let ((streets - (if (plist-member slots :streets) - (plist-get slots :streets) - (ebdb-edit-address-street (when obj (ebdb-address-streets obj))))) - (locality - (if (plist-member slots :locality) - (plist-get slots :locality) - (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) - (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) - (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) - (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) - (or - (ebdb-with-exit - (ebdb-read-string "Country" - (if obj (slot-value obj 'country) - ebdb-default-country) - ebdb-country-list)) - "")))) + (let* ((ebdb-read-string-override '("Address" . prepend)) + (streets + (if (plist-member slots :streets) + (plist-get slots :streets) + (ebdb-edit-address-street (when obj (ebdb-address-streets obj))))) + (locality + (if (plist-member slots :locality) + (plist-get slots :locality) + (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) + (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) + (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) + (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) + (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 @@ -2009,7 +2010,8 @@ internationalization." (apply #'concat outstring))))) (cl-defmethod ebdb-read ((class (subclass ebdb-field-phone)) &optional slots obj) - (let* ((country + (let* ((ebdb-read-string-override '("Phone" . prepend)) + (country (or (and obj (slot-value obj 'country-code)) (plist-get slots :country-code))) @@ -4983,9 +4985,9 @@ same meaning as in `completing-read'." (pcase ebdb-read-string-override (`,(and str (pred stringp)) str) (`(,str . append) - (concat str " " prompt)) - (`(,str . prepend) (concat prompt " " str)) + (`(,str . prepend) + (concat str " " (downcase prompt))) (_ prompt)) ": ")) (ebdb-string-trim