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 14:15:47 +0800 Message-ID: References: <87lf3lrmos.fsf@gmx.net> <87ee9csyp0.fsf@gmx.net> <87a6k0sogz.fsf@gmx.net> <87lf3gqbi7.fsf@zoho.eu> 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="26950"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 29 08:17:19 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 1mVSu6-0006nz-Pg for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 29 Sep 2021 08:17:18 +0200 Original-Received: from localhost ([::1]:59518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mVSu5-0001EQ-MQ for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 29 Sep 2021 02:17:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60834) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mVSss-0001D7-0L for help-gnu-emacs@gnu.org; Wed, 29 Sep 2021 02:16:02 -0400 Original-Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]:41536) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mVSsq-0002pm-F0 for help-gnu-emacs@gnu.org; Wed, 29 Sep 2021 02:16:01 -0400 Original-Received: by mail-vs1-xe2f.google.com with SMTP id az15so1655390vsb.8 for ; Tue, 28 Sep 2021 23:15:59 -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 :content-transfer-encoding; bh=5h0Aw61FAHaMERcC8xc2P+RtPjUPAfCB2C/xK3lIm4o=; b=kD+bpIghPKg4MA9zot5uMaHHsSCIjhTPAO5MvuITydqGhA+cq7IQW7iKSiOX0Qce8j YfaTeLzqorj5IhWmCAIvhrMUmAu/+1LF7CFcMOZhoYTlOMNM+3p8dtPcknqueHlvqCHY OiQfTOBpVHm3YBHv7WNJDfUTBkZrcWcwl/no1ld8rOBNxiD5pjMA8u2kz7cTiYxj7oIM OOnT4b/f6TDfhMAFLXBJ3qOpaFEKJoIuhJ/Xm21H9RJtLb2cH5jTS4MlOXGtvzRdzIZr bBQvcA5xQJLOQ6IcG8v452WSWl73AMhkZ/Q96wy3diGz4E4HXmEF6PCO0fXecpiXVTtK PPyQ== 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:content-transfer-encoding; bh=5h0Aw61FAHaMERcC8xc2P+RtPjUPAfCB2C/xK3lIm4o=; b=4p82hQhrjfSbznyyNZCkX44W2y7GV6JXqq42/iWjNUHOns2CtH5sp4+o9vqTk8B6wn uVC8fg9gXuI3AZrm7eLlGLpu9vWBiXFRRpHhM893+VGmuDq3906Jm2RajDnIhHEHDeNX nI1YVs3JbQE/wTscR94v5a71+0GllrX77+Fz31nV3zQx2ktvtAIo/nqfbQX+nVJQSlMy BJx3UzXXJfivVUb4rH611dXA7j3ww748AhKUHanTa274atGUk2r0llD2qiS1Mlmk/qyy xsXrjph3WEWyD0t0BrQw1W6bGs2wT35lNJi6Q9k23AjJL44FAazkB/6w49PyW+9/usF6 fQxw== X-Gm-Message-State: AOAM530CFk6rFWBGEmJRw/LFbrknGD+G7WwopTkScA06/23qWSm1omoZ 3+vCEjQFQ467ys/7O4NLZmNGAT4xeDdEtM7tpg8= X-Google-Smtp-Source: ABdhPJw/hEJhuWRhJltaFr2Xo4aQIXD46RcjeE8l2E8C1Fb23WAy+hCWiJJL3vtbSeOsWBfDEi1rPEEV+2kWQQXzM08= X-Received: by 2002:a67:5f86:: with SMTP id t128mr9318476vsb.10.1632896159068; Tue, 28 Sep 2021 23:15:59 -0700 (PDT) In-Reply-To: <87lf3gqbi7.fsf@zoho.eu> Received-SPF: pass client-ip=2607:f8b0:4864:20::e2f; envelope-from=hongyi.zhao@gmail.com; helo=mail-vs1-xe2f.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:133375 Archived-At: On Wed, Sep 29, 2021 at 11:58 AM Emanuel Berg via Users list for the GNU Emacs text editor wrote: > > Hongyi Zhao wrote: > > > (defun try/pyvenv-workon () > > (when (and (buffer-file-name) > > (locate-dominating-file (buffer-file-name) ".python-vers= ion")) > > (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)))))))) > > Use `let' so you don't have to hard-code the same data three > times. The code I=E2=80=99ve modified looks like this: (defun try/pyvenv-workon () (when (buffer-file-name) (let ((file (concat (locate-dominating-file (buffer-file-name) ".python-version") ".python-version"))) (when (file-exists-p file) (pyvenv-workon (with-temp-buffer (insert-file-contents file) (nth 0 (split-string (buffer-string))))))))) Any further improvement tips? HZ