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

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

[elpa] externals/vcard 1399f2b8cb 06/13: (vcard-format-box): Return empt


From: Stefan Monnier
Subject: [elpa] externals/vcard 1399f2b8cb 06/13: (vcard-format-box): Return empty string if no data to present; don't
Date: Tue, 12 Jul 2022 00:17:02 -0400 (EDT)

branch: externals/vcard
commit 1399f2b8cbdee6e0b1265070b135190ec0815b96
Author: Noah Friedman <friedman@splode.com>
Commit: Noah Friedman <friedman@splode.com>

    (vcard-format-box): Return empty string if no data to present; don't
    return borders.
    
    (vcard-format-get-address): Handle case that `adr' contains only one field.
---
 vcard.el | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/vcard.el b/vcard.el
index ad24f7e0ec..58662c6c92 100644
--- a/vcard.el
+++ b/vcard.el
@@ -7,7 +7,7 @@
 ;; Keywords: extensions
 ;; Created: 1997-09-27
 
-;; $Id: vcard.el,v 1.5 1998/06/05 19:56:06 friedman Exp $
+;; $Id: vcard.el,v 1.6 1998/07/21 20:35:40 friedman Exp $
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -206,10 +206,12 @@ keys."
   (let* ((lines (vcard-format-lines vcard-data))
          (len (vcard-format-max-length lines))
          (edge (concat "\n+" (make-string (+ len 2) ?-) "+\n"))
-         (line-fmt (format "| %%-%ds |" len)))
-    (concat edge
-            (mapconcat (function (lambda (s) (format line-fmt s))) lines "\n")
-            edge)))
+         (line-fmt (format "| %%-%ds |" len))
+         (formatted-lines
+          (mapconcat (function (lambda (s) (format line-fmt s))) lines "\n")))
+    (if (string= formatted-lines "")
+        formatted-lines
+      (concat edge formatted-lines edge))))
 
 (defun vcard-format-string (vcard-data)
   "Format VCARD-DATA into a string suitable for presentation.
@@ -249,8 +251,11 @@ presentation buffer."
       name)))
 
 (defun vcard-format-get-address (vcard-data)
-  (let* ((addr (or (vcard-format-ref '("adr" "dom") vcard-data)
-                   (vcard-format-ref "adr" vcard-data)))
+  (let* ((addr-raw (or (vcard-format-ref '("adr" "dom") vcard-data)
+                       (vcard-format-ref "adr" vcard-data)))
+         (addr (if (consp addr-raw)
+                   addr-raw
+                 (list addr-raw)))
          (street (delete "" (list (nth 0 addr) (nth 1 addr) (nth 2 addr))))
          (city-list (delete "" (nthcdr 3 addr)))
          (city (cond ((null (car city-list)) nil)



reply via email to

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