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

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

[elpa] externals/org-contacts 722bc2ec91 4/4: changed edge case of `leng


From: ELPA Syncer
Subject: [elpa] externals/org-contacts 722bc2ec91 4/4: changed edge case of `length` number detect positive number condition
Date: Tue, 21 May 2024 09:58:35 -0400 (EDT)

branch: externals/org-contacts
commit 722bc2ec91ca66a33f6b57cd02010f4fdbf542a9
Author: stardiviner <numbchild@gmail.com>
Commit: stardiviner <numbchild@gmail.com>

    changed edge case of `length` number detect positive number condition
    
    When the contact heading is very long,
    `(- some-positive-number (length contact-name))` can yield negative
    number. In other words, your code will still err when the headline is
    longer than org-tags-column.
---
 org-contacts.el | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/org-contacts.el b/org-contacts.el
index 1e6406a3c8..2efbaa346d 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -890,11 +890,10 @@ This can be property key checking.")
                        (let ((org-property-separators (list (cons 
org-contacts-email-property "[,\ ]"))))
                          (org-entry-get headline org-contacts-email-property))
                        "\n"))
-         (middle-line-length (when-let* ((length (- (abs org-tags-column)
-                                                    (length (string-join tags 
":"))
-                                                    (length contact-name)))
-                                         (wholenump length))
-                               length)))
+         (middle-line-length (let ((length (- (abs org-tags-column)
+                                              (length (string-join tags ":"))
+                                              (length contact-name))))
+                               (if (> length 0) length 0))))
     ;; detect whether headline is an org-contacts entry?
     (when (seq-intersection org-contacts-identity-properties-list (mapcar 'car 
properties))
       (propertize



reply via email to

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