From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Recent pcase changes Date: Thu, 04 Mar 2021 09:39:41 -0500 Message-ID: References: <7c26cf68-90d6-a36c-59d9-0d737d1ff143@inventati.org> <586BC11A-0E1F-48ED-B69D-0ED2E809A0DE@acm.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24406"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Manuel Uberti , emacs-devel To: Mattias =?windows-1252?Q?Engdeg=E5rd?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 04 15:40:37 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lHp9Z-0006EE-7f for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 15:40:37 +0100 Original-Received: from localhost ([::1]:49684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHp9Y-0005di-8C for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 09:40:36 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHp8m-0005Bo-Rq for emacs-devel@gnu.org; Thu, 04 Mar 2021 09:39:48 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:49094) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHp8k-0003pw-LZ for emacs-devel@gnu.org; Thu, 04 Mar 2021 09:39:48 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id C676780C41; Thu, 4 Mar 2021 09:39:44 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id F1B8780229; Thu, 4 Mar 2021 09:39:42 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1614868782; bh=aPLftkN4a/ETf10TKpdgygEuF5p4JD0WX7IIeaSxuCg=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=PoxRLxF3+Lmw60hJrt2yJNOllPdq2fqvjY9sn9W3/FYz5oi1GmEE/9nMOCP0/Q29i wfJQVNkYIyluGtPT77USwWBGAjePMM4DwKmi1a13ssDUrKjgsRDbQuGW/gLiGYUaA1 t8GSPgiNQ0WIGJNS47XFDgGWcR6JZuFxMTtlmQYIU9jPb5hNE7v2u6hpOZYxySELsW B6ZZgw2ynj9T30F+kjweXjWyzVg7ATGwZ6M3T1dLx0ykGYC93cbXUauiIlY1SsifIZ FS2GuPTvh12DTbuu9RnJh1yfAmieZLkCUDLGob0aL6jpv1veBpgxfUb+qMPUoBAvdq lmR+KNms6Dgng== Original-Received: from alfajor (unknown [216.154.43.249]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C06DE1202A0; Thu, 4 Mar 2021 09:39:42 -0500 (EST) In-Reply-To: <586BC11A-0E1F-48ED-B69D-0ED2E809A0DE@acm.org> ("Mattias =?windows-1252?Q?Engdeg=E5rd=22's?= message of "Thu, 4 Mar 2021 12:30:58 +0100") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265957 Archived-At: >> By looking at clojure-mode code I see it sets `lisp-indent-function' to >> `clojure-indent-function', which makes use of `pcase'. More specifically, this >> is what it does at line 1497 of clojure-mode.el: >> >> (pcase method >> ((or (pred integerp) `(,method)) No good deed goes unpunished, eh? > Now all variables in an `or`-pattern are always bound, to nil if nothing else. Try: > > ((or (pred integerp) `(m)) ^^^^^ `(,m) > (let ((method (if (integerp method) method m))) With the new semantics you could also use (pcase method ((or (pred integerp) `(,m)) (let ((method (or m method))) ... And to get something to work reliably with both the old and the new semantics, you can go with: (pcase method ((or (and (pred integerp) method) `(,method)) ... -- Stefan