help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: let*: Wrong type argument: stringp, nil


From: Emanuel Berg
Subject: Re: let*: Wrong type argument: stringp, nil
Date: Tue, 28 Sep 2021 05:21:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hongyi Zhao wrote:

> Now I'm trying another test code snippet based on the idea
> posted here [1]:
>
> (defun desperately-pyvenv-workon()
>  "Traveling up the path, find a `.python-version' and activate the
>  corresponding virtualenv."
>  (interactive)
>  (with-temp-buffer
>     (unless (equal(getenv "HOME") default-directory)
>     (while (not (file-exists-p ".python-version"))
>           (cd "..")
>     ))
>     (when(file-exists-p ".python-version")
>       (message(expand-file-name ".python-version")))))
>
> (desperately-pyvenv-workon)
>
> [1] https://emacs.stackexchange.com/a/7477
>
> But when I test the above code in scratch buffer, it seems to be stuck
> in an endless loop and running there all the time.

Eval this

  (cd "..")

enough times and it alternates between "/" and "/../"
indefinitely, maybe that's what happens?

(But I don't know why, or what it tries to say with "/../"
which should be equivalent to "/" ... in the shell, cd from /
does not lead to /../ but will stay in /)

Also, if you are just looking for a file, isn't there better
ways to do that?

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]