From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 14 03:58:26 2013 Received: (at submit) by debbugs.gnu.org; 14 Feb 2013 08:58:26 +0000 Received: from localhost ([127.0.0.1]:55079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5ueA-0001Aa-3S for submit@debbugs.gnu.org; Thu, 14 Feb 2013 03:58:26 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49649) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U5ue7-0001AR-Ne for submit@debbugs.gnu.org; Thu, 14 Feb 2013 03:58:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5udQ-0000Gn-DV for submit@debbugs.gnu.org; Thu, 14 Feb 2013 03:57:47 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:50646) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5udQ-0000Gi-8b for submit@debbugs.gnu.org; Thu, 14 Feb 2013 03:57:40 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60869) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5udF-0003zJ-MC for bug-gnu-emacs@gnu.org; Thu, 14 Feb 2013 03:57:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5ud2-0000CB-5C for bug-gnu-emacs@gnu.org; Thu, 14 Feb 2013 03:57:29 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:37143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5ud1-0000Bn-S8 for bug-gnu-emacs@gnu.org; Thu, 14 Feb 2013 03:57:15 -0500 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 7AFD2209B6 for ; Thu, 14 Feb 2013 03:57:13 -0500 (EST) Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160]) by compute1.internal (MEProxy); Thu, 14 Feb 2013 03:57:13 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=from:to:subject:date:message-id:mime-version:content-type; s= mesmtp; bh=XxUXQzKc1jmVJ1VRicXHajILR7A=; b=N5G3WLksabCDArBKUS2r4 WD3eo3KxjS0QytDrYQdxY4Yv7MoXojrxPKz7Z71VI7GUi5gDwx424AKZfpx7rLMg i6RNLFw+z3jnjsJDHpZ+6fB/dLZkCXTSXGlEEcNgY5jFMMAEvOwQU2oqcTXcaQSL 7sNHzpYUQVsPUUX8OH0jL8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:to:subject:date:message-id :mime-version:content-type; s=smtpout; bh=XxUXQzKc1jmVJ1VRicXHaj ILR7A=; b=mOAHCVHT8Zdb0ulwkpM54D0Ofr5lE44OhfQmBs0onCO/Vb+IuN1unB vY2pgR6IbAtUw0WayFVsDv8Ajh42y2GNmaA2qPmrD88IdAtpPFSJLrCHV74CeLLQ OIgsn40wTkmO6GwdZ+QVKWoVtHtdRe5an1cVRG0aCf9lkln/Jbh9Y= X-Sasl-enc: yfZZtHYDcDooaC7JcWs2lmHSoADUgwVQQkYBvLU4Uy/c 1360832232 Received: from shorty.local (unknown [76.169.247.77]) by mail.messagingengine.com (Postfix) with ESMTPA id B0CFD8E01F2 for ; Thu, 14 Feb 2013 03:57:12 -0500 (EST) Received: from dima by shorty.local with local (Exim 4.80) (envelope-from ) id 1U5ucx-0005A7-Ag for bug-gnu-emacs@gnu.org; Thu, 14 Feb 2013 00:57:11 -0800 From: Dima Kogan To: bug-gnu-emacs@gnu.org Subject: 24.3.50; C indent produces error when narrowing is active Date: Thu, 14 Feb 2013 00:57:11 -0800 Message-ID: <87sj4znuhk.fsf@secretsauce.net> 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: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Hi. I'm observing an issue with emacs indentation in C mode when narrowing is enabled. To reproduce, create a tst.c buffer with the following 3 lines: // 123 // 456 // 789 I select the last 2 lines (456, 789), and narrow-to-region. Then I place the point at the start of the 789 line, and press 'tab'. I get this: Debugger entered--Lisp error: (args-out-of-range 1 8) parse-partial-sexp(1 8) c-determine-limit-get-base(15 1000) (let* ((start (or start (point))) (try-size (or try-size (* 2 how-far-back))) (base (c-determine-limit-get-base start try-size)) (pos base) (s (parse-partial-sexp pos pos)) stack elt size (count 0)) (while (< pos start) (setq s (parse-partial-sexp pos start nil nil s (quote syntax-table))) (setq size (- (if (or (nth 4 s) (nth 3 s)) (nth 8 s) (point)) pos)) (if (> size 0) (setq stack (cons (cons pos size) stack))) (if (or (nth 4 s) (nth 3 s)) (setq s (parse-partial-sexp (point) start nil nil s (quote syntax-table)))) (setq pos (point))) (while (and (< count how-far-back) stack) (setq elt (car stack) stack (cdr stack)) (setq count (+ count (cdr elt)))) (cond ((>= count how-far-back) (+ (car elt) (- count how-far-back))) ((eq base (point-min)) (point-min)) (t (c-determine-limit (- how-far-back count) base try-size)))) (save-excursion (let* ((start (or start (point))) (try-size (or try-size (* 2 how-far-back))) (base (c-determine-limit-get-base start try-size)) (pos base) (s (parse-partial-sexp pos pos)) stack elt size (count 0)) (while (< pos start) (setq s (parse-partial-sexp pos start nil nil s (quote syntax-table))) (setq size (- (if (or (nth 4 s) (nth 3 s)) (nth 8 s) (point)) pos)) (if (> size 0) (setq stack (cons (cons pos size) stack))) (if (or (nth 4 s) (nth 3 s)) (setq s (parse-partial-sexp (point) start nil nil s (quote syntax-table)))) (setq pos (point))) (while (and (< count how-far-back) stack) (setq elt (car stack) stack (cdr stack)) (setq count (+ count (cdr elt)))) (cond ((>= count how-far-back) (+ (car elt) (- count how-far-back))) ((eq base (point-min)) (point-min)) (t (c-determine-limit (- how-far-back count) base try-size))))) c-determine-limit(500) c-guess-basic-syntax() c-indent-line() c-indent-command(nil) c-indent-line-or-region(nil nil) call-interactively(c-indent-line-or-region nil nil) As shown above, the failure is in (parse-partial-sexp 1 8). Evaluating this same for succeeds if the buffer is re-widened. Thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 17 03:07:47 2013 Received: (at 13713) by debbugs.gnu.org; 17 Feb 2013 08:07:48 +0000 Received: from localhost ([127.0.0.1]:59970 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6zHn-0005jl-MA for submit@debbugs.gnu.org; Sun, 17 Feb 2013 03:07:47 -0500 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:51900) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U6zHl-0005je-DY for 13713@debbugs.gnu.org; Sun, 17 Feb 2013 03:07:46 -0500 Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id EA3222071E for <13713@debbugs.gnu.org>; Sun, 17 Feb 2013 03:06:51 -0500 (EST) Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161]) by compute5.internal (MEProxy); Sun, 17 Feb 2013 03:06:51 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=secretsauce.net; h=date:from:to:subject:message-id:mime-version:content-type :content-transfer-encoding; s=mesmtp; bh=X2HaiiLAoMIqlTDyS8hfJXt ejYs=; b=SwKNQeO/c89STcd6wCZmwBH6OkiHReR0kfpo5zetDCwMRbJmDsdXuAg 2EWIdKDUzyk2O7J91T3b12uGg81oeAt/gGVWORshVzvd8uihMted5SqdrZTM4s7J dXCfxWHH8S1y4amTsbGxYKn1YnN14mqnUaWLAIYPPJDwCxTQLkTM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:subject:message-id :mime-version:content-type:content-transfer-encoding; s=smtpout; bh=X2HaiiLAoMIqlTDyS8hfJXtejYs=; b=bwK0BXdNLRWR3o3X8cWi+NEb/4zJ 2XogfvqFA8ccfbW6+U5ol3ityEJgkmq54IR8wbQYi7P/DKF5IB4NM6yIFaELjzDO Zqrp4B1AmDceZfNJICScfVQg5euZm3YtfPObPfG9YqavOAVLS8uR/U523hG/OMcG IJ6DiG1OFNSU9Jo= X-Sasl-enc: fxV/y+/I2jl4XP+VZ6Yhy1Z1Sk0gTQrpHXNyPwTLyr1f 1361088411 Received: from shorty.local (unknown [76.169.247.77]) by mail.messagingengine.com (Postfix) with ESMTPA id 628CF4824A9 for <13713@debbugs.gnu.org>; Sun, 17 Feb 2013 03:06:51 -0500 (EST) Date: Sun, 17 Feb 2013 00:06:49 -0800 From: Dima Kogan To: 13713@debbugs.gnu.org Subject: Root cause Message-ID: <20130217000649.602fe891@shorty.local> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Score: 0.1 (/) X-Debbugs-Envelope-To: 13713 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) I looked at it some more, and it's pretty clear what's happening. The indentation command calls (c-determine-limit), which in turn calls (parse-partial-sexp) in many places. (parse-partial-sexp) fails if asked to look at the buffer outside of the narrowed region. Thus one way to fix this is to wrap the definition of c-determine-limit in (save-restriction (widen) ... ). This is a construct that already appears in many places in cc-engine.el, so maybe it's appropriate here. This advice makes it work: (defadvice c-determine-limit (around c-determine-limit-works-with-narrowing (how-far-back &optional start try-size) activate) "I lift the restriction around this function to get around emacs bug 13713" (save-restriction (widen) ad-do-it)) I don't know enough about the internal design of cc-engine.el to know if this is an appropriate place to lift the restriction, or if lifting it is the way to go at all. Thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Dec 01 05:04:59 2017 Received: (at 13713) by debbugs.gnu.org; 1 Dec 2017 10:04:59 +0000 Received: from localhost ([127.0.0.1]:39046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eKiBn-0006WX-EQ for submit@debbugs.gnu.org; Fri, 01 Dec 2017 05:04:59 -0500 Received: from mail-it0-f48.google.com ([209.85.214.48]:35234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eKiBl-0006WF-US; Fri, 01 Dec 2017 05:04:58 -0500 Received: by mail-it0-f48.google.com with SMTP id f143so1875045itb.0; Fri, 01 Dec 2017 02:04:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=BV0Y2qaNUL/fHF9EY1brJctefWLjq+brqKfj0CapElA=; b=arArQ9FK5tk6BzL32AfsIH6iVgMO4Zct+6rRsQruah5V/5Mdu6LFVYtahYlFEKOn1j D+Clkv616njN8Q4F0DmA2XWz7Gk7FGzCO6OJZkDmnM8zWLOkRn1rY8YVXqMSvLjYhD6R 7T7ehf0qT6JKwe+dj54QOdSrHq+pr2RX2+jPdSL63YoWa5iSyjF9UFeNHBFbYZKFc2IK pbzlbpWRpEFd1k7H3mEZ8GaLxuKJHEP2i5tdZddK4wQR6qSzX/2uE1RAQHC6jQtDsw8Z OpsKI8SoDPWb1uvrsUiDnr86liUS2rQc93XxzSUIoJik+UFUIQAJyCbr0FH+3jbR4Lg3 d4Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=BV0Y2qaNUL/fHF9EY1brJctefWLjq+brqKfj0CapElA=; b=GOJU4d/JjhYigv+6ZzOlV9FFihabXq+tG/+aYebBocGVZkbZBM4zMqC/k35isTOypG NW0/RmgRFktCYXjVAQdeTUa1+xJjINhMYuE2B3HDCH+6blhtPEylbuFqIjZNb9dVqO3C 5ruc4UdOu5EiOCQ306KQ7kcq/qNTr1uB+hjv83BWTnRlkYY9xFnAA6za+Ku15sCdRBFz taDqd1GOZrL2DUySqRnbrb7HiTT0HsW/njjbDYSWxog0l7L8cxF165E1ViddkdWhNJDl SlDbgx9HgAy85pvZgu9XTUBzS3aLpkJUJ/bHTeAiX/sMwqICj0GR2BNQorz4AEbnvkW6 YvZA== X-Gm-Message-State: AJaThX7lv7KIivwoum5xA5pQHG/J9dEBWHj5ECNMwSV0bCRvhcc7INSB OMviVTIapfNlJrTXt65uptG5lg== X-Google-Smtp-Source: AGs4zMaj5+J7zqBsc3oJJpVEbS8VZP0g8Vt+kbsWUrI7wz35Ji7/oIq0vLC/LhTM+JVyS7Uz0oyAGg== X-Received: by 10.36.4.144 with SMTP id 138mr1213507itb.78.1512122692386; Fri, 01 Dec 2017 02:04:52 -0800 (PST) Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id i133sm832629itf.1.2017.12.01.02.04.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Dec 2017 02:04:51 -0800 (PST) From: Noam Postavsky To: Dima Kogan Subject: Re: bug#13713: 24.3.50; C indent produces error when narrowing is active References: <87sj4znuhk.fsf@secretsauce.net> Date: Fri, 01 Dec 2017 05:04:50 -0500 In-Reply-To: <87sj4znuhk.fsf@secretsauce.net> (Dima Kogan's message of "Thu, 14 Feb 2013 00:57:11 -0800") Message-ID: <87o9nikblp.fsf@users.sourceforge.net> 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: 13713 Cc: 13713@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 (/) found 13713 25.3 tags 13713 fixed close 13713 26.1 quit Dima Kogan writes: > Hi. > > I'm observing an issue with emacs indentation in C mode when narrowing > is enabled. To reproduce, create a tst.c buffer with the following 3 > lines: > > // 123 > // 456 > // 789 > > I select the last 2 lines (456, 789), and narrow-to-region. Then I place > the point at the start of the 789 line, and press 'tab'. I get this: > > Debugger entered--Lisp error: (args-out-of-range 1 8) Seems to be fixed in emac-26. From unknown Sat Aug 16 18:42:59 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, 29 Dec 2017 12: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