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

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

[nongnu] elpa/helm 4a3897a2f7: Improve helm-define-key-with-subkeys gene


From: ELPA Syncer
Subject: [nongnu] elpa/helm 4a3897a2f7: Improve helm-define-key-with-subkeys generated docstring
Date: Fri, 22 Jul 2022 00:58:41 -0400 (EDT)

branch: elpa/helm
commit 4a3897a2f756c20d460e969427cc6401e1e637d9
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Improve helm-define-key-with-subkeys generated docstring
---
 helm-core.el | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)

diff --git a/helm-core.el b/helm-core.el
index 464b6bdf6b..90cbf9ba54 100644
--- a/helm-core.el
+++ b/helm-core.el
@@ -220,15 +220,19 @@ i.e. the loop is not entered after running COMMAND."
     (define-key map key com)))
 
 (defun helm-basic-docstring-from-alist (alist)
-  (let ((osk (cl-loop for (k . v) in alist
-                      for count from 1
-                      for sep = (if (> count 1) "," "")
-                      for key = (if (numberp k) (char-to-string k) k)
-                      concat (format "%s`%s'" sep key) into ks
-                      concat (format "%s`%s'" sep v) into kv
-                      finally return (list ks kv))))
-    (format "\nBound as well %s to respectively %s."
-            (car osk) (cadr osk))))
+  (let* ((len (length alist))
+         (osk (cl-loop for (k . v) in alist
+                       for count from 1
+                       for sep = (cond ((and (= count len) (> len 1))
+                                        " and ")
+                                       ((> count 1) ",")
+                                       (t ""))
+                       for key = (if (numberp k) (char-to-string k) k)
+                       concat (format "%s`%s'" sep key) into ks
+                       concat (format "%s`%s'" sep v) into kv
+                       finally return (list ks kv))))
+    (format "\nBound as well %s to %s%s."
+            (car osk) (if (> len 1) "respectively " "") (cadr osk))))
 
 ;;; Keymap
 ;;



reply via email to

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