[Top][All Lists]

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

[elpa] master 8a40934 062/399: counsel.el: Clean up compile candidates l

From: Oleh Krehel
Subject: [elpa] master 8a40934 062/399: counsel.el: Clean up compile candidates list
Date: Sat, 20 Jul 2019 14:56:49 -0400 (EDT)

branch: master
commit 8a409347dca90d7bf8486c6e003540fbb2bf5566
Author: Basil L. Contovounesios <address@hidden>
Commit: Basil L. Contovounesios <address@hidden>

    counsel.el: Clean up compile candidates list
    (counsel--get-compile-candidates): Follow Emacs docstring
    conventions.  Avoid destructively modifying lists returned by
    counsel-compile-local-builds elements.  Simplify logic.
 counsel.el | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/counsel.el b/counsel.el
index 1c2fa61..11f4b64 100644
--- a/counsel.el
+++ b/counsel.el
@@ -5248,24 +5248,18 @@ The optional BLDDIR is useful for other helpers that 
have found
 (defun counsel--get-compile-candidates (&optional dir)
-  "Return the list of compile commands as directed by
+  "Return the list of compile commands.
+This is determined by `counsel-compile-local-builds', which see."
   (let (cands)
-    (if (stringp counsel-compile-local-builds)
-        (setq cands (list counsel-compile-local-builds))
-      (dolist (c counsel-compile-local-builds)
-        (let ((more-cands
-               (cond
-                 ((functionp c)
-                  (let ((fcands (funcall c dir)))
-                    (if (and fcands (nlistp fcands))
-                        (list fcands)
-                      fcands)))
-                 ((stringp c) (list c))
-                 ((listp c) c))))
-          (when more-cands
-            (setq cands (nconc cands more-cands)))))
-      cands)))
+    ;; FIXME: Shouldn't `counsel-compile-local-builds' always be a list?
+    (dolist (cmds (if (listp counsel-compile-local-builds)
+                      counsel-compile-local-builds
+                    (list counsel-compile-local-builds)))
+      (when (functionp cmds)
+        (setq cmds (funcall cmds dir)))
+      (when cmds
+        (push (if (listp cmds) cmds (list cmds)) cands)))
+    (apply #'append (nreverse cands))))
 ;; This is a workaround to ensure we tag all the relevant metadata in
 ;; our compile history.  This also allows M-x compile to do fancy

reply via email to

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