nicferrier/emacs-fakir — pull request #3 by leoc (2014-04-17 17:45:21+00:00)
Title: Fix single directory in namespace

As suggested here the second issue and a pull request to the directory thingy.

```
(fakir-fake-file
(list
(fakir-file
:filename "blah"
:directory "/home/fakir-test"
:content "blah!")
(fakir-file
:filename "blah2"
:directory "/home/fakir-test"
:content "blah2!")
(fakir-file
:filename "blah3"
:directory "/home/fakir-test"
:content "NO WAY!")
(fakir-file
:filename "blah3"
:directory "/tmp"
:content "totally testing!"))
(let ((real-home-dir
(file-name-as-directory (getenv "HOME"))))
(kvhash->alist fakir-file-namespace)))

=>

(("/tmp/blah3" . [cl-struct-fakir-file "blah3" "/tmp" "totally testing!" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home/fakir-test/blah3" . [cl-struct-fakir-file "blah3" "/home/fakir-test" "NO WAY!" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home/fakir-test/blah2" . [cl-struct-fakir-file "blah2" "/home/fakir-test" "blah2!" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home/fakir-test/" . [cl-struct-fakir-file "blah" "/home/fakir-test" "blah!" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home/fakir-test/blah" . [cl-struct-fakir-file "blah" "/home/fakir-test" "blah!" "Mon, Feb 27 2012 22:10:19 GMT"]))
```

The question I posed was, why there is only one "/home/fakir-test/" directory.
The reason of my confusion was at this line:
https://github.com/nicferrier/emacs-fakir/blob/master/fakir.el#L475

I rewrote it a little to recursively add faked files for the parent directories without `:content`.

The result now looks like this:

```
(("/tmp" . [cl-struct-fakir-file "tmp" "/" "" "Mon, Feb 27 2012 22:10:19 GMT"])
("/tmp/blah3" . [cl-struct-fakir-file "blah3" "/tmp" "totally testing!" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home/fakir-test/blah3" . [cl-struct-fakir-file "blah3" "/home/fakir-test" "NO WAY!" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home/fakir-test/blah2" . [cl-struct-fakir-file "blah2" "/home/fakir-test" "blah2!" "Mon, Feb 27 2012 22:10:19 GMT"])
("/" . [cl-struct-fakir-file "" "/" "" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home" . [cl-struct-fakir-file "home" "/" "" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home/fakir-test" . [cl-struct-fakir-file "fakir-test" "/home/" "" "Mon, Feb 27 2012 22:10:19 GMT"])
("/home/fakir-test/blah" . [cl-struct-fakir-file "blah" "/home/fakir-test" "blah!" "Mon, Feb 27 2012 22:10:19 GMT"]))
```

I am not quite sure about the root directory yet.

Next step would be to add a `:directory-p` flag. :+1: