From unknown Mon Jun 16 23:33:22 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#30891 <30891@debbugs.gnu.org> To: bug#30891 <30891@debbugs.gnu.org> Subject: Status: 26.0.91; indent of malformed lisp Reply-To: bug#30891 <30891@debbugs.gnu.org> Date: Tue, 17 Jun 2025 06:33:22 +0000 retitle 30891 26.0.91; indent of malformed lisp reassign 30891 emacs submitter 30891 Noam Postavsky severity 30891 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 20 21:19:52 2018 Received: (at submit) by debbugs.gnu.org; 21 Mar 2018 01:19:52 +0000 Received: from localhost ([127.0.0.1]:44455 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eySPw-00038Z-7J for submit@debbugs.gnu.org; Tue, 20 Mar 2018 21:19:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54423) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eySPu-00038J-5J for submit@debbugs.gnu.org; Tue, 20 Mar 2018 21:19:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eySPn-0002Yd-W1 for submit@debbugs.gnu.org; Tue, 20 Mar 2018 21:19:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38034) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eySPn-0002YV-RY for submit@debbugs.gnu.org; Tue, 20 Mar 2018 21:19:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eySPm-0006pd-Na for bug-gnu-emacs@gnu.org; Tue, 20 Mar 2018 21:19:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eySPj-0002X4-CP for bug-gnu-emacs@gnu.org; Tue, 20 Mar 2018 21:19:42 -0400 Received: from mail-it0-x230.google.com ([2607:f8b0:4001:c0b::230]:39526) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eySPj-0002Wp-2J for bug-gnu-emacs@gnu.org; Tue, 20 Mar 2018 21:19:39 -0400 Received: by mail-it0-x230.google.com with SMTP id e98-v6so4770543itd.4 for ; Tue, 20 Mar 2018 18:19:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=+6GDrI4/uyTwEpZXDVhqI6AY9zcByCCxbIGWZE+0AaM=; b=DlNfvR4MCSE1gzSP2QnADVd0d/SlOF/XOdEpVgwLSrvZVpWQ9uCMcO0bFkDwn94LuN BSKNlBFOvSykd1tmc1DV6xx3a1ZUwAppWh0ygyrFtcIm2TcZvxSajg3KVs9kOBM0ykFA bi/VZJD4+aG+/E6/PIifeaeukkq1HHdZMKboXME8dQVtWtr436Jqto0P+KPOm8bsRyRK v3zJG6r7usOoviX4SuoCkCrupplqV08gqCSD0ncySG9hz27IOQ4w+xah6/dVznzyZSo0 7ZYu0lmUinSFMPfa3b0BbpUBAMxsD/beLosoLzyozrLa5MttnJYOats0cfq2uRsxomsY qk3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=+6GDrI4/uyTwEpZXDVhqI6AY9zcByCCxbIGWZE+0AaM=; b=CFi/36fLWyJV9NyHBDHKYT/U7RwNQc9XYOcGLIfO9CLaLijaDmyhPiNdWLCvk/w1+s cgegUqrVxdW2QhyLm7fF+hOXKoLpA8urHrUJjkj+mfgfMbjOjScl6nWhIlMrgQjYhBU2 R8PkXQtb7ve1dJJP3cmFyFjUtgwrWmXhcloZKl123beSOAMbiKq4H/UL+POWdEjOH4+Z b4SIyE7m7bMx5p5voSgK8YiNwnq8/CQ9bKch9L9otS83cYFm8G+PwpLk33uOpX23EtN4 0/RXjuQwfL4FQvLEd+blHlvvegbG2hi3cYySmIqr7piA6RIsWob9gmPMrN+cCg8yIwHk yrcA== X-Gm-Message-State: AElRT7FDqgfQGTdWCRdeMYX7/sX0jeBmXruzB6WyX96wdNUpoBDCqCxG ehWuPwOiN/XLK2t3WHmd8u4aEQ== X-Google-Smtp-Source: AG47ELtJYLFJVFQsTtkMt4StYUiodm2Dk+eoHuNLhnvLWGlYa1xSLlQKtqHENLjzksVgCeXNwX70+g== X-Received: by 2002:a24:5e83:: with SMTP id h125-v6mr2039676itb.79.1521595178173; Tue, 20 Mar 2018 18:19:38 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id q99sm1930953ioi.40.2018.03.20.18.19.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Mar 2018 18:19:36 -0700 (PDT) From: Noam Postavsky To: bug-gnu-emacs@gnu.org Subject: 26.0.91; indent of malformed lisp Date: Tue, 20 Mar 2018 21:19:35 -0400 Message-ID: <87y3imrzrs.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --=-=-= Content-Type: text/plain I recently got a private report about a problem with the new lisp indent functions: they don't work well when the buffer contains syntax errors. For example, indent-region in a buffer containing: ) (+ 2 3) gives Debugger entered--Lisp error: (wrong-type-argument consp nil) lisp-indent-calc-next(#s(lisp-indent-state :stack (nil) :ppss (0 nil nil nil nil nil 0 nil nil nil nil) :ppss-point 146)) lisp-indent-region(146 158) indent-region(146 158 nil) funcall-interactively(indent-region 146 158 nil) call-interactively(indent-region nil nil) command-execute(indent-region) The error can be fixed with the patch below, I think it's safe for emacs-26. But, it still gives wrong indentation if you do indent-region on the latter two lines. That could be fixed with (advice-add 'lisp-ppss :override #'lisp-ppss-open-paren-in-column-0-is-defun-start) The lisp-ppss-open-paren-in-column-0-is-defun-start function is included (but uncalled) in the patch. Using it in the override suggested above will bring back Bug#27920 though. We could include the function and suggest to use it (with the aforementioned caveat) in etc/NEWS or PROBLEMS perhaps? --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Handle-indentation-of-malformed-Lisp.patch Content-Description: patch >From da0916b591a983c9b4ee9c8201600a77ba506b92 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 17 Mar 2018 21:14:11 -0400 Subject: [PATCH v1] Handle indentation of malformed Lisp * lisp/emacs-lisp/lisp-mode.el (lisp-ppss-open-paren-in-column-0-is-defun-start): New function. * lisp/emacs-lisp/lisp-mode.el (lisp-indent-calc-next): If we run out of indent stack, reset the parse state. --- lisp/emacs-lisp/lisp-mode.el | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index f082983d48..58710e9876 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -794,6 +794,21 @@ lisp-ppss (parse-partial-sexp sexp-start pos nil nil (syntax-ppss sexp-start))) pss))) +(defun lisp-ppss-open-paren-in-column-0-is-defun-start (&optional pos) + (save-excursion + (if pos + (goto-char pos) + (setq pos (point))) + (or (looking-at-p "^(") + (re-search-backward "^(" nil t) + (goto-char (point-min))) + (let ((ppss (parse-partial-sexp (point) pos))) + (if (< (car ppss) 0) + ;; Too many close parens, probably syntax error. Give a + ;; fresh state. + (parse-partial-sexp (point) (point)) + ppss)))) + (cl-defstruct (lisp-indent-state (:constructor nil) (:constructor lisp-indent-initial-state @@ -844,6 +859,10 @@ lisp-indent-calc-next (prog1 (let (indent) (cond ((= (forward-line 1) 1) nil) + ;; Negative depth, probably some kind of syntax error. + ((null indent-stack) + ;; Reset state. + (setq ppss (parse-partial-sexp (point) (point)))) ((car indent-stack)) ((integerp (setq indent (calculate-lisp-indent ppss))) (setf (car indent-stack) indent)) -- 2.11.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 21 02:50:38 2018 Received: (at 30891) by debbugs.gnu.org; 21 Mar 2018 06:50:39 +0000 Received: from localhost ([127.0.0.1]:44770 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eyXa2-0002gD-MD for submit@debbugs.gnu.org; Wed, 21 Mar 2018 02:50:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eyXa0-0002g0-Nx for 30891@debbugs.gnu.org; Wed, 21 Mar 2018 02:50:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyXZr-0004Ia-Ai for 30891@debbugs.gnu.org; Wed, 21 Mar 2018 02:50:31 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyXZr-0004IT-6i; Wed, 21 Mar 2018 02:50:27 -0400 Received: from [176.228.60.248] (port=1627 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eyXZq-0002em-Kl; Wed, 21 Mar 2018 02:50:27 -0400 Date: Wed, 21 Mar 2018 08:50:41 +0200 Message-Id: <83d0zxly66.fsf@gnu.org> From: Eli Zaretskii To: Noam Postavsky In-reply-to: <87y3imrzrs.fsf@gmail.com> (message from Noam Postavsky on Tue, 20 Mar 2018 21:19:35 -0400) Subject: Re: bug#30891: 26.0.91; indent of malformed lisp References: <87y3imrzrs.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 30891 Cc: 30891@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: Noam Postavsky > Date: Tue, 20 Mar 2018 21:19:35 -0400 > > I recently got a private report about a problem with the new lisp indent > functions: they don't work well when the buffer contains syntax errors. > For example, indent-region in a buffer containing: > > ) > (+ 2 > 3) > > gives > > Debugger entered--Lisp error: (wrong-type-argument consp nil) > lisp-indent-calc-next(#s(lisp-indent-state :stack (nil) :ppss (0 nil nil nil nil nil 0 nil nil nil nil) :ppss-point 146)) > lisp-indent-region(146 158) > indent-region(146 158 nil) > funcall-interactively(indent-region 146 158 nil) > call-interactively(indent-region nil nil) > command-execute(indent-region) > > The error can be fixed with the patch below, I think it's safe for > emacs-26. But, it still gives wrong indentation if you do indent-region > on the latter two lines. That could be fixed with > > (advice-add 'lisp-ppss :override > #'lisp-ppss-open-paren-in-column-0-is-defun-start) > > The lisp-ppss-open-paren-in-column-0-is-defun-start function is included > (but uncalled) in the patch. Using it in the override suggested above > will bring back Bug#27920 though. We could include the function and > suggest to use it (with the aforementioned caveat) in etc/NEWS or > PROBLEMS perhaps? I'd rather go back to the old code, and let the new Lisp indent functions mature on master. Alternatively, we could leave this problem alone and fix it later. But making all these changes at the 95th minute before Emacs 26 is released makes very little sense to me. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Wed Mar 21 07:50:51 2018 Received: (at 30891) by debbugs.gnu.org; 21 Mar 2018 11:50:51 +0000 Received: from localhost ([127.0.0.1]:44952 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eycGX-0003P9-4r for submit@debbugs.gnu.org; Wed, 21 Mar 2018 07:50:51 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:42107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eycGU-0003Os-Dn for 30891@debbugs.gnu.org; Wed, 21 Mar 2018 07:50:47 -0400 Received: by mail-io0-f172.google.com with SMTP id d5so6281767iob.9 for <30891@debbugs.gnu.org>; Wed, 21 Mar 2018 04:50:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=o1RdvUKSOW2KppvDopH4H0zAV7z5KerGod/838xj2pk=; b=OlRKWYJRhQIzf5bsOTA9PDs7+g3wo3gy4E7iUSuWXwBkuKYyIMbP5d6Q8Wo/AfudOd 6pllLDUvzQq+vxm+dmPnQFWxcmoemzgz91ztX3+S+e5gnmdTnUaEV1T9hd34yUX5SqBu 7ZHs0wiWrVEnH2MpVxQ2t6qr6Bg8QFb75Ii/6KfcnBqGLRFP1BSgGCm3WxkrtBynaYA0 i39WltlRSX2BiA/KDLNveGoCbWVLQEhQepTcWRl+kYRmVZwg7ZuENaNWkY3DCTvsJrKf 5mXuQlqcVJVfzQXom1IIGppu73Alxw3++RhBgUuzFKNhZXY5fxvSnsuto9dO8V5qLyK/ sd5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=o1RdvUKSOW2KppvDopH4H0zAV7z5KerGod/838xj2pk=; b=r+RlmwYZKxtlKr5Zn6us1if1EJ6vIBL6byVZpHL7ponFeI/qQzRrRHyie5yqmi5kar +6acwcVy3EOPjJGBZMjwNPm1yQTzo9uBabhGiulOjejLgtacw6LnKNd9dqVMD4j5Sa9T K2J37EZuT6vVGIBmzKZG4YIV/DiS93HnmllBEKifPRkqlI6BiOqP9BVviqb+NrHo2Ur2 JsIzNm4tjTOcBqzl+XXthqbryvfeLeG/VO3rDMy8crv6GbjD9r53DWBSTF+wkkb25/YG 0Jg1fNEg9wFvlX4nD74BTh0mWcf+R7XHQ3yGYRBssMDiDghQuQRaJUz7AwDwWe75h5M6 T2Cg== X-Gm-Message-State: AElRT7Gyfea85z8T5ojnLfmdqUpP/CCsO5u9CqCFC9Ru6PSFYymJUEgu qo47n1HI9l9rOqDxmV7u7uOxfw== X-Google-Smtp-Source: AG47ELuR5qJZ7E+JD9qDeAw3RwBIPGBV+zTWCOjUCh507/YGMFW59jgq93pH+bdKsuXpT3kg9vspOA== X-Received: by 10.107.157.146 with SMTP id g140mr19776269ioe.5.1521633040693; Wed, 21 Mar 2018 04:50:40 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id s4-v6sm3004295ita.36.2018.03.21.04.50.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Mar 2018 04:50:39 -0700 (PDT) From: Noam Postavsky To: Eli Zaretskii Subject: Re: bug#30891: 26.0.91; indent of malformed lisp References: <87y3imrzrs.fsf@gmail.com> <83d0zxly66.fsf@gnu.org> Date: Wed, 21 Mar 2018 07:50:38 -0400 In-Reply-To: <83d0zxly66.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 21 Mar 2018 08:50:41 +0200") Message-ID: <87vadpsl4h.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 30891 Cc: 30891@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) Eli Zaretskii writes: > I'd rather go back to the old code, and let the new Lisp indent > functions mature on master. Alternatively, we could leave this > problem alone and fix it later. But making all these changes at the > 95th minute before Emacs 26 is released makes very little sense to me. Okay. As a paredit use who never has malformed lisp in my buffers, I'm inclined towards the 2nd option. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 24 19:39:55 2018 Received: (at 30891) by debbugs.gnu.org; 24 Oct 2018 23:39:55 +0000 Received: from localhost ([127.0.0.1]:41010 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFSkk-0001QD-4O for submit@debbugs.gnu.org; Wed, 24 Oct 2018 19:39:54 -0400 Received: from mail-it1-f169.google.com ([209.85.166.169]:40952) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFSki-0001Q0-CH for 30891@debbugs.gnu.org; Wed, 24 Oct 2018 19:39:52 -0400 Received: by mail-it1-f169.google.com with SMTP id i191-v6so8856992iti.5 for <30891@debbugs.gnu.org>; Wed, 24 Oct 2018 16:39:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=x0Bv3uKQbgbfkq2rp9UBfgLEKNDzbeTkV2BQqtFySa4=; b=kKhz+1usKbpPMa8uw4i4D1tmzWP150w2jKtWvioE7Q3cvES2lIC+LkDA0MkqU1iKqF +CU2NNfN/HZ/TuT5gbTUo/+dgNAm1Z+o4s5J5hbdRd1THJPmkX6VfNZAykKp4uA6cSkm TM3ouny/nnUK3e9c0AWF9RsaDyuMDbBvbkvdvG1FJmLhRtNhjdf3iy6p6uuRV51nyqIu 3i7kFy7mAugJx1Dz8Z4vOkI03W7XKTZ0URTPXIT56Du3ILGMNW5NnLJFDKYKnLBnz0Zr k1zwOpAvC1VVo9DDehXA+PGS6zEaD5xY/rGlrRt10JuSGDxKfI2pr/tnllq0WkXc6fUb ZNiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=x0Bv3uKQbgbfkq2rp9UBfgLEKNDzbeTkV2BQqtFySa4=; b=XggBFX1wkUHerXTSreLTncPFbUwwOoUPmq+DbX+K0THc9yaUHVf/WbIbrEBEi+zD1r tYcGokc1Ftxtw9kSmTsXWQ+4TyzvDtse8TpUJyxbm12XWUeAefPpZOEKHkkMrgNM9r6q bVbYO9M8vroqgAcN2Dbquvnm4B+YD8yw7jKi6QRTI70ldQzzd/Wj8whNDBgfQtsDzCfd SYA5bHUqkglkJ2LMtp030n+qGymFzXl3UMQxCCJB9Ck51/DXwgYu0YGneQrr95iLEHA1 bw/zZUCFt1a32+5aa+H36gtbFT3oDxO/CicXItUf9pIAEGrVUCVownjNTH6KRzXWLTNe F/KQ== X-Gm-Message-State: AGRZ1gL9CXYJpUANkrzO1i+V9OjcqwwLDySh4n7apYucWZWtFcfNLeyf YGvutdpzpO5cFnaieR0SAzXv6uTq X-Google-Smtp-Source: AJdET5cFqU5o8p+zMG5mSiEsLcSfk8bXI8Olheeb21Wg9VRrmknFkvhDL5OHQwFkVFLsh0OX2MLuJw== X-Received: by 2002:a02:22cb:: with SMTP id o194-v6mr2601018jao.42.1540424386554; Wed, 24 Oct 2018 16:39:46 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id d19-v6sm2028905itd.15.2018.10.24.16.39.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Oct 2018 16:39:45 -0700 (PDT) From: Noam Postavsky To: Eli Zaretskii Subject: Re: bug#30891: 26.0.91; indent of malformed lisp References: <87y3imrzrs.fsf@gmail.com> <83d0zxly66.fsf@gnu.org> Date: Wed, 24 Oct 2018 19:39:44 -0400 In-Reply-To: <83d0zxly66.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 21 Mar 2018 08:50:41 +0200") Message-ID: <8736sunccf.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 30891 Cc: 30891@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> For example, indent-region in a buffer containing: >> >> ) >> (+ 2 >> 3) >> >> gives >> >> Debugger entered--Lisp error: (wrong-type-argument consp nil) > I'd rather go back to the old code, and let the new Lisp indent > functions mature on master. Alternatively, we could leave this > problem alone and fix it later. But making all these changes at the > 95th minute before Emacs 26 is released makes very little sense to me. Okay to push just the error avoidance part to emacs-26 now? (I'm not really sure how useful the lisp-ppss-open-paren-in-column-0-is-defun-start thing would be anyway, and we haven't seen any other complaints about this) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Don-t-error-when-indenting-malformed-Lisp-Bug-30891.patch Content-Description: patch >From 823fadf0a29a5cb01559f40faac2a88cd0defeb8 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 17 Mar 2018 21:14:11 -0400 Subject: [PATCH] Don't error when indenting malformed Lisp (Bug#30891) * lisp/emacs-lisp/lisp-mode.el (lisp-indent-calc-next): If we run out of indent stack, reset the parse state. --- lisp/emacs-lisp/lisp-mode.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 205c810b97..13ad06e4ae 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -827,6 +827,10 @@ lisp-indent-calc-next (prog1 (let (indent) (cond ((= (forward-line 1) 1) nil) + ;; Negative depth, probably some kind of syntax error. + ((null indent-stack) + ;; Reset state. + (setq ppss (parse-partial-sexp (point) (point)))) ((car indent-stack)) ((integerp (setq indent (calculate-lisp-indent ppss))) (setf (car indent-stack) indent)) -- 2.11.0 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 25 10:53:49 2018 Received: (at 30891) by debbugs.gnu.org; 25 Oct 2018 14:53:49 +0000 Received: from localhost ([127.0.0.1]:42519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFh1A-0004uQ-NY for submit@debbugs.gnu.org; Thu, 25 Oct 2018 10:53:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49093) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFh19-0004uE-7m for 30891@debbugs.gnu.org; Thu, 25 Oct 2018 10:53:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFh10-0003mW-RP for 30891@debbugs.gnu.org; Thu, 25 Oct 2018 10:53:41 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44310) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFh10-0003mI-My; Thu, 25 Oct 2018 10:53:38 -0400 Received: from [176.228.60.248] (port=2415 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gFh10-0006kS-3O; Thu, 25 Oct 2018 10:53:38 -0400 Date: Thu, 25 Oct 2018 17:53:36 +0300 Message-Id: <83o9biqdqn.fsf@gnu.org> From: Eli Zaretskii To: Noam Postavsky In-reply-to: <8736sunccf.fsf@gmail.com> (message from Noam Postavsky on Wed, 24 Oct 2018 19:39:44 -0400) Subject: Re: bug#30891: 26.0.91; indent of malformed lisp References: <87y3imrzrs.fsf@gmail.com> <83d0zxly66.fsf@gnu.org> <8736sunccf.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 30891 Cc: 30891@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Noam Postavsky > Cc: 30891@debbugs.gnu.org > Date: Wed, 24 Oct 2018 19:39:44 -0400 > > > I'd rather go back to the old code, and let the new Lisp indent > > functions mature on master. Alternatively, we could leave this > > problem alone and fix it later. But making all these changes at the > > 95th minute before Emacs 26 is released makes very little sense to me. > > Okay to push just the error avoidance part to emacs-26 now? Yes, please. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 25 18:04:11 2018 Received: (at 30891) by debbugs.gnu.org; 25 Oct 2018 22:04:12 +0000 Received: from localhost ([127.0.0.1]:42962 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFnjf-00030I-OC for submit@debbugs.gnu.org; Thu, 25 Oct 2018 18:04:11 -0400 Received: from mail-it1-f174.google.com ([209.85.166.174]:50275) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFnjd-0002zt-6Y; Thu, 25 Oct 2018 18:04:09 -0400 Received: by mail-it1-f174.google.com with SMTP id k206-v6so3488861ite.0; Thu, 25 Oct 2018 15:04:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=RdCjn7NBRRLPPKz5CBJc+shPCwAW/hkLpb2U6ivDcP4=; b=hAy6qLiexlncHMisGhCWlnaJbhqAXD/r4A6E68s3m1DAWGI93H2qqxffPbmYN7Hr5p Wjl4BNK+6QKuVjOOkqrgi46Akej77IGqhYpnLtUwfzRnaEABSI7InJ5aLK1m6HUUy1ME C0HojhUfaRggJyY4teuqY7I3Sz24Dd7sDOhAGZDLglc5Ta9xrtjLUtewNMtL58ErvHug RwaVz1z1jnnlAcIBcPj3u517hbhPzgwIOIzcl3+07UXrp18L6UhdLMvKP6s6FRi1w9yD qcR4lo1HcE2ry+glW4Tx22PZ9rg1osr8WBeAyA+hBzGXZtLSLprZCfqqqfCZPVpftNXo wtAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=RdCjn7NBRRLPPKz5CBJc+shPCwAW/hkLpb2U6ivDcP4=; b=YYDc8DXOabBEpNeUz+G0za4Rw3PE788LRYL+7PG0I09PSJeamVk1XDM+o2VUS8FOvK CqNmYN7CFISvLpyL+DgaFcEtlGA4/w6vKdYH8vWC7DZqiwFeFJwgOSx/Qc7IdgklpciD DQat2DERe0FaAQSh+sS8VcPNFe6LzFqEiuaym7Wq2Jw086BchO/m+OlEjJ9LMA4mF/4I dCRZgKy0K0c2FXR6Ddxy3ci/1To16MgN7JTZ9flP+3I65RrwwanYl+euO/vo4UQsZ0dL wU3fcAw/KXioPK6o3l8YK7LNir23xIt36/Hhda5RG37l+dS1dMPR9Eur4ZvC3Qm6KCLo LCXg== X-Gm-Message-State: AGRZ1gIy2whAx+W4mOAiD67QyQg9QxzG+4GNqeugj3qF1JQs7lnO7/Yo Z/ySmhqs9FWyxT8GhWPbEUC3uVxg X-Google-Smtp-Source: AJdET5f0ndOJiK9ZXnThWBOmAMRTVwMMvm/NY+tEA8qvDl8PbHinGO1AsYOQybrO7ID06yH7D3mo+A== X-Received: by 2002:a24:a089:: with SMTP id o131-v6mr2210925ite.91.1540505043410; Thu, 25 Oct 2018 15:04:03 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id 194-v6sm1319094ity.25.2018.10.25.15.04.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Oct 2018 15:04:02 -0700 (PDT) From: Noam Postavsky To: Eli Zaretskii Subject: Re: bug#30891: 26.0.91; indent of malformed lisp References: <87y3imrzrs.fsf@gmail.com> <83d0zxly66.fsf@gnu.org> <8736sunccf.fsf@gmail.com> <83o9biqdqn.fsf@gnu.org> Date: Thu, 25 Oct 2018 18:04:01 -0400 In-Reply-To: <83o9biqdqn.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 25 Oct 2018 17:53:36 +0300") Message-ID: <87r2gdlm3y.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 30891 Cc: 30891@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 30891 26.2 quit Eli Zaretskii writes: >> Okay to push just the error avoidance part to emacs-26 now? > > Yes, please. Done. [1: 92de44fa1f]: 2018-10-25 17:55:49 -0400 Don't error when indenting malformed Lisp (Bug#30891) https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=92de44fa1fdeda74a9b8254f968829df4c957da0 From unknown Mon Jun 16 23:33:22 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 23 Nov 2018 12:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 03 18:23:46 2019 Received: (at control) by debbugs.gnu.org; 3 Mar 2019 23:23:46 +0000 Received: from localhost ([127.0.0.1]:58775 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h0aSP-0001WP-SB for submit@debbugs.gnu.org; Sun, 03 Mar 2019 18:23:46 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58682) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h0aSO-0001WA-Jd for control@debbugs.gnu.org; Sun, 03 Mar 2019 18:23:44 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38247) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0aSI-0007R0-Vy for control@debbugs.gnu.org; Sun, 03 Mar 2019 18:23:39 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1h0aSI-0004SW-Tj for control@debbugs.gnu.org; Sun, 03 Mar 2019 18:23:38 -0500 Subject: control message for bug 34722 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Sun, 03 Mar 2019 18:23:38 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) unarchive 30891 forcemerge 30891 34722 From unknown Mon Jun 16 23:33:22 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 01 Apr 2019 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator