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

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

[nongnu] elpa/corfu-popup 3b649cce35 07/26: Patch out display-graphic-p


From: ELPA Syncer
Subject: [nongnu] elpa/corfu-popup 3b649cce35 07/26: Patch out display-graphic-p call at compile time
Date: Sun, 22 May 2022 12:58:15 -0400 (EDT)

branch: elpa/corfu-popup
commit 3b649cce355f604602c0469814df937be49fdbf3
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>

    Patch out display-graphic-p call at compile time
---
 corfu-popup.el | 49 ++++++++++++++++++++++++-------------------------
 1 file changed, 24 insertions(+), 25 deletions(-)

diff --git a/corfu-popup.el b/corfu-popup.el
index 047c032913..bf89f3f212 100644
--- a/corfu-popup.el
+++ b/corfu-popup.el
@@ -140,31 +140,30 @@ Show a vertical scroll bar of size BAR + 1 from LOth 
line."
            popon-pos))
     nil))
 
-(eval-and-compile
-  (defun corfu-popup--patch-out-display-graphic-p (fn name)
-    "Patch out `display-graphic-p' in FN and define NAME to that \
-definition."
-    (let* ((vc-follow-symlinks t)
-           (definition (let ((position (find-function-noselect fn)))
-                         (with-current-buffer (car position)
-                           (save-excursion
-                             (goto-char (cdr position))
-                             (read (current-buffer)))))))
-      (setf (nth 1 definition) name)
-      (cl-labels ((patch-out
-                   (form)
-                   (cond
-                    ((equal form '(display-graphic-p))
-                     t)
-                    ((proper-list-p form)
-                     (mapcar #'patch-out form))
-                    (t
-                     form))))
-        (eval (patch-out definition)))))
-  (corfu-popup--patch-out-display-graphic-p
-   'corfu--auto-post-command 'corfu-popup--auto-post-command)
-  (corfu-popup--patch-out-display-graphic-p
-   'corfu--in-region 'corfu-popup--in-region))
+(defmacro corfu-popup--patch-out-display-graphic-p (fn name)
+  "Patch out `display-graphic-p' in FN and define NAME to that definition."
+  (let* ((vc-follow-symlinks t)
+         (definition (let ((position (find-function-noselect fn)))
+                       (with-current-buffer (car position)
+                         (save-excursion
+                           (goto-char (cdr position))
+                           (read (current-buffer)))))))
+    (setf (nth 1 definition) name)
+    (cl-labels ((patch-out
+                 (form)
+                 (cond
+                  ((equal form '(display-graphic-p))
+                   t)
+                  ((proper-list-p form)
+                   (mapcar #'patch-out form))
+                  (t
+                   form))))
+      (patch-out definition))))
+
+(corfu-popup--patch-out-display-graphic-p
+ corfu--auto-post-command corfu-popup--auto-post-command)
+(corfu-popup--patch-out-display-graphic-p
+ corfu--in-region corfu-popup--in-region)
 
 (define-minor-mode corfu-popup-mode
   "Corfu popup on terminal."



reply via email to

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