refactor: (if|when)-let -> (if|when)-let*

With the former macros' future in the air (and likely to be targeted in
future, potentially breaking changes), I'll deal with this now than have
it bite me later.

Ref: https://lists.gnu.org/archive/html/emacs-devel/2024-10/msg00637.html
This commit is contained in:
Henrik Lissner
2024-12-07 14:35:54 -05:00
parent e3bc367ba2
commit 0a715cc3f2
43 changed files with 207 additions and 205 deletions

View File

@@ -43,7 +43,7 @@ Note that this will keep all ligatures in `+ligatures-prog-mode-list' active, as
(push (cons (pop plist) char) results))))
(dolist (mode (ensure-list modes))
(setf (alist-get mode +ligatures-extra-alist)
(if-let (old-results (alist-get mode +ligatures-extra-alist))
(if-let* ((old-results (alist-get mode +ligatures-extra-alist)))
(dolist (cell results old-results)
(setf (alist-get (car cell) old-results) (cdr cell)))
results))))))

View File

@@ -111,7 +111,7 @@ isn't disabled in `+ligatures-extras-in-modes'."
(when-let*
(((+ligatures--enable-p +ligatures-extras-in-modes))
(symbols
(if-let ((symbols (assq major-mode +ligatures-extra-alist)))
(if-let* ((symbols (assq major-mode +ligatures-extra-alist)))
(cdr symbols)
(cl-loop for (mode . symbols) in +ligatures-extra-alist
if (derived-mode-p mode)

View File

@@ -129,7 +129,7 @@ Using optionals attributes FACE, HELP-ECHO and VOFFSET."
"Set the modeline to NAME.
If DEFAULT is non-nil, apply to all future buffers. Modelines are defined with
`def-modeline!'."
(if-let (format (assq name +modeline-format-alist))
(if-let* ((format (assq name +modeline-format-alist)))
(cl-destructuring-bind (lhs . rhs) (cdr format)
(if default
(setq-default +modeline-format-left lhs

View File

@@ -47,7 +47,7 @@ the buffer is visible, then set another timer and try again later."
(let ((buffer (window-buffer window))
(inhibit-quit t))
(and (or (buffer-file-name buffer)
(if-let (base-buffer (buffer-base-buffer buffer))
(if-let* ((base-buffer (buffer-base-buffer buffer)))
(buffer-file-name base-buffer)))
(buffer-modified-p buffer)
(let ((autosave (+popup-parameter 'autosave window)))
@@ -58,7 +58,7 @@ the buffer is visible, then set another timer and try again later."
(funcall autosave buffer))))
(with-current-buffer buffer (save-buffer)))
(let ((ignore-window-parameters t))
(if-let (wconf (window-parameter window 'saved-wconf))
(if-let* ((wconf (window-parameter window 'saved-wconf)))
(set-window-configuration wconf)
(delete-window window)))
(unless (window-live-p window)
@@ -351,13 +351,13 @@ Any non-nil value besides the above will be used as the raw value for
(defun +popup/other ()
"Cycle through popup windows, like `other-window'. Ignores regular windows."
(interactive)
(if-let (popups (cl-remove-if-not
(lambda (w) (or (+popup-window-p w)
;; This command should be able to hop between
;; windows with a `no-other-window'
;; parameter, since `other-window' won't.
(window-parameter w 'no-other-window)))
(window-list)))
(if-let* ((popups (cl-remove-if-not
(lambda (w) (or (+popup-window-p w)
;; This command should be able to hop between
;; windows with a `no-other-window'
;; parameter, since `other-window' won't.
(window-parameter w 'no-other-window)))
(window-list))))
(select-window (if (or (+popup-window-p)
(window-parameter nil 'no-other-window))
(let ((window (selected-window)))
@@ -450,12 +450,12 @@ window and return that window."
(defun +popup/diagnose ()
"Reveal what popup rule will be used for the current buffer."
(interactive)
(if-let (rule (cl-loop with bname = (buffer-name)
for (pred . action) in display-buffer-alist
if (and (functionp pred) (funcall pred bname action))
return (cons pred action)
else if (and (stringp pred) (string-match-p pred bname))
return (cons pred action)))
(if-let* ((rule (cl-loop with bname = (buffer-name)
for (pred . action) in display-buffer-alist
if (and (functionp pred) (funcall pred bname action))
return (cons pred action)
else if (and (stringp pred) (string-match-p pred bname))
return (cons pred action))))
(message "Rule matches: %s" rule)
(message "No popup rule for this buffer")))