From unknown Mon Jun 23 02:24:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28598: 25.3; Errors in narrowed buffers in CC-mode Resent-From: George Plymale II Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Sep 2017 15:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 28598 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 28598@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.150635335929578 (code B ref -1); Mon, 25 Sep 2017 15:30:03 +0000 Received: (at submit) by debbugs.gnu.org; 25 Sep 2017 15:29:19 +0000 Received: from localhost ([127.0.0.1]:58654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwVJv-0007h0-5B for submit@debbugs.gnu.org; Mon, 25 Sep 2017 11:29:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwMlx-0004pl-Fe for submit@debbugs.gnu.org; Mon, 25 Sep 2017 02:21:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwMlr-0001rB-DT for submit@debbugs.gnu.org; Mon, 25 Sep 2017 02:21:36 -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.0 required=5.0 tests=BAYES_40,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34360) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwMlr-0001qy-9f for submit@debbugs.gnu.org; Mon, 25 Sep 2017 02:21:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwMlq-0001fH-0t for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2017 02:21:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwMll-0001ky-Bj for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2017 02:21:33 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:33665) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwMll-0001jK-6p for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2017 02:21:29 -0400 Received: by mail-qk0-x243.google.com with SMTP id g128so4264344qke.0 for ; Sun, 24 Sep 2017 23:21:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=southernohio.net; s=google; h=from:to:subject:date:message-id:mime-version; bh=H0BDoYQazuc87gy6eiFtEMn7H+Y4xrAmoamhZfpAmfA=; b=VMkZhe9X0SosENLfR3kIqNRYzcnnzMPFMOMB3yL+gEPJEAfyLN6J0NNHL1DrksR3Kb PwNH4qXDt+pqdhO2otjEAoWD3Gb8pd0rIWrwGJaw2uoedWa5cUO55zdIOa7Sz+6wjOiF pK/5BGyc3SU+KjNWEGuvRu78o8xZJYnrfg/Ts= 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=H0BDoYQazuc87gy6eiFtEMn7H+Y4xrAmoamhZfpAmfA=; b=RG5mQFYxBjp6vva9hjJYWSyRNKbz+VruiOnCaU5KAlef7PDXjsqwhPqSQ9oTD0NZru dYVlliLJE1VfguiRRSnIth0rX+P4QbH6KohJS3+oKXNr5SzQeszj4vGrx3avJCLk03E9 GQ07c0bZfCOrHa0W3HmFSKE6jtYekADwJQ9NHGsvVsUudNyOmv+Tu9BWx3gW1az15tfH qyysaooIQ04CCr43Uc4+fzWclqBuLQ8CTOED5IoFyb86AeNCGDg8B7bjUTExZXWrKZ5n P1HQCtCHWvg9jL4lhjmKoD6gT+SBrEqZRQHLSeQCq3nrne98hwymihDmSdmeDc6Txuzw YWig== X-Gm-Message-State: AHPjjUiHqCeDMbW0kkw8czqR1hP0BP8P82LQsoB0PLiSb3/qQRi1fU7r NsD3mn9ufH1Gh3hKGI1YOuoa0MN6sQ== X-Google-Smtp-Source: AOwi7QBHjU2FD14c8c5CU8UnbLYDjG/6dgEiynXfpALK6ow942oW+9aoZrdnnBewfPJ5NhvUh6njIQ== X-Received: by 10.55.165.202 with SMTP id o193mr8967027qke.291.1506320487293; Sun, 24 Sep 2017 23:21:27 -0700 (PDT) Received: from lehi.dev.orbitalimpact.com (ip-19-41-54-196.montreal.ca.northamericancoax.com. [196.54.41.19]) by smtp.gmail.com with ESMTPSA id h4sm4641333qth.75.2017.09.24.23.21.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Sep 2017 23:21:26 -0700 (PDT) From: George Plymale II X-Google-Original-From: George Plymale II Date: Mon, 25 Sep 2017 02:21:25 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain 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: -5.0 (-----) X-Mailman-Approved-At: Mon, 25 Sep 2017 11:29:17 -0400 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: -5.0 (-----) The inception of this bug report can be found at: https://github.com/josteink/csharp-mode/issues/119 For those too lazy to follow the link, here's the gist: When I press `RET' at the beginning or end of a narrowed buffer in CC-mode, I see errors like this: c-determine-limit: Args out of range: #, 1, 1564 A full backtrace yields something like this: Debugger entered--Lisp error: (args-out-of-range # 1 1564) parse-partial-sexp(1 1564) c-determine-limit(500) c-guess-basic-syntax() c-indent-line() indent-according-to-mode() electric-indent-post-self-insert-function() self-insert-command(1) newline(nil 1) funcall-interactively(newline nil 1) call-interactively(newline nil nil) command-execute(newline) As you can see from the filename there, the file I was testing this with was dired.c from the very Emacs source tree (although I have now tested with various header files, other C files, and of course, C# files). I initially tested this on a macOS system, but now I have also tested this on Ubuntu and I see the same issue occurring on both systems (which are both using Emacs 25.3). I also noticed that this issue does not occur in Emacs 24. From unknown Mon Jun 23 02:24:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28598: 25.3; Errors in narrowed buffers in CC-mode Resent-From: John Wiegley Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Sep 2017 17:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28598 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: George Plymale II Cc: Alan Mackenzie , 28598@debbugs.gnu.org Received: via spool by 28598-submit@debbugs.gnu.org id=B28598.150636187132075 (code B ref 28598); Mon, 25 Sep 2017 17:52:01 +0000 Received: (at 28598) by debbugs.gnu.org; 25 Sep 2017 17:51:11 +0000 Received: from localhost ([127.0.0.1]:58840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwXXD-0008LH-EX for submit@debbugs.gnu.org; Mon, 25 Sep 2017 13:51:11 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:46929) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwXXB-0008L0-Lk for 28598@debbugs.gnu.org; Mon, 25 Sep 2017 13:51:10 -0400 Received: by mail-pg0-f41.google.com with SMTP id i130so4395916pgc.3 for <28598@debbugs.gnu.org>; Mon, 25 Sep 2017 10:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:date:message-id:references :user-agent:mime-version; bh=q3Em21/7oSE2azYWCO5tF6J/KMBQMQS5irQPKRgcrkQ=; b=HUWltQlUqVsHXtCbKeHdlmaqRKe+IQQ0pd2kst6HgN/2vbU7RqjqgqOP4RShxa0I2f jwjYU+Rm7LG+F4hFQC0QZa5XsgpCbw6XdtWzpqROim7I9u5QzQKHmFInez+TrPc8OPrI tf1WrNJSRVy0LraKEybP31FrcgDoyi8k+SyhY6PB28U3K+uALfvt7hteNuqu3k8W0+ih fPNohtfLe5ztz4N6J8Ex5NwpSVrC75Uqvhlv61AyuiEQlu7hd6afONpCZMLb3xPi+n4t 7zSwPHiqmkBb4/QO6vfAy0V1P6irqEb8yrevkPj1HkWaFaeq06svIgJGqIbbIaaN37W0 eYHg== 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:in-reply-to:date:message-id :references:user-agent:mime-version; bh=q3Em21/7oSE2azYWCO5tF6J/KMBQMQS5irQPKRgcrkQ=; b=GPVtQ7aejNEV+BsfazNawaU9Hw/WfXhR+rzRmz06jOdxctjIyJDMntLPQw1w5kCT5v 5cSRlzQTFVQPi8gZjhXxm94X26bubFAhPD41qXTOVloz18C58l3eMhrZh3SELU6LH2vO 65Mm+pjKNlBh6r1FPnlLhGNbkX3GdbWLn2A8Go2U4UtAeJBBXcAhEz8Q1K1VY1P2bcKL 891ttmK7qziiGJTpVwev8sxvZn7zOucd4FbyiTJeYifd0ySPAJZVVU8SqfB+sQLMn1cJ VT8zmyL0abyaL5saF0jgQTPxEZ1sLnWjvnh2cQJ6ceV1bHgXcP2GBAopTU7zVk59/ODU koow== X-Gm-Message-State: AHPjjUhj7G/U0A7ZDxTbDfxHJs3UDOh0h3dQeLaIMR5hHk0iHO9vxoRe 1LhP/Fo6SixpnqNhxVjAgaTTi3jo X-Google-Smtp-Source: AOwi7QB27FphbcNvQWcySDPLShT9IihuOuN+cIeKbjhcp5LTCgY4qQWrQnsbI/ZPqUx1bqC/0uYdqg== X-Received: by 10.99.140.93 with SMTP id q29mr8454952pgn.228.1506361863399; Mon, 25 Sep 2017 10:51:03 -0700 (PDT) Received: from Vulcan.local (76-234-69-149.lightspeed.frokca.sbcglobal.net. [76.234.69.149]) by smtp.gmail.com with ESMTPSA id v24sm14109298pfi.132.2017.09.25.10.51.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Sep 2017 10:51:02 -0700 (PDT) From: John Wiegley X-Google-Original-From: "John Wiegley" Received: by Vulcan.local (Postfix, from userid 501) id B6164909A5A7; Mon, 25 Sep 2017 10:51:01 -0700 (PDT) In-Reply-To: (George Plymale, II's message of "Mon, 25 Sep 2017 02:21:25 -0400") Date: Mon, 25 Sep 2017 10:51:00 -0700 Message-ID: References: User-Agent: Gnus/5.130016 (Ma Gnus v0.16) Emacs/26.0 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) 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 (/) >>>>> "GP" == George Plymale writes: GP> For those too lazy to follow the link, here's the gist: When I press `RET' GP> at the beginning or end of a narrowed buffer in CC-mode, I see errors like GP> this: GP> c-determine-limit: Args out of range: #, 1, 1564 Alan, do you have any thoughts on this one? -- John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 From unknown Mon Jun 23 02:24:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28598: 25.3; Errors in narrowed buffers in CC-mode Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 25 Sep 2017 20:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28598 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: John Wiegley , George Plymale II Cc: 28598@debbugs.gnu.org Received: via spool by 28598-submit@debbugs.gnu.org id=B28598.150637312123773 (code B ref 28598); Mon, 25 Sep 2017 20:59:01 +0000 Received: (at 28598) by debbugs.gnu.org; 25 Sep 2017 20:58:41 +0000 Received: from localhost ([127.0.0.1]:59037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwaSd-0006BL-M6 for submit@debbugs.gnu.org; Mon, 25 Sep 2017 16:58:40 -0400 Received: from ocolin.muc.de ([193.149.48.4]:34512 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1dwaSb-0006BD-Lx for 28598@debbugs.gnu.org; Mon, 25 Sep 2017 16:58:38 -0400 Received: (qmail 42988 invoked by uid 3782); 25 Sep 2017 20:58:32 -0000 Received: from acm.muc.de (p548C6E9D.dip0.t-ipconnect.de [84.140.110.157]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 25 Sep 2017 22:58:31 +0200 Received: (qmail 5672 invoked by uid 1000); 25 Sep 2017 20:50:57 -0000 Date: Mon, 25 Sep 2017 20:50:57 +0000 Message-ID: <20170925205057.GB4651@ACM> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) 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 (/) Hello, John and George. On Mon, Sep 25, 2017 at 10:51:00 -0700, John Wiegley wrote: > >>>>> "GP" == George Plymale writes: > GP> For those too lazy to follow the link, here's the gist: When I press `RET' > GP> at the beginning or end of a narrowed buffer in CC-mode, I see errors like > GP> this: > GP> c-determine-limit: Args out of range: #, 1, 1564 > Alan, do you have any thoughts on this one? Thanks for the heads up, John. With the help of George's backtrace, I can see exactly what's happening, where, and why. The fixing of the bug will involve carefully defining conditions which must hold when a function (c-determine-limit) is called, and amending it on the assumption those conditions hold. Give me a day or two, it's a bit late at the moment here in Germany. > -- > John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F > http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 -- Alan Mackenzie (Nuremberg, Germany). From unknown Mon Jun 23 02:24:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28598: 25.3; Errors in narrowed buffers in CC-mode References: Resent-From: George Plymale II Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 26 Sep 2017 01:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28598 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Alan Mackenzie Cc: jwiegley@gmail.com, 28598@debbugs.gnu.org Received: via spool by 28598-submit@debbugs.gnu.org id=B28598.15063884984647 (code B ref 28598); Tue, 26 Sep 2017 01:15:02 +0000 Received: (at 28598) by debbugs.gnu.org; 26 Sep 2017 01:14:58 +0000 Received: from localhost ([127.0.0.1]:59280 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dweSf-0001Ct-Q7 for submit@debbugs.gnu.org; Mon, 25 Sep 2017 21:14:57 -0400 Received: from mail-qk0-f177.google.com ([209.85.220.177]:56240) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dweSe-0001Cf-S3 for 28598@debbugs.gnu.org; Mon, 25 Sep 2017 21:14:57 -0400 Received: by mail-qk0-f177.google.com with SMTP id q8so8537565qkl.12 for <28598@debbugs.gnu.org>; Mon, 25 Sep 2017 18:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=southernohio.net; s=google; h=from:to:cc:subject:in-reply-to:date:message-id:mime-version; bh=GeCeYorjmMOsy0RyFTfORodAqnbB9DfdYnr8P4+aNDw=; b=AYa7NJOo/jfwPL+d0Px0HqR8++4IqXaFBglVeXxq13xyy0j701Xu6zvK+nwPSThbRv bczvwPOhp11TisaSxS0bhICi2O7hBF8St0pi+z/VmIxWpjzTS669PmacVZ7y93g7VJ0N 1TcrLSA56pBN4VkpGB9mWIniMCLtCALr0WntY= 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:in-reply-to:date:message-id :mime-version; bh=GeCeYorjmMOsy0RyFTfORodAqnbB9DfdYnr8P4+aNDw=; b=Uu8OPbcywKkNLhWE6YIF0kzsM/BHYOy2oUJmEpP8aM86bWtja+x5RYn79sYX1CuzHD AvF4KT7d/UxpHQ0LpIEZH75Y0/bF1rxY0/36eSvgU+sm/1tLy081Xwp9H4OVL4wNt9fQ R6mGDbZ+inWeFGafi2TdljAZZ0SxsokM6O5NtRw8OIn6bBUw/VBm+QQCpLw0w2hzz2Iu VsIiS1nSUdMezWjf/g/w5Cbh1+EY4zfmIFyu6eB0wKZrudPAKoULiOH+5t4jL7ktvTu3 rNCkHqMA+P9oAGQC7s6rLfOfPzWFBV7oO83X0zf9+oWxRXaZQ+AcNRuhUMDLVtJmU+jL UZ/A== X-Gm-Message-State: AHPjjUikYHFsu+MRsrVYwz8OWbjy7nIUjDIxi3cT9ShtT3DFlSrdDYie ZCWWQqrbSBCjOmFZVd95cVTevDOT4vGU X-Google-Smtp-Source: AOwi7QB27GJ/mlBrrmz3BQySjp0HF8g1WiJthidYqUOkJMFCHI8/+kYPXmXkJKdq3Lu4H6Uwqay/Yw== X-Received: by 10.55.160.140 with SMTP id j134mr12380405qke.274.1506388491208; Mon, 25 Sep 2017 18:14:51 -0700 (PDT) Received: from lehi.dev.orbitalimpact.com (ip-30-41-54-196.montreal.ca.northamericancoax.com. [196.54.41.30]) by smtp.gmail.com with ESMTPSA id z22sm5956062qti.36.2017.09.25.18.14.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Sep 2017 18:14:50 -0700 (PDT) From: George Plymale II X-Google-Original-From: George Plymale II In-Reply-To: <20170925205057.GB4651@ACM> (message from Alan Mackenzie on Mon, 25 Sep 2017 20:50:57 +0000) Date: Mon, 25 Sep 2017 21:14:29 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) 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.5 (/) Thanks a lot for tackling this issue, Alan! Let me know if you need any more info. From unknown Mon Jun 23 02:24:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28598: 25.3; Errors in narrowed buffers in CC-mode Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 01 Oct 2017 19:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28598 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: George Plymale II , John Wiegley Cc: 28598@debbugs.gnu.org Received: via spool by 28598-submit@debbugs.gnu.org id=B28598.150688467713466 (code B ref 28598); Sun, 01 Oct 2017 19:05:02 +0000 Received: (at 28598) by debbugs.gnu.org; 1 Oct 2017 19:04:37 +0000 Received: from localhost ([127.0.0.1]:43122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyjXZ-0003V7-9I for submit@debbugs.gnu.org; Sun, 01 Oct 2017 15:04:37 -0400 Received: from ocolin.muc.de ([193.149.48.4]:37406 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1dyjXX-0003Uz-HX for 28598@debbugs.gnu.org; Sun, 01 Oct 2017 15:04:36 -0400 Received: (qmail 77831 invoked by uid 3782); 1 Oct 2017 19:04:32 -0000 Received: from acm.muc.de (p548C6954.dip0.t-ipconnect.de [84.140.105.84]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 01 Oct 2017 21:04:31 +0200 Received: (qmail 4157 invoked by uid 1000); 1 Oct 2017 18:55:49 -0000 Date: Sun, 1 Oct 2017 18:55:49 +0000 Message-ID: <20171001185548.GC3461@ACM> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) 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 (/) Hello, George and John. On Mon, Sep 25, 2017 at 10:51:00 -0700, John Wiegley wrote: > >>>>> "GP" == George Plymale writes: > GP> For those too lazy to follow the link, here's the gist: When I press `RET' > GP> at the beginning or end of a narrowed buffer in CC-mode, I see errors like > GP> this: > GP> c-determine-limit: Args out of range: #, 1, 1564 > Alan, do you have any thoughts on this one? George, would you try the following patch, please? The file cc-engine.el is in ..../emacs-25.3/lisp/progmodes. After applying the patch, it is sufficient merely to recompile cc-engine.el. If you want any help with the patching/recompiling process, feel free to send me private email. The bug which you tripped over is already (almost) fixed in the emacs-26 branch of the git repository. It is expected to be released some months from now. In the meantime, this patch should solve the problems in Emacs 25.3. Please let me know if it doesn't. --- cc-engine.20171001.eeel 2017-04-14 15:02:47.000000000 +0000 +++ cc-engine.el 2017-10-01 17:14:49.185254672 +0000 @@ -4682,18 +4682,29 @@ ;; This doesn't preserve point. (let* ((pos (max (- start try-size) (point-min))) (base (c-state-semi-safe-place pos)) - (s (parse-partial-sexp base pos))) - (if (or (nth 4 s) (nth 3 s)) ; comment or string - (nth 8 s) + (s (save-restriction + (widen) + (parse-partial-sexp base pos))) + (cand (if (or (nth 4 s) (nth 3 s)) ; comment or string + (nth 8 s) + pos))) + (if (>= cand (point-min)) + cand + (parse-partial-sexp pos start nil nil s 'syntax-table) (point)))) (defun c-determine-limit (how-far-back &optional start try-size) - ;; Return a buffer position HOW-FAR-BACK non-literal characters from START - ;; (default point). This is done by going back further in the buffer then - ;; searching forward for literals. The position found won't be in a - ;; literal. We start searching for the sought position TRY-SIZE (default - ;; twice HOW-FAR-BACK) bytes back from START. This function must be fast. - ;; :-) + ;; Return a buffer position HOW-FAR-BACK non-literal characters from + ;; START (default point). The starting position, either point or + ;; START may not be in a comment or string. + ;; + ;; The position found will not be before POINT-MIN and won't be in a + ;; literal. + ;; + ;; We start searching for the sought position TRY-SIZE (default + ;; twice HOW-FAR-BACK) bytes back from START. + ;; + ;; This function must be fast. :-) (save-excursion (let* ((start (or start (point))) (try-size (or try-size (* 2 how-far-back))) @@ -4715,7 +4726,8 @@ 'syntax-table)) ; stop-comment ;; Gather details of the non-literal-bit - starting pos and size. - (setq size (- (if (or (nth 4 s) (nth 3 s)) + (setq size (- (if (or (and (nth 4 s) (not (eq (nth 7 s) 'syntax-table))) + (nth 3 s)) (nth 8 s) (point)) pos)) @@ -4723,7 +4735,8 @@ (setq stack (cons (cons pos size) stack))) ;; Move forward to the end of the comment/string. - (if (or (nth 4 s) (nth 3 s)) + (if (or (and (nth 4 s) (not (eq (nth 7 s) 'syntax-table))) + (nth 3 s)) (setq s (parse-partial-sexp (point) start @@ -4747,6 +4760,8 @@ (+ (car elt) (- count how-far-back))) ((eq base (point-min)) (point-min)) + ((> base (- start try-size)) ; Can only happen if we hit point-min. + (car elt)) (t (c-determine-limit (- how-far-back count) base try-size)))))) > -- > John Wiegley GPG fingerprint = 4710 CF98 AF9B 327B B80F > http://newartisans.com 60E1 46C4 BD1A 7AC1 4BA2 -- Alan Mackenzie (Nuremberg, Germany). From unknown Mon Jun 23 02:24:10 2025 X-Loop: help-debbugs@gnu.org Subject: bug#28598: 25.3; Errors in narrowed buffers in CC-mode References: Resent-From: George Plymale II Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 02 Oct 2017 19:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28598 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Alan Mackenzie Cc: jwiegley@gmail.com, 28598@debbugs.gnu.org Received: via spool by 28598-submit@debbugs.gnu.org id=B28598.150697100112132 (code B ref 28598); Mon, 02 Oct 2017 19:04:02 +0000 Received: (at 28598) by debbugs.gnu.org; 2 Oct 2017 19:03:21 +0000 Received: from localhost ([127.0.0.1]:44548 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz5zt-00039c-Bz for submit@debbugs.gnu.org; Mon, 02 Oct 2017 15:03:21 -0400 Received: from mail-qk0-f176.google.com ([209.85.220.176]:55195) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz5zo-00039I-0b for 28598@debbugs.gnu.org; Mon, 02 Oct 2017 15:03:16 -0400 Received: by mail-qk0-f176.google.com with SMTP id n5so3961889qke.11 for <28598@debbugs.gnu.org>; Mon, 02 Oct 2017 12:03:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=southernohio.net; s=google; h=from:to:cc:subject:in-reply-to:date:message-id:mime-version; bh=TlYCxfVMl9XTBfilo92gAn3QbZv5pltJya7TXmg8nTs=; b=fTCJxrHIqY5h2ViPeRT3Jj80tq7I6v84D3ko6CQ2YOOp4QYdFknu5vRav11DQwxVRC F3c6rPKup7bbPiRetaGRCfl5Ki+lW3+A8Au0XKjinfY8Vzo6ZGxEMFDr6ItKXvtK38TT HmuSfPuRuPcmll9DzKQ0/hkl4AzKSife8w/wM= 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:in-reply-to:date:message-id :mime-version; bh=TlYCxfVMl9XTBfilo92gAn3QbZv5pltJya7TXmg8nTs=; b=rXiAI2ChPuHqndxxOxsi/tl+YeCdsS/SDamLB8VrJPofFWC7kFNuVCYED0JuA7MZTC IpLUPaJKH6zYWlvSYvOtahj4dnDny0CLJ7ZZlxPWAc+otKr4GML98bo1i4PKt+Ft77/Z 99ybGXCIw387/YkTwUR30FmYkFUszK5W6I+hTEdtE7B+ho71lVjS+L50PdhM5W53UPqv o0kfcXtK2SsUDrTp8LVJLk7Ein4bEHqaQF0xVRjAGl5e4o6b7ifdtRLOU6j7w6UUlBR/ BncE9kg7UGhO8cSSwqie4P71P4gyq5Gq8Zea1Uq4BO2IHAivQj47azLZtvYfoyqki8nV 5Quw== X-Gm-Message-State: AMCzsaVPIA/MfVvEbgvDlvYyOGF8l+ozlqPEGZxVfNv9ncxMqigDRiHR 828zsQh+N1yXalD75aQ+4xwjlSYGjA== X-Google-Smtp-Source: AOwi7QCJqpbJl+BDPhIOJ6VJCB1KMq/HSqojfg2QioYTBcKHJrl+cDno5QiQfsdch8bg7QKmbjbOXQ== X-Received: by 10.55.91.199 with SMTP id p190mr15578933qkb.106.1506970989348; Mon, 02 Oct 2017 12:03:09 -0700 (PDT) Received: from lehi.dev.orbitalimpact.com (ip-41-41-54-196.montreal.ca.northamericancoax.com. [196.54.41.41]) by smtp.gmail.com with ESMTPSA id m66sm7122581qkf.23.2017.10.02.12.03.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 02 Oct 2017 12:03:08 -0700 (PDT) From: George Plymale II X-Google-Original-From: George Plymale II In-Reply-To: <20171001185548.GC3461@ACM> (message from Alan Mackenzie on Sun, 1 Oct 2017 18:55:49 +0000) Date: Mon, 02 Oct 2017 15:02:36 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) 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: -2.3 (--) Hi, Alan. Thanks for making this patch. After applying it to my Emacs source tree and recompiling Emacs, the issue seems to be gone as far as I can tell. I have also tested the patched version with C# files (as well as C files, obviously) and everything seems okay. Hopefully Emacs 26 will come out soon and fix this issue, among many others that I'm excited to see fixed. Thanks. From unknown Mon Jun 23 02:24:10 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: George Plymale II Subject: bug#28598: closed (Re: bug#28598: 25.3; Errors in narrowed buffers in CC-mode) Message-ID: References: <20171030173755.GA5659@ACM> X-Gnu-PR-Message: they-closed 28598 X-Gnu-PR-Package: emacs,cc-mode Reply-To: 28598@debbugs.gnu.org Date: Mon, 30 Oct 2017 17:45:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1509385502-5472-1" This is a multi-part message in MIME format... ------------=_1509385502-5472-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #28598: 25.3; Errors in narrowed buffers in CC-mode which was filed against the emacs,cc-mode package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 28598@debbugs.gnu.org. --=20 28598: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D28598 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1509385502-5472-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 28598-done) by debbugs.gnu.org; 30 Oct 2017 17:44:25 +0000 Received: from localhost ([127.0.0.1]:42532 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e9E6q-0001PF-RX for submit@debbugs.gnu.org; Mon, 30 Oct 2017 13:44:24 -0400 Received: from ocolin.muc.de ([193.149.48.4]:64923 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1e9E6o-0001P7-Uz for 28598-done@debbugs.gnu.org; Mon, 30 Oct 2017 13:44:23 -0400 Received: (qmail 73482 invoked by uid 3782); 30 Oct 2017 17:44:18 -0000 Received: from acm.muc.de (p548C70F0.dip0.t-ipconnect.de [84.140.112.240]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 30 Oct 2017 18:44:17 +0100 Received: (qmail 2304 invoked by uid 1000); 30 Oct 2017 17:37:55 -0000 Date: Mon, 30 Oct 2017 17:37:55 +0000 To: George Plymale II Subject: Re: bug#28598: 25.3; Errors in narrowed buffers in CC-mode Message-ID: <20171030173755.GA5659@ACM> References: <20171001185548.GC3461@ACM> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.7.2 (2016-11-26) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 28598-done Cc: jwiegley@gmail.com, 28598-done@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 (/) Hello, George. On Mon, Oct 02, 2017 at 15:02:36 -0400, George Plymale II wrote: > Hi, Alan. > Thanks for making this patch. After applying it to my Emacs source tree > and recompiling Emacs, the issue seems to be gone as far as I can > tell. I have also tested the patched version with C# files (as well as C > files, obviously) and everything seems okay. > Hopefully Emacs 26 will come out soon and fix this issue, among many > others that I'm excited to see fixed. I've committed the fix to Emacs's emacs-26 branch, and I'm closing the bug. > Thanks. Thank you, too! -- Alan Mackenzie (Nuremberg, Germany). ------------=_1509385502-5472-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 25 Sep 2017 15:29:19 +0000 Received: from localhost ([127.0.0.1]:58654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwVJv-0007h0-5B for submit@debbugs.gnu.org; Mon, 25 Sep 2017 11:29:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58990) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dwMlx-0004pl-Fe for submit@debbugs.gnu.org; Mon, 25 Sep 2017 02:21:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwMlr-0001rB-DT for submit@debbugs.gnu.org; Mon, 25 Sep 2017 02:21:36 -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.0 required=5.0 tests=BAYES_40,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:34360) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwMlr-0001qy-9f for submit@debbugs.gnu.org; Mon, 25 Sep 2017 02:21:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49961) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwMlq-0001fH-0t for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2017 02:21:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwMll-0001ky-Bj for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2017 02:21:33 -0400 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]:33665) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dwMll-0001jK-6p for bug-gnu-emacs@gnu.org; Mon, 25 Sep 2017 02:21:29 -0400 Received: by mail-qk0-x243.google.com with SMTP id g128so4264344qke.0 for ; Sun, 24 Sep 2017 23:21:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=southernohio.net; s=google; h=from:to:subject:date:message-id:mime-version; bh=H0BDoYQazuc87gy6eiFtEMn7H+Y4xrAmoamhZfpAmfA=; b=VMkZhe9X0SosENLfR3kIqNRYzcnnzMPFMOMB3yL+gEPJEAfyLN6J0NNHL1DrksR3Kb PwNH4qXDt+pqdhO2otjEAoWD3Gb8pd0rIWrwGJaw2uoedWa5cUO55zdIOa7Sz+6wjOiF pK/5BGyc3SU+KjNWEGuvRu78o8xZJYnrfg/Ts= 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=H0BDoYQazuc87gy6eiFtEMn7H+Y4xrAmoamhZfpAmfA=; b=RG5mQFYxBjp6vva9hjJYWSyRNKbz+VruiOnCaU5KAlef7PDXjsqwhPqSQ9oTD0NZru dYVlliLJE1VfguiRRSnIth0rX+P4QbH6KohJS3+oKXNr5SzQeszj4vGrx3avJCLk03E9 GQ07c0bZfCOrHa0W3HmFSKE6jtYekADwJQ9NHGsvVsUudNyOmv+Tu9BWx3gW1az15tfH qyysaooIQ04CCr43Uc4+fzWclqBuLQ8CTOED5IoFyb86AeNCGDg8B7bjUTExZXWrKZ5n P1HQCtCHWvg9jL4lhjmKoD6gT+SBrEqZRQHLSeQCq3nrne98hwymihDmSdmeDc6Txuzw YWig== X-Gm-Message-State: AHPjjUiHqCeDMbW0kkw8czqR1hP0BP8P82LQsoB0PLiSb3/qQRi1fU7r NsD3mn9ufH1Gh3hKGI1YOuoa0MN6sQ== X-Google-Smtp-Source: AOwi7QBHjU2FD14c8c5CU8UnbLYDjG/6dgEiynXfpALK6ow942oW+9aoZrdnnBewfPJ5NhvUh6njIQ== X-Received: by 10.55.165.202 with SMTP id o193mr8967027qke.291.1506320487293; Sun, 24 Sep 2017 23:21:27 -0700 (PDT) Received: from lehi.dev.orbitalimpact.com (ip-19-41-54-196.montreal.ca.northamericancoax.com. [196.54.41.19]) by smtp.gmail.com with ESMTPSA id h4sm4641333qth.75.2017.09.24.23.21.26 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 24 Sep 2017 23:21:26 -0700 (PDT) From: George Plymale II X-Google-Original-From: George Plymale II To: bug-gnu-emacs@gnu.org Subject: 25.3; Errors in narrowed buffers in CC-mode Date: Mon, 25 Sep 2017 02:21:25 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain 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: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 25 Sep 2017 11:29:17 -0400 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: -5.0 (-----) The inception of this bug report can be found at: https://github.com/josteink/csharp-mode/issues/119 For those too lazy to follow the link, here's the gist: When I press `RET' at the beginning or end of a narrowed buffer in CC-mode, I see errors like this: c-determine-limit: Args out of range: #, 1, 1564 A full backtrace yields something like this: Debugger entered--Lisp error: (args-out-of-range # 1 1564) parse-partial-sexp(1 1564) c-determine-limit(500) c-guess-basic-syntax() c-indent-line() indent-according-to-mode() electric-indent-post-self-insert-function() self-insert-command(1) newline(nil 1) funcall-interactively(newline nil 1) call-interactively(newline nil nil) command-execute(newline) As you can see from the filename there, the file I was testing this with was dired.c from the very Emacs source tree (although I have now tested with various header files, other C files, and of course, C# files). I initially tested this on a macOS system, but now I have also tested this on Ubuntu and I see the same issue occurring on both systems (which are both using Emacs 25.3). I also noticed that this issue does not occur in Emacs 24. ------------=_1509385502-5472-1--