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

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

[elpa] externals/corfu 41e35c23a3: Uniform use of when-let/if-let


From: ELPA Syncer
Subject: [elpa] externals/corfu 41e35c23a3: Uniform use of when-let/if-let
Date: Sun, 12 Nov 2023 03:57:35 -0500 (EST)

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

    Uniform use of when-let/if-let
---
 corfu.el                      | 24 ++++++++++++------------
 extensions/corfu-info.el      |  2 +-
 extensions/corfu-popupinfo.el |  4 ++--
 3 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/corfu.el b/corfu.el
index 42bfa994c8..aa1aa3cfea 100644
--- a/corfu.el
+++ b/corfu.el
@@ -422,8 +422,8 @@ length override, set to t for manual completion."
 (defun corfu--make-frame (frame x y width height buffer)
   "Show BUFFER in child frame at X/Y with WIDTH/HEIGHT.
 FRAME is the existing frame."
-  (when-let (timer (and (frame-live-p frame)
-                        (frame-parameter frame 'corfu--hide-timer)))
+  (when-let (((frame-live-p frame))
+             (timer (frame-parameter frame 'corfu--hide-timer)))
     (cancel-timer timer)
     (set-frame-parameter frame 'corfu--hide-timer nil))
   (let* ((window-min-height 1)
@@ -516,7 +516,7 @@ FRAME is the existing frame."
 
 (defun corfu--move-to-front (elem list)
   "Move ELEM to front of LIST."
-  (if-let (found (member elem list))
+  (if-let ((found (member elem list)))
       (nconc (list (car found)) (delq (setcar found nil) list))
     list))
 
@@ -607,7 +607,7 @@ FRAME is the existing frame."
                (field (substring str (car bounds) (+ pt (cdr bounds))))
                (completing-file (eq (corfu--metadata-get 'category) 'file))
                (`(,all . ,hl) (corfu--filter-completions str table pred pt 
corfu--metadata))
-               (base (or (when-let (z (last all)) (prog1 (cdr z) (setcdr z 
nil))) 0))
+               (base (or (when-let ((z (last all))) (prog1 (cdr z) (setcdr z 
nil))) 0))
                (corfu--base (substring str 0 base)))
     ;; Filter the ignored file extensions. We cannot use modified predicate for
     ;; this filtering, since this breaks the special casing in the
@@ -742,9 +742,9 @@ FRAME is the existing frame."
 
 (defun corfu--preview-current (beg end)
   "Show current candidate as overlay given BEG and END."
-  (when-let (cand (and corfu-preview-current (>= corfu--index 0)
-                       (/= corfu--index corfu--preselect)
-                       (nth corfu--index corfu--candidates)))
+  (when-let ((cand (and corfu-preview-current (>= corfu--index 0)
+                        (/= corfu--index corfu--preselect)
+                        (nth corfu--index corfu--candidates))))
     (setq beg (+ beg (length corfu--base))
           corfu--preview-ov (make-overlay beg end nil))
     (overlay-put corfu--preview-ov 'priority 1000)
@@ -927,7 +927,7 @@ See `completion-in-region' for the arguments BEG, END, 
TABLE, PRED."
       (`(,fun ,beg ,end ,table . ,plist)
        (let ((completion-in-region-mode-predicate
               (lambda ()
-                (when-let (newbeg (car-safe (funcall fun)))
+                (when-let ((newbeg (car-safe (funcall fun))))
                   (= newbeg beg))))
              (completion-extra-properties plist))
          (setq completion-in-region--data
@@ -1038,11 +1038,11 @@ A scroll bar is displayed from LO to LO+BAR."
 (cl-defgeneric corfu--affixate (cands)
   "Annotate CANDS with annotation function."
   (setq cands
-        (if-let (aff (or (corfu--metadata-get 'affixation-function)
-                         (plist-get corfu--extra :affixation-function)))
+        (if-let ((aff (or (corfu--metadata-get 'affixation-function)
+                          (plist-get corfu--extra :affixation-function))))
             (funcall aff cands)
-          (if-let (ann (or (corfu--metadata-get 'annotation-function)
-                           (plist-get corfu--extra :annotation-function)))
+          (if-let ((ann (or (corfu--metadata-get 'annotation-function)
+                            (plist-get corfu--extra :annotation-function))))
               (cl-loop for cand in cands collect
                        (let ((suffix (or (funcall ann cand) "")))
                          ;; The default completion UI adds the
diff --git a/extensions/corfu-info.el b/extensions/corfu-info.el
index 7dbbab263a..e23563cfc1 100644
--- a/extensions/corfu-info.el
+++ b/extensions/corfu-info.el
@@ -101,7 +101,7 @@ If called with a prefix ARG, the buffer is persistent."
              (and arg (format "*corfu loc: %s*" cand)))
           (without-restriction
             (goto-char (point-min))
-            (when-let (pos (cdr loc))
+            (when-let ((pos (cdr loc)))
               (if (bufferp (car loc))
                   (goto-char pos)
                 (forward-line (1- pos))))
diff --git a/extensions/corfu-popupinfo.el b/extensions/corfu-popupinfo.el
index e23f092897..f5c2d02c14 100644
--- a/extensions/corfu-popupinfo.el
+++ b/extensions/corfu-popupinfo.el
@@ -197,7 +197,7 @@ all values are in pixels relative to the origin.  See
               (save-excursion
                 (without-restriction
                   (goto-char (point-min))
-                  (when-let (pos (cdr loc))
+                  (when-let ((pos (cdr loc)))
                     (if (bufferp (car loc))
                         (goto-char pos)
                       (forward-line (1- pos))))
@@ -346,7 +346,7 @@ form (X Y WIDTH HEIGHT DIR)."
            (new-coords (frame-edges corfu--frame 'inner-edges))
            (coords-changed (not (equal new-coords 
corfu-popupinfo--coordinates))))
       (when cand-changed
-        (if-let (content (funcall corfu-popupinfo--function candidate))
+        (if-let ((content (funcall corfu-popupinfo--function candidate)))
             (with-current-buffer (corfu--make-buffer " *corfu-popupinfo*")
               (with-silent-modifications
                 (erase-buffer)



reply via email to

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