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

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

[elpa] externals/srht 8cab1e48bc 2/4: Bump version to 0.3


From: ELPA Syncer
Subject: [elpa] externals/srht 8cab1e48bc 2/4: Bump version to 0.3
Date: Fri, 3 Nov 2023 18:59:01 -0400 (EDT)

branch: externals/srht
commit 8cab1e48bcb5b8ee70c498a712fb6f52eddc95ab
Author: Aleksandr Vityazev <avityazev@posteo.org>
Commit: Aleksandr Vityazev <avityazev@posteo.org>

    Bump version to 0.3
    
    * lisp/srht: Make srht-annotation a function instead of a macro.
    * lisp/srht-git: Update according to the change.
    * lisp/srht-paste: Update according to the change.
---
 lisp/srht-git.el   |  5 +++--
 lisp/srht-paste.el |  5 +++--
 lisp/srht.el       | 24 ++++++++----------------
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/lisp/srht-git.el b/lisp/srht-git.el
index c1433f739c..d71f4c09a2 100644
--- a/lisp/srht-git.el
+++ b/lisp/srht-git.el
@@ -185,8 +185,9 @@ is assumed."
 
 (defun srht-git--annot (domain str)
   "Function to add annotations in the completions buffer for STR and DOMAIN."
-  (srht-annotation (seq _n created visibility)
-    (srht-git--candidates domain) str))
+  (pcase-let (((seq _n created visibility)
+               (assoc str (srht-git--candidates domain))))
+    (srht-annotation str visibility created)))
 
 (defun srht-git--repo-name-read (domain)
   "Read a repository name in the minibuffer, with completion.
diff --git a/lisp/srht-paste.el b/lisp/srht-paste.el
index 95144f0a9c..d1571a25ff 100644
--- a/lisp/srht-paste.el
+++ b/lisp/srht-paste.el
@@ -73,8 +73,9 @@ For the existing PASTES for the DOMAIN domain name."
 
 (defun srht-paste--annot (domain str)
   "Function to add annotations in the completions buffer for STR and DOMAIN."
-  (srht-annotation (seq _f created visibility)
-    (srht-paste--candidates domain) str))
+  (pcase-let (((seq _f created visibility)
+               (assoc str (srht-paste--candidates domain))))
+    (srht-annotation str visibility created)))
 
 (defun srht-paste--sha (domain)
   "Read a FILENAME in the minibuffer, with completion and return SHA.
diff --git a/lisp/srht.el b/lisp/srht.el
index 04fcb2c49d..544accd34a 100644
--- a/lisp/srht.el
+++ b/lisp/srht.el
@@ -5,7 +5,7 @@
 ;; Author: Aleksandr Vityazev <avityazev@posteo.org>
 ;; Maintainer: Aleksandr Vityazev <avityazev@posteo.org>
 ;; Keywords: comm vc
-;; Package-Version: 0.2
+;; Package-Version: 0.3
 ;; Homepage: https://sr.ht/~akagi/srht.el/
 ;; Keywords: comm
 ;; Package-Requires: ((emacs "27.1") (plz "0.7"))
@@ -258,22 +258,14 @@ For the existing PLIST for the DOMAIN domain name."
   (declare (indent 1))
   `(when ,val (setq ,plist (plist-put ,plist (intern ,domain) ,val))))
 
-(defmacro srht-annotation (pattern candidates str)
-  "Annotate STR.
-The value of the first CANDIDATES elements whose car equal STR is bind
-to pcase PATTERN."
+(defun srht-annotation (str visibility created)
+  "Return an annotation for STR using VISIBILITY and CREATED."
   (declare (indent 1))
-  (let ((bb (gensym "bb"))
-        (sb (gensym "sb"))
-        (l (gensym "l")))
-    `(pcase-let* ((,pattern (assoc ,str ,candidates))
-                  (,l (- 40 (length (substring-no-properties ,str))))
-                  (,bb (make-string ,l (string-to-char " ")))
-                  (,sb (cond
-                        ((string= visibility "public") "      ")
-                        ((string= visibility "private") "     ")
-                        ((string= visibility "unlisted") "    "))))
-       (concat ,bb (format "%s%s%s" visibility ,sb created)))))
+  (let* ((ws-char (string-to-char " "))
+         (len (- 40 (length (substring-no-properties str))))
+         (blank (make-string (if (> len 1) len 1) ws-char)))
+    (concat blank visibility (make-string (- 12 (length visibility)) ws-char)
+            created)))
 
 (provide 'srht)
 ;;; srht.el ends here



reply via email to

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