branch: externals/ivy-posframe
commit 187288c873f8838b170cc962da8f655af26acb2e
Author: conao3 <[email protected]>
Commit: conao3 <[email protected]>

    accept declare form
---
 ivy-posframe.el | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/ivy-posframe.el b/ivy-posframe.el
index 9627cd4..8e75bbe 100644
--- a/ivy-posframe.el
+++ b/ivy-posframe.el
@@ -478,11 +478,18 @@ The return value is undefined.
 
 \(fn NAME ARGLIST &optional DOCSTRING DECL &rest BODY)"
   (declare (doc-string 3) (indent 2))
-  `(defun ,name ,arglist
-     ,(when (stringp docstring) docstring)
-     (when (display-graphic-p)
-       ,(unless (stringp docstring) docstring)
-       ,@body)))
+  (let ((decls (cond
+                ((eq (car-safe docstring) 'declare)
+                 (prog1 (cdr docstring) (setq docstring nil)))
+                ((and (stringp docstring)
+                      (eq (car-safe (car body)) 'declare))
+                 (prog1 (cdr (car body)) (setq body (cdr body)))))))
+    `(defun ,name ,arglist
+       ,(when (stringp docstring) docstring)
+       (declare ,@decls)
+       (when (display-graphic-p)
+         ,(unless (stringp docstring) docstring)
+         ,@body))))
 
 (ivy-posframe--defun-advice ivy-posframe--minibuffer-setup (fn &rest args)
   "Advice function of FN, `ivy--minibuffer-setup' with ARGS."

Reply via email to