From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Noam Postavsky Newsgroups: gmane.emacs.bugs Subject: bug#30891: 26.0.91; indent of malformed lisp Date: Wed, 24 Oct 2018 19:39:44 -0400 Message-ID: <8736sunccf.fsf@gmail.com> References: <87y3imrzrs.fsf@gmail.com> <83d0zxly66.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1540424296 5707 195.159.176.226 (24 Oct 2018 23:38:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 24 Oct 2018 23:38:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) Cc: 30891@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Oct 25 01:38:12 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFSj5-0001Pt-Is for geb-bug-gnu-emacs@m.gmane.org; Thu, 25 Oct 2018 01:38:11 +0200 Original-Received: from localhost ([::1]:51096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFSlC-00037q-3v for geb-bug-gnu-emacs@m.gmane.org; Wed, 24 Oct 2018 19:40:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42795) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gFSl0-00035c-Gw for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2018 19:40:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gFSku-0001Fr-S0 for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2018 19:40:10 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:36752) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gFSku-0001Fj-Nt for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2018 19:40:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gFSks-0001Qh-G0 for bug-gnu-emacs@gnu.org; Wed, 24 Oct 2018 19:40:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Oct 2018 23:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 30891 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 30891-submit@debbugs.gnu.org id=B30891.15404243955474 (code B ref 30891); Wed, 24 Oct 2018 23:40:02 +0000 Original-Received: (at 30891) by debbugs.gnu.org; 24 Oct 2018 23:39:55 +0000 Original-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 Original-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 Original-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) Original-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) In-Reply-To: <83d0zxly66.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 21 Mar 2018 08:50:41 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:151578 Archived-At: --=-=-= 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 --=-=-=--