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

@@ -20,7 +20,7 @@ at point."
;; type is `clj' for clojure and `cljs' for clojurescript
;; ... with no type specified, assume `clj'.
(let ((type (or type 'clj)))
(if-let (buffer (cider-current-repl type))
(if-let* ((buffer (cider-current-repl type)))
(pop-to-buffer buffer)
(let ((process (cond ((eq type 'clj) (cider-jack-in-clj arg))
((eq type 'cljs) (cider-jack-in-cljs arg)))))

View File

@@ -91,7 +91,7 @@ Intended to replace `lisp-outline-level'."
;;;###autoload
(defun +emacs-lisp-lookup-definition (_thing)
"Lookup definition of THING."
(if-let (module (+emacs-lisp--module-at-point))
(if-let* ((module (+emacs-lisp--module-at-point)))
(doom/help-modules (car module) (cadr module) 'visit-dir)
(call-interactively #'elisp-def)))

View File

@@ -7,8 +7,8 @@
(interactive)
(let ((config (json-read-file (graphql-locate-config "."))))
(let-alist config
(if-let ((endpoints .extensions.endpoints)
(endpoint (cdr (assq (intern (graphql--completing-read-endpoint endpoints)) endpoints))))
(if-let* ((endpoints .extensions.endpoints)
(endpoint (cdr (assq (intern (graphql--completing-read-endpoint endpoints)) endpoints))))
(let-alist endpoint
(graphql-doc--start .url `(:url ,.url :headers ,.headers)))
(error "No endpoint configurations in .graphqlconfig")))))

View File

@@ -5,9 +5,9 @@
"Opens a Haskell REPL."
(interactive "P")
(require 'haskell-interactive-mode)
(if-let (window
(display-buffer
(haskell-session-interactive-buffer (haskell-session))))
(if-let* ((window
(display-buffer
(haskell-session-interactive-buffer (haskell-session)))))
(window-buffer window)
(error "Failed to display Haskell REPL")))

View File

@@ -47,6 +47,6 @@ Returns nil if 'love' executable can't be found."
(defun +lua/run-love-game ()
"Run the current project with Love2D."
(interactive)
(if-let (cmd (+lua-love-build-command))
(if-let* ((cmd (+lua-love-build-command)))
(async-shell-command cmd)
(user-error "Couldn't find love project")))

View File

@@ -19,7 +19,7 @@
"TODO"
(interactive)
(require 'org-attach)
(if-let (dir (org-attach-dir))
(if-let* ((dir (org-attach-dir)))
(pop-to-buffer
;; Rather than opening dired *and* image-dired windows, suppress them
;; both and open only the image-dired window.

View File

@@ -341,7 +341,7 @@ exist, and `org-link' otherwise."
"Interpret LINK as an URL to an image file."
(when (and (image-type-from-file-name link)
(not (eq org-display-remote-inline-images 'skip)))
(if-let (buf (url-retrieve-synchronously (concat protocol ":" link)))
(if-let* ((buf (url-retrieve-synchronously (concat protocol ":" link))))
(with-current-buffer buf
(goto-char (point-min))
(re-search-forward "\r?\n\r?\n" nil t)

View File

@@ -133,7 +133,7 @@ EXAMPLES:
;; Tangling doesn't expand #+INCLUDE directives, so we do it
;; ourselves, since includes are so useful for literate configs!
(org-export-expand-include-keyword)
(if-let ((results (reverse (org-babel-tangle nil nil lang))))
(if-let* ((results (reverse (org-babel-tangle nil nil lang))))
(dolist (file results)
(if (not quiet?)
(print-group!

View File

@@ -794,7 +794,7 @@ these buffers they'll see a gimped, half-broken org buffer, so to avoid that,
install a hook to restart `org-mode' when they're switched to so they can grow
up to be fully-fledged org-mode buffers."
:around #'org-get-agenda-file-buffer
(if-let (buf (org-find-base-buffer-visiting file))
(if-let* ((buf (org-find-base-buffer-visiting file)))
buf
(let ((recentf-exclude '(always))
(doom-inhibit-large-file-detection t)
@@ -1124,7 +1124,7 @@ between the two."
(defadvice! +org-eldoc--display-link-at-point-a (&rest _)
"Display help for doom-*: links in minibuffer when cursor/mouse is over it."
:before-until #'org-eldoc-documentation-function
(if-let ((url (thing-at-point 'url t)))
(if-let* ((url (thing-at-point 'url t)))
(format "LINK: %s" url)
(and (eq (get-text-property (point) 'help-echo)
#'+org-link-doom--help-echo-from-textprop)