mirror of
https://github.com/doomemacs/doomemacs.git
synced 2026-03-15 11:10:29 -07:00
refactor: s/when-let/when-let*/
The former is deprecated on Emacs 31 for the latter.
This commit is contained in:
parent
0b1de48daa
commit
4fe1cbeddb
70 changed files with 210 additions and 210 deletions
|
|
@ -12,9 +12,9 @@ for the package.json file, and defaults to the current buffer's project root."
|
|||
(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)
|
||||
(require 'json)
|
||||
(json-read-file package-file)))
|
||||
(when-let* ((json (and (file-exists-p package-file)
|
||||
(require 'json)
|
||||
(json-read-file package-file))))
|
||||
(puthash project-root json +javascript-npm-conf))))))
|
||||
|
||||
;;;###autoload
|
||||
|
|
@ -23,8 +23,8 @@ for the package.json file, and defaults to the current buffer's project root."
|
|||
|
||||
This value is cached unless REFRESH-P is non-nil. If PROJECT-ROOT is omitted,
|
||||
the current buffer's project root is used."
|
||||
(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)
|
||||
|
|
@ -40,9 +40,9 @@ the current buffer's project root is used."
|
|||
;;;###autoload
|
||||
(defun +javascript-add-npm-path-h ()
|
||||
"Add node_modules/.bin to `exec-path'."
|
||||
(when-let ((search-directory (or (doom-project-root) default-directory))
|
||||
(node-modules-parent (locate-dominating-file search-directory "node_modules/"))
|
||||
(node-modules-dir (expand-file-name "node_modules/.bin/" node-modules-parent)))
|
||||
(when-let* ((search-directory (or (doom-project-root) default-directory))
|
||||
(node-modules-parent (locate-dominating-file search-directory "node_modules/"))
|
||||
(node-modules-dir (expand-file-name "node_modules/.bin/" node-modules-parent)))
|
||||
(make-local-variable 'exec-path)
|
||||
(add-to-list 'exec-path node-modules-dir)
|
||||
(doom-log ":lang:javascript: add %s to $PATH" (expand-file-name "node_modules/" node-modules-parent))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue