[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ebdb 8700b4a 06/10: Don't show redundant labels for fie
From: |
Eric Abrahamsen |
Subject: |
[elpa] externals/ebdb 8700b4a 06/10: Don't show redundant labels for fields that don't have their own |
Date: |
Fri, 8 Oct 2021 13:59:58 -0400 (EDT) |
branch: externals/ebdb
commit 8700b4a33f578328a4e8210a4befaa23590791ff
Author: Eric Abrahamsen <eric@ericabrahamsen.net>
Commit: Eric Abrahamsen <eric@ericabrahamsen.net>
Don't show redundant labels for fields that don't have their own
This might indicate we need to re-think the label formatting
procedure.
* ebdb-com.el (ebdb-fmt-field-label): If phones and addresses are
going to get a generic label on the left anyway, don't repeat that
label in parentheses. Only output that label if the field instance has
its own label.
* ebdb-format.el (ebdb-fmt-field): Do the same for any field being
output in the 'compact style.
---
ebdb-com.el | 15 +++++++++++++--
ebdb-format.el | 10 +++++++---
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/ebdb-com.el b/ebdb-com.el
index 2588e16..ca48212 100644
--- a/ebdb-com.el
+++ b/ebdb-com.el
@@ -548,13 +548,24 @@ choice: that formatter should be selected explicitly."
(field ebdb-field-phone)
(_style (eql oneline))
&optional _record)
- (format "phone (%s)" (ebdb-field-label field)))
+ (let ((label (slot-value field 'label)))
+ ;; Don't use `ebdb-field-label' because if the field has no label,
+ ;; we end up outputting something stupid like "phone (phone)".
+ (concat
+ "phone"
+ (when label
+ (format " (%s)" label)))))
(cl-defmethod ebdb-fmt-field-label ((_fmt ebdb-formatter-ebdb)
(field ebdb-field-address)
(_style (eql oneline))
&optional _record)
- (format "address (%s)" (ebdb-field-label field)))
+ (let ((label (slot-value field 'label)))
+ ;; As above.
+ (concat
+ "address"
+ (when label
+ (format " (%s)" label)))))
(cl-defmethod ebdb-fmt-field-label ((_fmt ebdb-formatter-ebdb)
(field ebdb-field-relation)
diff --git a/ebdb-format.el b/ebdb-format.el
index ceb02bf..cb2c987 100644
--- a/ebdb-format.el
+++ b/ebdb-format.el
@@ -248,9 +248,13 @@ a symbol indicating a style of some sort, such as 'compact
or
(field ebdb-field-labeled)
(_style (eql compact))
(record ebdb-record))
- (format "(%s) %s"
- (ebdb-field-label field)
- (ebdb-fmt-field fmt field 'oneline record)))
+ (let ((label (slot-value field 'label)))
+ ;; The compact style shouldn't output a default label, only use it
+ ;; if the field in question really has one.
+ (concat
+ (when label
+ (format "(%s) " label))
+ (ebdb-fmt-field fmt field 'oneline record))))
(cl-defmethod ebdb-fmt-field ((_fmt ebdb-formatter)
(field ebdb-field)
- [elpa] externals/ebdb updated (b08a526 -> 13a9a9d), Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb 4fd89fe 01/10: Make all address slots skippable, Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb a5571cf 03/10: Add address i18n for Singapore, Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb 8573c7f 02/10: Fix argument order in ebdb-read-i18n, Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb 082acb1 05/10: Fix retrieval of default when editing object labels, Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb 044b022 04/10: Remove the Universal Time flag for timestamp output, Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb 4aa9845 07/10: Improve reading of states in German addresses, Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb 8700b4a 06/10: Don't show redundant labels for fields that don't have their own,
Eric Abrahamsen <=
- [elpa] externals/ebdb 13a9a9d 10/10: Simplify German address formatting, bump version to 0.8.6, Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb 3e6bed6 09/10: Borrow changes from notification branch, Eric Abrahamsen, 2021/10/08
- [elpa] externals/ebdb 53773d1 08/10: Remove UK address read method from i18n-basic, Eric Abrahamsen, 2021/10/08