From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Manuel Uberti Newsgroups: gmane.emacs.devel Subject: Recent pcase changes Date: Thu, 4 Mar 2021 11:06:08 +0100 Message-ID: <7c26cf68-90d6-a36c-59d9-0d737d1ff143@inventati.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20058"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 04 11:09:32 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 1lHkvE-00056N-CB for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 11:09:32 +0100 Original-Received: from localhost ([::1]:50524 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHkvD-0000sq-71 for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 05:09:31 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47086) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHksB-0000EJ-W3 for emacs-devel@gnu.org; Thu, 04 Mar 2021 05:06:24 -0500 Original-Received: from confino.investici.org ([212.103.72.250]:33399) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHks8-0005HK-S7 for emacs-devel@gnu.org; Thu, 04 Mar 2021 05:06:23 -0500 Original-Received: from mx1.investici.org (unknown [127.0.0.1]) by confino.investici.org (Postfix) with ESMTP id 4DrmjF0gkRz12jv for ; Thu, 4 Mar 2021 10:06:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inventati.org; s=stigmate; t=1614852369; bh=zYc20lx9eqk9hMSFYraBOXAHYMHbjbvc3xSr0gK+JFM=; h=From:Subject:To:Date:From; b=OXWtb4ciRC1x1SBxoL5SQHEtcqF7QoAxM9IIa+zaov+OAtQ08DMsN9jSJRNlff6ex YmVAQMAD+6qXa9DAfjE8EcprPb34QTkm+yC6Ce1zAorljiK1oILzS5kEOu3EcpQijr DPGyPH86qr4JU9Pe8+lg50hkCas6S8UKxgTZHtnE= Original-Received: from [212.103.72.250] (mx1.investici.org [212.103.72.250]) (Authenticated sender: manuel.uberti@inventati.org) by localhost (Postfix) with ESMTPSA id 4DrmjD73cMz12hR for ; Thu, 4 Mar 2021 10:06:08 +0000 (UTC) Autocrypt: addr=manuel.uberti@inventati.org; prefer-encrypt=mutual; keydata= mQENBFTh+8QBCADM+TpOAlO6NIM+GCSLZd4hZQCU2WV7Z1cLYLnE2NHdEaKGnaVlkcf9dGeL 6nlX7j20AYL7KqF4h9IX5d4lc1w8Izk0V2ijtqNeqbRdiTZ8mF+cFEwbALjHIs/YNUjr8IMK pJ+5rQ4DN6dsLVuJ7NJCB54AtAqqvoTodEPxLCT2Gq6YyGaobiEGeczk/3SPsQZYQnKfJ2zM JxIQDy4Dg9owrPpX/WWOfmcTkDoWovX9nsojErYXhIXP7r6+V3cV9stQeOwMhfmnZ1k7LO7y tyvYNIZGfh+JrYBakGttYGSj/C47hJV9MBiY08/Wr3QeDVtV7UTB5qXVYMrYQk63UssNABEB AAG0QU1hbnVlbCBVYmVydGkgKEF1dGlzdGljaS9JbnZlbnRhdGkpIDxtYW51ZWwudWJlcnRp QGludmVudGF0aS5vcmc+iQE6BBMBCgAkAhsDBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheABQJZ pBuqAhkBAAoJEE5XpsTKpI9iEBoIAJLAIZfNVT2KoO9iMM92kuCih6BA1lvpDWreoqRvwW8A iEnS6pwvpiuXldhZgcB4drpy97XBudBFx/b96Sqb4RvGxIHKpt4oLlpXzcohL28oP1CJiN+O bHEbRhzF8fuTrNh7v76z88WRkplUT/7nrO7YLVOM2DS/2QYccOrPkW4C5F03JyVkzSNisz5R VcmUTWcdnqo8VBd/DP3P96ayRj3VPKa9IdQIAxbjbhP+kEQbq9XDiZpGpcOHhFjWeLAWlFCm nES1C7Wb Content-Language: en-GB Received-SPF: pass client-ip=212.103.72.250; envelope-from=manuel.uberti@inventati.org; helo=confino.investici.org 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-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:265936 Archived-At: Hello, yesterday I reported a bug on the clojure-mode bug tracker[1] because with a recent Emacs built from master[2] marking the whole buffer and calling `indent-region' results in an error. 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)) (let ((pos -1)) (condition-case nil (while (and (<= (point) indent-point) (not (eobp))) (clojure-forward-logical-sexp 1) (cl-incf pos)) ;; If indent-point is _after_ the last sexp in the ;; current sexp, we detect that by catching the ;; `scan-error'. In that case, we should return the ;; indentation as if there were an extra sexp at point. (scan-error (cl-incf pos))) (cond ;; The first non-special arg. Rigidly reduce indentation. ((= pos (1+ method)) (+ lisp-body-indent containing-form-column)) ;; Further non-special args, align with the arg above. ((> pos (1+ method)) (clojure--normal-indent last-sexp 'always-align)) ;; Special arg. Rigidly indent with a large indentation. (t (+ (* clojure-special-arg-indent-factor lisp-body-indent) containing-form-column))))) (`:defn (+ lisp-body-indent containing-form-column)) ((pred functionp) (funcall method indent-point state)) ;; No indent spec, do the default. (`nil (let ((function (thing-at-point 'symbol))) (cond ;; Preserve useful alignment of :require (and friends) in `ns' forms. ((and function (string-match "^:" function)) (clojure--normal-indent last-sexp 'always-align)) ;; This should be identical to the :defn above. ((and function (string-match "\\`\\(?:\\S +/\\)?\\(def[a-z]*\\|with-\\)" function) (not (string-match "\\`default" (match-string 1 function)))) (+ lisp-body-indent containing-form-column)) ;; Finally, nothing special here, just respect the user's ;; preference. (t (clojure--normal-indent last-sexp clojure-indent-style)))))) Is there something wrong with this usage of `pcase'? If so, how can it be adapted to the latest changes on master to work again? Note that to have clojure-mode working again for now I have reset my Emacs build to a previous commit[3]. Note also that this is me wild guessing that the problem is related to the recent `pcase' changes. It could very well be that the problem is elsewhere, and if so, I'll try debugging more. All the best [1] https://github.com/clojure-emacs/clojure-mode/issues/584 [2] Commit: ba33089d50a4f74b88cd7fc9d862d183d096c27d Fix a doc/misc clean rule [3] Commit: 6bf56a3614ccd23a31e34ae997b2a6bb0d158489 Fix documentation of a recent change -- Manuel Uberti www.manueluberti.eu