From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Hongyi Zhao Newsgroups: gmane.emacs.help Subject: Re: let*: Wrong type argument: stringp, nil Date: Wed, 29 Sep 2021 09:43:13 +0800 Message-ID: References: <87lf3lrmos.fsf@gmx.net> <87ee9csyp0.fsf@gmx.net> <87a6k0sogz.fsf@gmx.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27727"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs , Stephen Berman To: Yuri Khan Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 29 03:44:18 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mVOds-00071d-L5 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 29 Sep 2021 03:44:16 +0200 Original-Received: from localhost ([::1]:60346 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVOdr-0000kb-CQ for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 28 Sep 2021 21:44:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50342) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVOd4-0000hM-Ta for help-gnu-emacs@gnu.org; Tue, 28 Sep 2021 21:43:29 -0400 Original-Received: from mail-ua1-x934.google.com ([2607:f8b0:4864:20::934]:43548) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVOd3-0002Lp-DC for help-gnu-emacs@gnu.org; Tue, 28 Sep 2021 21:43:26 -0400 Original-Received: by mail-ua1-x934.google.com with SMTP id 10so396025uae.10 for ; Tue, 28 Sep 2021 18:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=vW6q0rHWbvqps7KZNyhJd3fD7ZOQ0dvHaTtzVppdsvQ=; b=iEEJGe2MUTeHWHHWsODpf6ESH5glZmGH/ez6AV96V2OtPoTNUa5LrbgJL1uYrUyVja sPf52NPiRHoz82pqO9ME71IIoiwPC4ar6mlSVvfi20vF68zNuqlHTjOqIB8WdGLhoA3g PJvfACa9pBTny50+8FDlx0G8hQiNBYDWeS0SeHp0odUpyQq6pULRSMaFOLDGNsvC6pRg OpYXHawroacMnwYVZFXztwFLnUd0A8x6OJp+M4bfwXjSOESEY6+2RDNIuy8R3eSqz223 E1alpp6ESYkFD+DBALuCGZ3xyqPv2uonLGlT8xutWnbH8Fzb5TDcWnfGSWGfoJ66uKMw psnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=vW6q0rHWbvqps7KZNyhJd3fD7ZOQ0dvHaTtzVppdsvQ=; b=uZrfPqw+Lsv5GYAb/O9VfLbNVnfrU+EvX0GSMEb3TdiYJtVBxTawHL527IxSriMe0o ZYe5bw1YDfUGYJqHHxJBZFLVtaJu6IbyiYaKC5BHRXyu9KcqxszUkxCnmxQFAhREuJv6 T4xoTWEhKF+kcRIvIvte8Al/DmthDso0cthNTPQR8vIMWjPQHerxUpQwhrGThDLxYCJr 1FHPbSXVIMKR9U5RfTxhMxGHChAmjwKoFbQcQquSRBKy6tN1LfkaJxUvd0SS6FDqbxW3 U0Cih2vUCLT1oHZVFsPFHCWuvK25KjlNjU/ToedEGp/TOYdghoCK6TmslTFQPUiSa1h7 PagQ== X-Gm-Message-State: AOAM5308mgnUSti940btlOfySHKwPebcdCy3wlAz7CmU62wQIC6PCct2 K4f6aIy+Q0Pi5bORrXAqXsyKAriiXumYe7DwDeo= X-Google-Smtp-Source: ABdhPJx4/HU7Nh8L51M7wxh2HkFNyN/r1/cudbrAztskPAlozoHrBLD7aoxX6zc81bCKWsurUxGXFCYawX7DiFcgUtI= X-Received: by 2002:a9f:3058:: with SMTP id i24mr7830604uab.71.1632879804340; Tue, 28 Sep 2021 18:43:24 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::934; envelope-from=hongyi.zhao@gmail.com; helo=mail-ua1-x934.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133365 Archived-At: On Tue, Sep 28, 2021 at 4:02 PM Yuri Khan wrote: > > On Tue, 28 Sept 2021 at 10:08, Hongyi Zhao wrote: > > > Now I'm trying another test code snippet based on the idea posted here = [1]: > > > > (while (not (file-exists-p ".python-version")) > > (cd "..") > > )) > > > > 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. Any hints for this > > problem? > > You=E2=80=99re not handling the case here that you reached the root direc= tory > without finding a .python-version file. > > You will really get better results if you use locate-dominating-file. > If you=E2=80=99re trying to learn, learn by reading that function. As a b= onus, > it does not mess with the buffer=E2=80=99s default directory. I work out the following code snippets using locate-dominating-file, and it works as expected: (defun try/pyvenv-workon () (when (locate-dominating-file (buffer-file-name) ".python-version") ;https://emacs.stackexchange.com/questions/9474/let-statement-throws-= error-on-assigning-a-form-to-a-variable (let ((file (concat (locate-dominating-file (buffer-file-name) ".python-version") ".python-version"))) (pyvenv-workon (with-temp-buffer (insert-file-contents file) (nth 0 (split-string (buffer-string)))))))) BTW, should I use `let' or `let*' here? HZ