From 06b18f2b6039184e52c18f7d308e10b87199ceeb Mon Sep 17 00:00:00 2001
From: Yuanle Song <sylecn@gmail.com>
Date: Sat, 31 Aug 2019 19:10:35 +0800
Subject: [PATCH] bugfix: fix missing deps for zero-framework.el

`case' is from cl;
missing `take', `drop' added as local functions.
---
 zero-framework.el | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/zero-framework.el b/zero-framework.el
index 7ffc748..fb571b3 100644
--- a/zero-framework.el
+++ b/zero-framework.el
@@ -6,6 +6,7 @@
 ;; dependencies
 ;;==============
 
+(require 'cl)
 (require 's)
 (require 'zero-panel)
 
@@ -204,8 +205,23 @@ if t, `zero-debug' will output debug msg in *zero-debug* buffer")
 
 (defun zero-candidates-on-page (candidates)
   "return candidates on current page for given candidates list"
-  (take zero-candidates-per-page
-	(drop (* zero-candidates-per-page zero-current-page) candidates)))
+  (flet ((take (n lst)
+          "take the first n element from lst. if there is not enough
+elements, return lst as it is."
+          (loop
+	   for lst* = lst then (cdr lst*)
+	   for n* = n then (1- n*)
+	   until (or (zerop n*) (null lst*))
+	   collect (car lst*)))
+	 (drop (n lst)
+          "drop the first n elements from lst"
+          (loop
+	   for lst* = lst then (cdr lst*)
+	   for n* = n then (1- n*)
+	   until (or (zerop n*) (null lst*))
+	   finally (return lst*))))
+    (take zero-candidates-per-page
+	  (drop (* zero-candidates-per-page zero-current-page) candidates))))
 
 (defun zero-show-candidates (&optional candidates)
   "show candidates using zero-panel via IPC/RPC"
-- 
GitLab