diff --git a/core/autoload/buffers.el b/core/autoload/buffers.el index a052c2dd6..0b6815021 100644 --- a/core/autoload/buffers.el +++ b/core/autoload/buffers.el @@ -53,7 +53,7 @@ Inspired from http://demonastery.org/2013/04/emacs-evil-narrow-region/" If no project is active, return all buffers." (let ((buffers (doom-buffer-list))) - (if-let (project-root (if (doom-project-p) (doom-project-root))) + (if-let* ((project-root (if (doom-project-p) (doom-project-root)))) (cl-loop for buf in buffers if (projectile-project-buffer-p buf project-root) collect buf) @@ -148,7 +148,7 @@ real buffer is: c) is not a special buffer (its name isn't something like *Help*) If BUFFER-OR-NAME is omitted or nil, the current buffer is tested." - (when-let (buf (ignore-errors (window-normalize-buffer buffer-or-name))) + (when-let* ((buf (ignore-errors (window-normalize-buffer buffer-or-name)))) (or (buffer-local-value 'doom-real-buffer-p buf) (run-hook-with-args-until-success 'doom-real-buffer-functions buf) (not (or (doom-popup-p buf) diff --git a/core/autoload/debug.el b/core/autoload/debug.el index a6a7597e3..77b48b4c5 100644 --- a/core/autoload/debug.el +++ b/core/autoload/debug.el @@ -60,14 +60,14 @@ selection of all minor-modes, active or not." (interactive) (unless (string-match-p "\\_" system-configuration-features) (warn "gnutls support isn't built into Emacs, there may be problems")) - (if-let (bad-hosts - (cl-loop for bad - in '("https://wrong.host.badssl.com/" - "https://self-signed.badssl.com/") - if (condition-case _e - (url-retrieve bad (lambda (_retrieved) t)) - (error nil)) - collect bad)) + (if-let* ((bad-hosts + (cl-loop for bad + in '("https://wrong.host.badssl.com/" + "https://self-signed.badssl.com/") + if (condition-case _e + (url-retrieve bad (lambda (_retrieved) t)) + (error nil)) + collect bad))) (error (format "tls seems to be misconfigured (it got %s)." bad-hosts)) (url-retrieve "https://badssl.com" diff --git a/core/autoload/menu.el b/core/autoload/menu.el index cd2e2db23..c0ad798f2 100644 --- a/core/autoload/menu.el +++ b/core/autoload/menu.el @@ -12,7 +12,7 @@ PROMPT (a string) and COMMAND (a list of command plists; see `def-menu!').") (completing-read prompt (mapcar #'car commands))) (defun doom--menu-read (prompt commands) - (if-let (choice (funcall doom-menu-display-fn prompt commands)) + (if-let* ((choice (funcall doom-menu-display-fn prompt commands))) (cdr (assoc choice commands)) (user-error "Aborted"))) diff --git a/core/autoload/packages.el b/core/autoload/packages.el index 00ba8a4a9..7fb7356ad 100644 --- a/core/autoload/packages.el +++ b/core/autoload/packages.el @@ -48,7 +48,7 @@ list, whose car is NAME, and cdr the current version list and latest version list of the package." (cl-assert (symbolp name) t) (doom-initialize-packages) - (when-let (desc (cadr (assq name package-alist))) + (when-let* ((desc (cadr (assq name package-alist)))) (let* ((old-version (package-desc-version desc)) (new-version (pcase (doom-package-backend name) @@ -57,7 +57,7 @@ list of the package." (dir (expand-file-name (symbol-name name) quelpa-build-dir)) (inhibit-message (not doom-debug-mode)) (quelpa-upgrade-p t)) - (if-let (ver (quelpa-checkout recipe dir)) + (if-let* ((ver (quelpa-checkout recipe dir))) (version-to-list ver) old-version))) ('elpa @@ -115,7 +115,7 @@ If INSTALLED-ONLY-P, only return packages that are installed." (defun doom-get-depending-on (name) "Return a list of packages that depend on the package named NAME." (doom-initialize) - (when-let (desc (cadr (assq name package-alist))) + (when-let* ((desc (cadr (assq name package-alist)))) (mapcar #'package-desc-name (package--used-elsewhere-p desc nil t)))) ;;;###autoload @@ -291,7 +291,7 @@ package.el as appropriate." (package-compute-transaction () (list (list archive)))))) (package-download-transaction packages)))) (unless (doom-package-outdated-p name) - (when-let (old-dir (package-desc-dir desc)) + (when-let* ((old-dir (package-desc-dir desc))) (when (file-directory-p old-dir) (delete-directory old-dir t))) t)))) @@ -498,7 +498,7 @@ calls." (user-error "All packages are up to date")))) (list (cdr (assq (car (assoc package package-alist)) packages))))) (cl-destructuring-bind (package old-version new-version) pkg - (if-let (desc (doom-package-outdated-p package)) + (if-let* ((desc (doom-package-outdated-p package))) (let ((old-v-str (package-version-join old-version)) (new-v-str (package-version-join new-version))) (if (y-or-n-p (format "%s will be updated from %s to %s. Update?" diff --git a/core/autoload/popups.el b/core/autoload/popups.el index 841d2ad5d..a182d50c7 100644 --- a/core/autoload/popups.el +++ b/core/autoload/popups.el @@ -4,7 +4,7 @@ (defun doom-popup-p (&optional target) "Return t if TARGET (a window or buffer) is a popup. Uses current window if omitted." - (when-let (target (or target (selected-window))) + (when-let* ((target (or target (selected-window)))) (cond ((bufferp target) (and (buffer-live-p target) (buffer-local-value 'doom-popup-mode target))) @@ -31,7 +31,7 @@ this popup, just the specified properties. Returns the new popup window." (defun doom-popup-switch-to-buffer (buffer) "Switch the current (or closest) pop-up window to BUFFER." (unless (doom-popup-p) - (if-let (popups (doom-popup-windows)) + (if-let* ((popups (doom-popup-windows))) (select-window (car popups)) (error "No popups to switch to"))) (set-window-dedicated-p nil nil) @@ -113,7 +113,7 @@ window parameter." ((or 'above 'below) (window-height window)))) (defun doom--popup-data (window) - (when-let (buffer (window-buffer window)) + (when-let* ((buffer (window-buffer window))) `(,(buffer-name buffer) :file ,(buffer-file-name buffer) :rules ,(window-parameter window 'popup) @@ -167,7 +167,7 @@ Returns t if popups were restored, nil otherwise." (size (plist-get (cdr spec) :size))) (when (and (not buffer) file) (setq buffer - (if-let (buf (get-file-buffer file)) + (if-let* ((buf (get-file-buffer file))) (clone-indirect-buffer (buffer-name buf) nil t) (find-file-noselect file t)))) (when size @@ -212,7 +212,7 @@ If FORCE-P is non-nil (or this function is called interactively), ignore popups' :autoclose property. This command will never close :static popups." (interactive (list (called-interactively-p 'interactive))) - (when-let (popups (doom-popup-windows t)) + (when-let* ((popups (doom-popup-windows t))) (let (success doom-popup-remember-history) (setq doom-popup-history (delq nil (mapcar #'doom--popup-data popups))) (dolist (window popups success) @@ -225,7 +225,7 @@ If FORCE-P is non-nil (or this function is called interactively), ignore popups' "Like `doom/popup-close-all', but kill *all* popups, including :static ones, without leaving any trace behind (muahaha)." (interactive) - (when-let (popups (doom-popup-windows)) + (when-let* ((popups (doom-popup-windows))) (let (doom-popup-remember-history) (setq doom-popup-history nil) (mapc #'delete-window popups)))) @@ -251,7 +251,7 @@ without leaving any trace behind (muahaha)." (defun doom/popup-toggle-messages () "Toggle *Messages* buffer." (interactive) - (if-let (win (get-buffer-window "*Messages*")) + (if-let* ((win (get-buffer-window "*Messages*"))) (doom/popup-close win) (doom-popup-buffer (get-buffer "*Messages*")))) @@ -259,10 +259,10 @@ without leaving any trace behind (muahaha)." (defun doom/other-popup (count) "Cycle through popup windows. Like `other-window', but for popups." (interactive "p") - (if-let (popups (if (doom-popup-p) - (cdr (memq (selected-window) doom-popup-windows)) - (setq doom-popup-other-window (selected-window)) - doom-popup-windows)) + (if-let* ((popups (if (doom-popup-p) + (cdr (memq (selected-window) doom-popup-windows)) + (setq doom-popup-other-window (selected-window)) + doom-popup-windows))) (ignore-errors (select-window (nth (mod (1- count) (length popups)) popups))) (unless (eq (selected-window) doom-popup-other-window) (when doom-popup-other-window @@ -419,6 +419,6 @@ properties." (with-selected-window window (doom-popup-mode -1) (when autokill-p - (when-let (process (get-buffer-process (current-buffer))) + (when-let* ((process (get-buffer-process (current-buffer)))) (set-process-query-on-exit-flag process nil)) (kill-buffer (current-buffer))))))) diff --git a/core/core-keybinds.el b/core/core-keybinds.el index ee3cd6031..0b1310017 100644 --- a/core/core-keybinds.el +++ b/core/core-keybinds.el @@ -269,7 +269,7 @@ Example (dolist (keymap doom--keymaps) (when (memq 'global states) (push `(define-key ,keymap ,key ,def) forms)) - (when-let (states (delq 'global states)) + (when-let* ((states (delq 'global states))) (push `(,(if doom--defer 'evil-define-key 'evil-define-key*) ',states ,keymap ,key ,def) forms)))) diff --git a/core/core-lib.el b/core/core-lib.el index 78ade207d..4bf932203 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -6,6 +6,12 @@ (load "persistent-soft-autoloads" nil t) (dolist (sym '(json-read json-read-file json-read-from-string json-encode)) (autoload sym "json")) +(eval-and-compile + (when (version< emacs-version "26") + (with-no-warnings + (defalias 'if-let* #'if-let) + (defalias 'when-let* #'when-let)))) + ;; ;; Helpers @@ -96,7 +102,7 @@ See http://vimdoc.sourceforge.net/htmldoc/cmdline.html#filename-modifiers." (file-relative-name parent))))) ("s" (if (featurep 'evil) - (when-let (args (evil-delimited-arguments (substring flag 1) 2)) + (when-let* ((args (evil-delimited-arguments (substring flag 1) 2))) (let ((pattern (evil-transform-vim-style-regexp (car args))) (replace (cadr args))) (replace-regexp-in-string diff --git a/core/core-packages.el b/core/core-packages.el index cabca4e04..b4f31fdfa 100644 --- a/core/core-packages.el +++ b/core/core-packages.el @@ -247,9 +247,10 @@ This aggressively reloads core autoload files." (defun doom-module-from-path (path) "Get module cons cell (MODULE . SUBMODULE) for PATH, if possible." - (when (string-match (concat doom-modules-dir "\\([^/]+\\)/\\([^/]+\\)/") path) - (cons (intern (concat ":" (match-string 1 path))) - (intern (match-string 2 path))))) + (when-let* ((path (file-relative-name (file-truename path) (file-truename doom-modules-dir)))) + (let ((segments (split-string path "/"))) + (cons (intern (concat ":" (car segments))) + (intern (cadr segments)))))) (defun doom-module-paths (&optional append-file) "Returns a list of absolute file paths to activated modules, with APPEND-FILE @@ -463,7 +464,7 @@ Accepts the following properties: (when pkg-pin (plist-put plist :pin nil))) (dolist (prop '(:ignore :freeze)) - (when-let (val (plist-get plist prop)) + (when-let* ((val (plist-get plist prop))) (plist-put plist prop (eval val)))) `(progn (when ,(and pkg-pin t) diff --git a/core/core-popups.el b/core/core-popups.el index 6ab219b13..b4b6f58ac 100644 --- a/core/core-popups.el +++ b/core/core-popups.el @@ -414,7 +414,7 @@ that `doom*popup-save' won't break it." (defun doom*persp-mode-restore-popups (&rest _) "Restore popup windows when loading a perspective from file." (dolist (window (window-list)) - (when-let (plist (doom-popup-properties window)) + (when-let* ((plist (doom-popup-properties window))) (with-selected-window window (unless doom-popup-mode (setq-local doom-popup-rules plist) diff --git a/core/core-ui.el b/core/core-ui.el index 9bff3bf94..712f24c6e 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -147,7 +147,7 @@ local value, whether or not it's permanent-local. Therefore, we cycle ;; like diminish, but for major-modes. [pedantry intensifies] (defun doom|set-mode-name () "Set the major mode's `mode-name', as dictated by `doom-major-mode-names'." - (when-let (name (cdr (assq major-mode doom-major-mode-names))) + (when-let* ((name (cdr (assq major-mode doom-major-mode-names)))) (setq mode-name (cond ((functionp name) (funcall name)) ((stringp name) name) @@ -475,7 +475,7 @@ error if it doesn't exist." (defun doom-set-modeline (key &optional default) "Set the modeline format. Does nothing if the modeline KEY doesn't exist. If DEFAULT is non-nil, set the default mode-line for all buffers." - (when-let (modeline (doom-modeline key)) + (when-let* ((modeline (doom-modeline key))) (setf (if default (default-value 'mode-line-format) (buffer-local-value 'mode-line-format (current-buffer))) diff --git a/modules/app/email/config.el b/modules/app/email/config.el index e8213c279..c447d2b0b 100644 --- a/modules/app/email/config.el +++ b/modules/app/email/config.el @@ -31,7 +31,7 @@ DEFAULT-P is a boolean. If non-nil, it marks that email account as the default/fallback account." `(after! mu4e (let ((account-vars ,letvars)) - (when-let (address (cdr (assq 'user-mail-address account-vars))) + (when-let* ((address (cdr (assq 'user-mail-address account-vars)))) (cl-pushnew address mu4e-user-mail-address-list :test #'equal)) (let ((context (make-mu4e-context :name ,label diff --git a/modules/app/irc/config.el b/modules/app/irc/config.el index 506d905aa..35d02432c 100644 --- a/modules/app/irc/config.el +++ b/modules/app/irc/config.el @@ -88,7 +88,7 @@ playback.") (defun +irc*circe-truncate-nicks () "Truncate long nicknames in chat output non-destructively." - (when-let (beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick)) + (when-let* ((beg (text-property-any (point-min) (point-max) 'lui-format-argument 'nick))) (goto-char beg) (let ((end (next-single-property-change beg 'lui-format-argument)) (nick (plist-get (plist-get (text-properties-at beg) 'lui-keywords) diff --git a/modules/app/regex/autoload/regex.el b/modules/app/regex/autoload/regex.el index f9499a5da..7e43db77e 100644 --- a/modules/app/regex/autoload/regex.el +++ b/modules/app/regex/autoload/regex.el @@ -261,7 +261,7 @@ __DATA__ (overlay-put ov 'category '+regex)) (cl-incf i) (dotimes (i 10) - (when-let (text (match-string i)) + (when-let* ((text (match-string i))) (save-match-data (with-current-buffer +regex--groups-buffer (goto-char (point-max)) diff --git a/modules/app/rss/autoload.el b/modules/app/rss/autoload.el index 0de16a866..6f375c7d6 100644 --- a/modules/app/rss/autoload.el +++ b/modules/app/rss/autoload.el @@ -11,7 +11,7 @@ (interactive) (doom-kill-matching-buffers "^\\*elfeed") (dolist (file +rss-elfeed-files) - (when-let (buf (get-file-buffer (expand-file-name file +rss-org-dir))) + (when-let* ((buf (get-file-buffer (expand-file-name file +rss-org-dir)))) (kill-buffer buf)))) ;;;###autoload diff --git a/modules/completion/ivy/autoload/ivy.el b/modules/completion/ivy/autoload/ivy.el index 277d140ff..d14a8faaa 100644 --- a/modules/completion/ivy/autoload/ivy.el +++ b/modules/completion/ivy/autoload/ivy.el @@ -73,9 +73,9 @@ If ARG (universal argument), open selection in other-window." (task-tags (mapcar #'car +ivy-task-tags)) (cmd (format "%s -H -S --no-heading -- %s %s" - (or (when-let (bin (executable-find "rg")) + (or (when-let* ((bin (executable-find "rg"))) (concat bin " --line-number")) - (when-let (bin (executable-find "ag")) + (when-let* ((bin (executable-find "ag"))) (concat bin " --numbers")) (error "ripgrep & the_silver_searcher are unavailable")) (shell-quote-argument diff --git a/modules/feature/eval/autoload/eval.el b/modules/feature/eval/autoload/eval.el index 45e4ebc34..75006b142 100644 --- a/modules/feature/eval/autoload/eval.el +++ b/modules/feature/eval/autoload/eval.el @@ -13,7 +13,7 @@ "Evaluate a region between BEG and END and display the output." (interactive "r") (let ((load-file-name buffer-file-name)) - (if-let (runner (cdr (assq major-mode +eval-runners))) + (if-let* ((runner (cdr (assq major-mode +eval-runners)))) (funcall runner beg end) (quickrun-region beg end)))) diff --git a/modules/feature/eval/autoload/repl.el b/modules/feature/eval/autoload/repl.el index 8b396b172..5655a64f3 100644 --- a/modules/feature/eval/autoload/repl.el +++ b/modules/feature/eval/autoload/repl.el @@ -7,7 +7,7 @@ (or (eq (current-buffer) +eval-repl-buffer) (progn (if (and +eval-repl-buffer (buffer-live-p +eval-repl-buffer)) - (if-let (win (get-buffer-window +eval-repl-buffer)) + (if-let* ((win (get-buffer-window +eval-repl-buffer))) (select-window win) (doom-popup-buffer +eval-repl-buffer)) (when command @@ -29,7 +29,7 @@ "Opens (or reopens) the REPL associated with the current major-mode and place the cursor at the prompt." (interactive) - (when-let (command (cdr (assq major-mode +eval-repls))) + (when-let* ((command (cdr (assq major-mode +eval-repls)))) (when (+eval--ensure-in-repl-buffer command) (when (bound-and-true-p evil-mode) (call-interactively #'evil-append-line)) diff --git a/modules/feature/eval/config.el b/modules/feature/eval/config.el index 3f8176757..ba954353c 100644 --- a/modules/feature/eval/config.el +++ b/modules/feature/eval/config.el @@ -74,7 +74,7 @@ function that creates and returns the REPL buffer." (defun +eval*quickrun-auto-close (&rest _) "Allows us to silently re-run quickrun from within the quickrun buffer." - (when-let (win (get-buffer-window quickrun--buffer-name)) + (when-let* ((win (get-buffer-window quickrun--buffer-name))) (let ((inhibit-message t)) (quickrun--kill-running-process) (message "")) diff --git a/modules/feature/evil/autoload/files.el b/modules/feature/evil/autoload/files.el index 00f890900..c247f6f46 100644 --- a/modules/feature/evil/autoload/files.el +++ b/modules/feature/evil/autoload/files.el @@ -77,7 +77,7 @@ overwrite the destination file if it exists, without confirmation." (pcase (catch 'status (let ((old-path (buffer-file-name)) (new-path (expand-file-name new-path))) - (when-let (dest (+evil--copy-file old-path new-path force-p)) + (when-let* ((dest (+evil--copy-file old-path new-path force-p))) (delete-file old-path) (kill-this-buffer) (find-file new-path) @@ -95,7 +95,7 @@ overwrite the destination file if it exists, without confirmation." :repeat nil (interactive "") (pcase (catch 'status - (when-let (dest (+evil--copy-file (buffer-file-name) new-path force-p)) + (when-let* ((dest (+evil--copy-file (buffer-file-name) new-path force-p))) (message "File successfully copied to %s" dest))) ('overwrite-self (error "Cannot overwrite self")) ('aborted (message "Aborted")) diff --git a/modules/feature/evil/config.el b/modules/feature/evil/config.el index b958149ab..4d24b856e 100644 --- a/modules/feature/evil/config.el +++ b/modules/feature/evil/config.el @@ -180,11 +180,11 @@ across windows." (evil-embrace-enable-evil-surround-integration) (defun +evil--embrace-get-pair (char) - (if-let (pair (cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist))) + (if-let* ((pair (cdr-safe (assoc (string-to-char char) evil-surround-pairs-alist)))) pair - (if-let (pair (assoc-default char embrace--pairs-list)) - (if-let (real-pair (and (functionp (embrace-pair-struct-read-function pair)) - (funcall (embrace-pair-struct-read-function pair)))) + (if-let* ((pair (assoc-default char embrace--pairs-list))) + (if-let* ((real-pair (and (functionp (embrace-pair-struct-read-function pair)) + (funcall (embrace-pair-struct-read-function pair))))) real-pair (cons (embrace-pair-struct-left pair) (embrace-pair-struct-right pair))) (cons char char)))) diff --git a/modules/feature/jump/config.el b/modules/feature/jump/config.el index e763d4718..db7a65069 100644 --- a/modules/feature/jump/config.el +++ b/modules/feature/jump/config.el @@ -70,8 +70,8 @@ properties: (defun +jump|init () "Initialize `+jump-current-functions', used by `+jump/definition', `+jump/references' and `+jump/documentation'." - (when-let (plist (cdr (assq major-mode +jump-function-alist))) - (when-let (backend (plist-get plist :xref-backend)) + (when-let* ((plist (cdr (assq major-mode +jump-function-alist)))) + (when-let* ((backend (plist-get plist :xref-backend))) (make-variable-buffer-local 'xref-backend-functions) (cl-pushnew backend xref-backend-functions :test #'eq)) (setq-local +jump-current-functions plist))) diff --git a/modules/feature/snippets/autoload/evil.el b/modules/feature/snippets/autoload/evil.el index c8d5cfc7f..e0ef054b2 100644 --- a/modules/feature/snippets/autoload/evil.el +++ b/modules/feature/snippets/autoload/evil.el @@ -11,7 +11,7 @@ and switches to insert mode if there are editable fields." (cl-letf (((symbol-function 'region-beginning) (lambda () evil-visual-beginning)) ((symbol-function 'region-end) (lambda () evil-visual-end))) (yas-insert-snippet)) - (when-let (snippet (car-safe (yas-active-snippets))) + (when-let* ((snippet (car-safe (yas-active-snippets)))) (let ((fields (yas--snippet-fields snippet))) (evil-insert-state +1) (unless fields (evil-change-state 'normal))))) diff --git a/modules/feature/version-control/autoload.el b/modules/feature/version-control/autoload.el index 9f710f67b..6df86c3d0 100644 --- a/modules/feature/version-control/autoload.el +++ b/modules/feature/version-control/autoload.el @@ -27,7 +27,7 @@ repository root." (defun +vcs/git-browse-issues () "Open the github issues page for current repo." (interactive) - (if-let (root (+vcs-root)) + (if-let* ((root (+vcs-root))) (browse-url (concat root "/issues")) (user-error "No git root found!"))) diff --git a/modules/feature/workspaces/autoload/workspaces.el b/modules/feature/workspaces/autoload/workspaces.el index 11cff9413..8566cd860 100644 --- a/modules/feature/workspaces/autoload/workspaces.el +++ b/modules/feature/workspaces/autoload/workspaces.el @@ -53,7 +53,7 @@ ;;;###autoload (defun +workspace-get (name &optional noerror) "Returns a workspace (perspective hash table) named NAME." - (when-let (persp (persp-get-by-name name)) + (when-let* ((persp (persp-get-by-name name))) (cond ((+workspace-p persp) persp) ((not noerror) (error "'%s' is an invalid workspace" name))))) diff --git a/modules/lang/cc/config.el b/modules/lang/cc/config.el index dcfb950d6..9563ef452 100644 --- a/modules/lang/cc/config.el +++ b/modules/lang/cc/config.el @@ -35,9 +35,9 @@ compilation database is present in the project.") (or (file-exists-p (expand-file-name (concat (file-name-sans-extension buffer-file-name) ".cpp"))) - (when-let (file (car-safe (projectile-get-other-files - buffer-file-name - (projectile-current-project-files)))) + (when-let* ((file (car-safe (projectile-get-other-files + buffer-file-name + (projectile-current-project-files))))) (equal (file-name-extension file) "cpp"))))) (defun +cc-objc-header-file-p () diff --git a/modules/lang/javascript/autoload.el b/modules/lang/javascript/autoload.el index 2a8ead5a6..3df1ecd03 100644 --- a/modules/lang/javascript/autoload.el +++ b/modules/lang/javascript/autoload.el @@ -10,14 +10,14 @@ ignore the cache." (or (and (not refresh-p) (gethash project-root +javascript-npm-conf)) (let ((package-file (expand-file-name "package.json" project-root))) - (when-let (json (and (file-exists-p package-file) - (json-read-file package-file))) + (when-let* ((json (and (file-exists-p package-file) + (json-read-file package-file)))) (puthash project-root json +javascript-npm-conf)))))) ;;;###autoload (defun +javascript-npm-dep-p (packages &optional project-root refresh-p) - (when-let (data (and (bound-and-true-p +javascript-npm-mode) - (+javascript-npm-conf project-root refresh-p))) + (when-let* ((data (and (bound-and-true-p +javascript-npm-mode) + (+javascript-npm-conf project-root refresh-p)))) (let ((deps (append (cdr (assq 'dependencies data)) (cdr (assq 'devDependencies data))))) (cond ((listp packages) diff --git a/modules/lang/javascript/config.el b/modules/lang/javascript/config.el index 4301063dc..90dedba89 100644 --- a/modules/lang/javascript/config.el +++ b/modules/lang/javascript/config.el @@ -27,8 +27,8 @@ (defun +javascript|init-flycheck-eslint () "Favor local eslint over global installs and configure flycheck for eslint." (when (derived-mode-p 'js-mode) - (when-let ((exec-path (list (doom-project-expand "node_modules/.bin"))) - (eslint (executable-find "eslint"))) + (when-let* (((exec-path (list (doom-project-expand "node_modules/.bin"))) + (eslint (executable-find "eslint")))) (setq-local flycheck-javascript-eslint-executable eslint)) (when (flycheck-find-checker-executable 'javascript-eslint) ;; Flycheck has it's own trailing command and semicolon warning that was diff --git a/modules/lang/org/autoload/org-attach.el b/modules/lang/org/autoload/org-attach.el index cfd68878a..0cd9a7380 100644 --- a/modules/lang/org/autoload/org-attach.el +++ b/modules/lang/org/autoload/org-attach.el @@ -35,8 +35,8 @@ ;; (goto-char (point-min)) ;; (while (progn (org-next-link) (not org-link-search-failed)) ;; (setq element (org-element-context)) -;; (when-let (file (and (eq (org-element-type element) 'link) -;; (expand-file-name (org-element-property :path element)))) +;; (when-let* (file (and (eq (org-element-type element) 'link) +;; (expand-file-name (org-element-property :path element)))) ;; (when (and (string= (org-element-property :type element) "file") ;; (string= (concat (file-name-base (directory-file-name (file-name-directory file))) "/") ;; org-attach-directory) diff --git a/modules/lang/org/autoload/org-capture.el b/modules/lang/org/autoload/org-capture.el index ca741b3d4..bd7dce4d4 100644 --- a/modules/lang/org/autoload/org-capture.el +++ b/modules/lang/org/autoload/org-capture.el @@ -18,12 +18,12 @@ Uses the capture template specified by KEY. Otherwise, prompts you for one." (interactive) (let ((key (or key "n"))) - (if-let (string (cond ((not (equal string "")) - string) - ((region-active-p) - (buffer-substring-no-properties - (region-beginning) - (region-end))))) + (if-let* ((string (cond ((not (equal string "")) + string) + ((region-active-p) + (buffer-substring-no-properties + (region-beginning) + (region-end)))))) (org-capture-string string key) (org-capture nil key)))) diff --git a/modules/lang/org/config.el b/modules/lang/org/config.el index 95227a749..88463f71c 100644 --- a/modules/lang/org/config.el +++ b/modules/lang/org/config.el @@ -4,7 +4,7 @@ "The directory where org files are kept.") ;; Ensure ELPA org is prioritized above built-in org. -(when-let (path (locate-library "org" nil doom--package-load-path)) +(when-let* ((path (locate-library "org" nil doom--package-load-path))) (setq load-path (delete path load-path)) (push (file-name-directory path) load-path)) diff --git a/modules/lang/php/autoload.el b/modules/lang/php/autoload.el index c9e272e4a..fc2fd8ca9 100644 --- a/modules/lang/php/autoload.el +++ b/modules/lang/php/autoload.el @@ -9,6 +9,6 @@ ignore the cache." (let ((project-root (or project-root (doom-project-root)))) (or (and (not refresh-p) (gethash project-root +php-composer-conf)) (let ((package-file (expand-file-name "composer.json" project-root))) - (when-let (data (and (file-exists-p package-file) - (json-read-file package-file))) + (when-let* ((data (and (file-exists-p package-file) + (json-read-file package-file)))) (puthash project-root data +php-composer-conf)))))) diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 445a5e587..1b2ff7983 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -55,7 +55,7 @@ is loaded.") (defun +python|detect-pyenv-version () "Detect the pyenv version for the current project and set the relevant environment variables." - (when-let (version-str (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2")) + (when-let* ((version-str (shell-command-to-string "python --version 2>&1 | cut -d' ' -f2"))) (setq version-str (string-trim version-str) +python-current-version version-str) (let ((pyenv-current-path (concat +python-pyenv-root "/versions/" version-str))) diff --git a/modules/lang/ruby/config.el b/modules/lang/ruby/config.el index 9d2d83a26..38de8171e 100644 --- a/modules/lang/ruby/config.el +++ b/modules/lang/ruby/config.el @@ -43,7 +43,7 @@ (defun +ruby|detect-rbenv-version () "Detect the rbenv version for the current project and set the relevant environment variables." - (when-let (version-str (shell-command-to-string "ruby --version 2>&1 | cut -d' ' -f2")) + (when-let* ((version-str (shell-command-to-string "ruby --version 2>&1 | cut -d' ' -f2"))) (setq version-str (string-trim version-str) +ruby-current-version version-str) (when (member version-str +ruby-rbenv-versions) diff --git a/modules/private/hlissner/autoload/hlissner.el b/modules/private/hlissner/autoload/hlissner.el index 2ff00d069..236676fc2 100644 --- a/modules/private/hlissner/autoload/hlissner.el +++ b/modules/private/hlissner/autoload/hlissner.el @@ -12,7 +12,7 @@ private/hlissner/snippets." (defun +hlissner/yank-buffer-filename () "Copy the current buffer's path to the kill ring." (interactive) - (if-let (filename (or buffer-file-name (bound-and-true-p list-buffers-directory))) + (if-let* ((filename (or buffer-file-name (bound-and-true-p list-buffers-directory)))) (message (kill-new (abbreviate-file-name filename))) (error "Couldn't find filename in current buffer"))) diff --git a/modules/tools/eshell/autoload/eshell.el b/modules/tools/eshell/autoload/eshell.el index 7029f74ba..84a8e54b8 100644 --- a/modules/tools/eshell/autoload/eshell.el +++ b/modules/tools/eshell/autoload/eshell.el @@ -41,8 +41,8 @@ module to be loaded." (user-error ":feature workspaces is required, but disabled")) (unless (+workspace-get "eshell" t) (+workspace/new "eshell")) - (if-let (buf (cl-find-if (lambda (it) (string-match-p "^\\*doom:eshell" (buffer-name (window-buffer it)))) - (doom-visible-windows))) + (if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*doom:eshell" (buffer-name (window-buffer it)))) + (doom-visible-windows)))) (select-window (get-buffer-window buf)) (+eshell/open)) (doom/workspace-display) diff --git a/modules/tools/gist/autoload/gist.el b/modules/tools/gist/autoload/gist.el index c9e192985..1202b003a 100644 --- a/modules/tools/gist/autoload/gist.el +++ b/modules/tools/gist/autoload/gist.el @@ -4,7 +4,7 @@ (defun +gist/open-current () (interactive) (gist-fetch-current) - (when-let (win (get-buffer-window "*github:gists*")) + (when-let* ((win (get-buffer-window "*github:gists*"))) (doom/popup-close win))) ;;;###autoload diff --git a/modules/tools/neotree/autoload.el b/modules/tools/neotree/autoload.el index cfc12e91c..3a3c87ee9 100644 --- a/modules/tools/neotree/autoload.el +++ b/modules/tools/neotree/autoload.el @@ -21,7 +21,7 @@ (defun +neotree/collapse-or-up () "Collapse an expanded directory node or go to the parent node." (interactive) - (when-let (node (neo-buffer--get-filename-current-line)) + (when-let* ((node (neo-buffer--get-filename-current-line))) (if (file-directory-p node) (if (neo-buffer--expanded-node-p node) (+neotree/collapse) @@ -32,7 +32,7 @@ (defun +neotree/collapse () "Collapse a neotree node." (interactive) - (when-let (node (neo-buffer--get-filename-current-line)) + (when-let* ((node (neo-buffer--get-filename-current-line))) (when (file-directory-p node) (neo-buffer--set-expand node nil) (neo-buffer--refresh t)) @@ -43,7 +43,7 @@ (defun +neotree/expand-or-open () "Expand or open a neotree node." (interactive) - (when-let (node (neo-buffer--get-filename-current-line)) + (when-let* ((node (neo-buffer--get-filename-current-line))) (cond ((file-directory-p node) (neo-buffer--set-expand node t) (neo-buffer--refresh t) diff --git a/modules/tools/password-store/autoload.el b/modules/tools/password-store/autoload.el index 9317b2310..7f2f3279b 100644 --- a/modules/tools/password-store/autoload.el +++ b/modules/tools/password-store/autoload.el @@ -13,7 +13,7 @@ ;;;###autoload (defun +pass-get-field (entry fields) (unless noninteractive - (if-let (data (if (listp entry) entry (auth-pass-parse-entry entry))) + (if-let* ((data (if (listp entry) entry (auth-pass-parse-entry entry)))) (cl-loop for key in (doom-enlist fields) when (assoc key data) return (cdr it)) @@ -28,7 +28,7 @@ (+pass-get-field entry 'secret)) (defun +pass-ivy-action--open-url (entry) - (if-let (url (+pass-get-field entry +pass-url-fields)) + (if-let* ((url (+pass-get-field entry +pass-url-fields))) (and (or (string-match-p "https?://" url) (error "Field for %s doesn't look like an url" item)) (browse-url url)) @@ -48,7 +48,7 @@ (error "Couldn't find entry: %s" item)))) (defun +pass-ivy-action--copy-username (entry) - (if-let (user (+pass-get-field entry +pass-user-fields)) + (if-let* ((user (+pass-get-field entry +pass-user-fields))) (progn (password-store-clear) (message "Copied username to the kill ring.") (kill-new user)) diff --git a/modules/tools/tmux/autoload/tmux.el b/modules/tools/tmux/autoload/tmux.el index 3560dd91b..2cab93d2e 100644 --- a/modules/tools/tmux/autoload/tmux.el +++ b/modules/tools/tmux/autoload/tmux.el @@ -108,11 +108,11 @@ but do not execute them." ;;;###autoload (defun +tmux-list-windows (&optional session) - (if-let (lines - (+tmux (format "list-windows %s -F '#{window_id};#{session_id};#{window_active};#{window_name};#{window_activity_flag}'" - (if session - (concat "-t " (car session)) - "-a")))) + (if-let* ((lines + (+tmux (format "list-windows %s -F '#{window_id};#{session_id};#{window_active};#{window_name};#{window_activity_flag}'" + (if session + (concat "-t " (car session)) + "-a"))))) (cl-loop for line in (string-split lines "\n" t) collect (let ((window (string-split line ";"))) (list (nth 0 window) @@ -124,13 +124,13 @@ but do not execute them." ;;;###autoload (defun +tmux-list-panes (&optional sess-or-win) - (if-let (lines - (+tmux (format "list-panes %s -F '#{pane_id};#{window_id};#{session_id};#{pane_active};#{pane_title};#{pane_current_path}'" - (if sess-or-win - (concat (if (string-prefix-p "$" (car sess-or-win)) "-s ") - "-t " - (car sess-or-win)) - "-a")))) + (if-let* ((lines + (+tmux (format "list-panes %s -F '#{pane_id};#{window_id};#{session_id};#{pane_active};#{pane_title};#{pane_current_path}'" + (if sess-or-win + (concat (if (string-prefix-p "$" (car sess-or-win)) "-s ") + "-t " + (car sess-or-win)) + "-a"))))) (cl-loop for line in (string-split lines "\n" t) collect (let ((pane (split-string line ";"))) (list (nth 0 pane) diff --git a/modules/ui/doom-modeline/config.el b/modules/ui/doom-modeline/config.el index cae428758..5e21e6bf8 100644 --- a/modules/ui/doom-modeline/config.el +++ b/modules/ui/doom-modeline/config.el @@ -50,7 +50,7 @@ (defvar +doom-modeline-current-window (frame-selected-window)) (defun +doom-modeline|set-selected-window (&rest _) "Sets `+doom-modeline-current-window' appropriately" - (when-let (win (frame-selected-window)) + (when-let* ((win (frame-selected-window))) (unless (minibuffer-window-active-p win) (setq +doom-modeline-current-window win))))