Skip to content

Commit 6f76b46

Browse files
committed
feat: include home folder in search for node_modules
1 parent 91da224 commit 6f76b46

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

add-node-modules-path.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ Any path found is added to the `exec-path'."
4747
(home (expand-file-name "~"))
4848
(root (and path (expand-file-name path)))
4949
(roots '()))
50-
(while (and root (not (string= root home)))
50+
(while root
5151
(let ((bindir (expand-file-name "node_modules/.bin/" root)))
5252
(when (file-directory-p bindir)
5353
(add-to-list 'roots bindir)))
54-
(setq root (directory-file-name (file-name-directory root))))
54+
(if (string= root home)
55+
(setq root nil)
56+
(setq root (directory-file-name (file-name-directory root)))))
5557
(if roots
5658
(progn
5759
(make-local-variable 'exec-path)

0 commit comments

Comments
 (0)