let binding with projectile-project-root binds to nil

120 views Asked by At

I think I'm missing something but why, in the following function, root value is nil?

(defun test-root ()
  (let (root (projectile-project-root))
    (message "root: %s\nprojectile: %S" root (projectile-project-root)

This is the result of my evaluation:

root: nil
projectile: "/home/lhooq/test_let/
1

There are 1 answers

0
Lhooq On

Because I forgot parentheses...

The correct function is:

(defun test-root ()
  (let ((root (projectile-project-root)))
    (message "root: %s\nprojectile: %S" root (projectile-project-root)