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

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

[elpa] externals/corfu 12f9fcaa0e: Prefer if-let/when-let


From: ELPA Syncer
Subject: [elpa] externals/corfu 12f9fcaa0e: Prefer if-let/when-let
Date: Sat, 14 Jan 2023 23:57:40 -0500 (EST)

branch: externals/corfu
commit 12f9fcaa0e4de1b7978f2fa50242db3d44b28a52
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Prefer if-let/when-let
---
 extensions/corfu-echo.el      | 14 +++++------
 extensions/corfu-info.el      |  8 +++---
 extensions/corfu-popupinfo.el | 58 +++++++++++++++++++++----------------------
 3 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/extensions/corfu-echo.el b/extensions/corfu-echo.el
index cad3d06020..09244d5afe 100644
--- a/extensions/corfu-echo.el
+++ b/extensions/corfu-echo.el
@@ -82,13 +82,13 @@ floats to specify initial and subsequent delay."
 
 (defun corfu-echo--exhibit (&rest _)
   "Show documentation string of current candidate in echo area."
-  (if-let* ((delay (if (consp corfu-echo-delay)
-                       (funcall (if corfu-echo--message #'cdr #'car)
-                                corfu-echo-delay)
-                     corfu-echo-delay))
-            (fun (plist-get corfu--extra :company-docsig))
-            (cand (and (>= corfu--index 0)
-                       (nth corfu--index corfu--candidates))))
+  (if-let ((delay (if (consp corfu-echo-delay)
+                      (funcall (if corfu-echo--message #'cdr #'car)
+                               corfu-echo-delay)
+                    corfu-echo-delay))
+           (fun (plist-get corfu--extra :company-docsig))
+           (cand (and (>= corfu--index 0)
+                      (nth corfu--index corfu--candidates))))
       (if (or (eq delay t) (<= delay 0))
           (corfu-echo--show (funcall fun cand))
         (corfu-echo--cancel)
diff --git a/extensions/corfu-info.el b/extensions/corfu-info.el
index 39ba335c59..0365d8d91b 100644
--- a/extensions/corfu-info.el
+++ b/extensions/corfu-info.el
@@ -60,8 +60,8 @@
   (when (< corfu--index 0)
     (user-error "No candidate selected"))
   (let ((cand (nth corfu--index corfu--candidates)))
-    (if-let* ((fun (plist-get corfu--extra :company-doc-buffer))
-              (res (funcall fun cand)))
+    (if-let ((fun (plist-get corfu--extra :company-doc-buffer))
+             (res (funcall fun cand)))
         (let ((buf (or (car-safe res) res)))
           (corfu-info--restore-on-next-command)
           (setq other-window-scroll-buffer (get-buffer buf))
@@ -77,8 +77,8 @@
     (user-error "No candidate selected"))
   (let ((cand (nth corfu--index corfu--candidates)))
     ;; BUG: company-location may throw errors if location is not found
-    (if-let* ((fun (ignore-errors (plist-get corfu--extra :company-location)))
-              (loc (funcall fun cand)))
+    (if-let ((fun (ignore-errors (plist-get corfu--extra :company-location)))
+             (loc (funcall fun cand)))
         (let ((buf (or (and (bufferp (car loc)) (car loc))
                        (find-file-noselect (car loc) t))))
           (corfu-info--restore-on-next-command)
diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el
index d81e953f90..4201ad6023 100644
--- a/extensions/corfu-popupinfo.el
+++ b/extensions/corfu-popupinfo.el
@@ -174,20 +174,20 @@ all values are in pixels relative to the origin.  See
   (save-excursion
     (let ((old-buffers (buffer-list)) (buffer nil))
       (unwind-protect
-          (when-let* ((fun (plist-get corfu--extra :company-location))
-                      ;; BUG: company-location may throw errors if location is 
not found
-                      (loc (ignore-errors (funcall fun candidate)))
-                      ((setq buffer
-                             (or (and (bufferp (car loc)) (car loc))
-                                 (get-file-buffer (car loc))
-                                 (let ((inhibit-message t)
-                                       (inhibit-redisplay t)
-                                       (enable-dir-local-variables nil)
-                                       (enable-local-variables :safe)
-                                       (non-essential t)
-                                       (delay-mode-hooks t)
-                                       (find-file-hook 
'(global-font-lock-mode-check-buffers)))
-                                   (find-file-noselect (car loc) t))))))
+          (when-let ((fun (plist-get corfu--extra :company-location))
+                     ;; BUG: company-location may throw errors if location is 
not found
+                     (loc (ignore-errors (funcall fun candidate)))
+                     ((setq buffer
+                            (or (and (bufferp (car loc)) (car loc))
+                                (get-file-buffer (car loc))
+                                (let ((inhibit-message t)
+                                      (inhibit-redisplay t)
+                                      (enable-dir-local-variables nil)
+                                      (enable-local-variables :safe)
+                                      (non-essential t)
+                                      (delay-mode-hooks t)
+                                      (find-file-hook 
'(global-font-lock-mode-check-buffers)))
+                                  (find-file-noselect (car loc) t))))))
             (with-current-buffer buffer
               (save-excursion
                 (save-restriction
@@ -209,16 +209,16 @@ all values are in pixels relative to the origin.  See
 
 (defun corfu-popupinfo--get-documentation (candidate)
   "Get the documentation for CANDIDATE."
-  (when-let* ((fun (plist-get corfu--extra :company-doc-buffer))
-              (res (save-excursion
-                     (let ((inhibit-message t)
-                           (inhibit-redisplay t)
-                           (message-log-max nil)
-                           ;; Reduce print length for elisp backend (#249)
-                           (print-level 3)
-                           (print-length (* corfu-popupinfo-max-width
-                                            corfu-popupinfo-max-height)))
-                       (funcall fun candidate)))))
+  (when-let ((fun (plist-get corfu--extra :company-doc-buffer))
+             (res (save-excursion
+                    (let ((inhibit-message t)
+                          (inhibit-redisplay t)
+                          (message-log-max nil)
+                          ;; Reduce print length for elisp backend (#249)
+                          (print-level 3)
+                          (print-length (* corfu-popupinfo-max-width
+                                           corfu-popupinfo-max-height)))
+                      (funcall fun candidate)))))
     (with-current-buffer (or (car-safe res) res)
       (setq res (string-trim
                  (replace-regexp-in-string
@@ -473,11 +473,11 @@ not be displayed until this command is called again, even 
if
       (setq corfu-popupinfo--timer nil))
     (if (and (>= corfu--index 0) (corfu-popupinfo--visible-p corfu--frame))
         (let ((candidate (nth corfu--index corfu--candidates)))
-          (if-let* ((delay (if (consp corfu-popupinfo-delay)
-                               (funcall (if (eq corfu-popupinfo--toggle 'init) 
#'car #'cdr)
-                                        corfu-popupinfo-delay)
-                             corfu-popupinfo-delay))
-                    (corfu-popupinfo--toggle))
+          (if-let ((delay (if (consp corfu-popupinfo-delay)
+                              (funcall (if (eq corfu-popupinfo--toggle 'init) 
#'car #'cdr)
+                                       corfu-popupinfo-delay)
+                            corfu-popupinfo-delay))
+                   (corfu-popupinfo--toggle))
               (if (or (eq delay t) (<= delay 0)
                       (and (equal candidate corfu-popupinfo--candidate)
                            (corfu-popupinfo--visible-p)))



reply via email to

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