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: Hongyi Zhao
Subject: Re: let*: Wrong type argument: stringp, nil
Date: Wed, 29 Sep 2021 18:29:47 +0800

On Wed, Sep 29, 2021 at 5:14 PM Yuri Khan <yuri.v.khan@gmail.com> wrote:
>
> On Wed, 29 Sept 2021 at 13:29, Emanuel Berg via Users list for the GNU
> Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> > >       (let ((file (concat (locate-dominating-file (buffer-file-name)
> > > ".python-version") ".python-version")))
>
> > concat -> format
>
> Why use either, when you have a perfectly good expand-file-name?

Good advice, so change to the following:

  (defun try/pyvenv-workon ()
    (when (buffer-file-name)
      (let* ((python-version ".python-version")
             (project-dir (locate-dominating-file (buffer-file-name)
python-version)))
        (when project-dir
          (pyvenv-workon
            (with-temp-buffer
              (insert-file-contents (expand-file-name python-version))
              (car (split-string (buffer-string)))))))))

HZ



reply via email to

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