branch: externals/vcard
commit 3fb7c41c8eca14d6191c4216fcb6faf1256ec119
Author: Eric Abrahamsen <e...@ericabrahamsen.net>
Commit: Eric Abrahamsen <e...@ericabrahamsen.net>

    Make dependency on iso8601 conditional
    
    * vcard-parse.el (vcard-parse-card): Only use `iso8601-parse' if it is 
bound.
---
 vcard-parse.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/vcard-parse.el b/vcard-parse.el
index aaa4a04662..571faa1c6e 100644
--- a/vcard-parse.el
+++ b/vcard-parse.el
@@ -93,7 +93,8 @@
 ;;; Code:
 
 (require 'cl-lib)
-(require 'iso8601)
+;; This library is unavailable pre Emacs 27.
+(require 'iso8601 nil t)
 
 (defvar vcard-parse-select-fields nil
   "A list of field types to select.
@@ -315,13 +316,15 @@ properties -- and returning a card/contact object."
                              ((and (stringp val-type)
                                    (string-equal val-type "timestamp"))
                               (parse-time-string v))
-                             (t
-                              (condition-case nil
+                              ((fboundp 'iso8601-parse)
+                               (condition-case nil
                                   (iso8601-parse v)
                                 (error
                                  (lwarn
                                   '(vcard) :error
-                                  "Unable to parse date value: \"%s\"" v))))))
+                                  "Unable to parse date value: \"%s\"" v))))
+                             (t
+                              v)))
                         v))
                      ((string-match-p "\\`[[:digit:].]+\\'" v)
                       (string-to-number v))

Reply via email to