From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049. Date: Thu, 14 Nov 2019 16:37:50 +0200 Message-ID: <03042d05-2160-77c4-9abd-b0f13f638247@yandex.ru> References: <20191109144026.20810.76129@vcs0.savannah.gnu.org> <20191109144027.DDC3720927@vcs0.savannah.gnu.org> <38328d99-23c8-7ba7-a23d-e70ac0aab67a@yandex.ru> <20191111203445.GA5135@ACM> <7497e71d-bab6-fa04-bbc4-f52fadeda16d@yandex.ru> <20191113211936.GB4942@ACM> <6fc930a1-eb47-9e54-8752-8cf7ff041586@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="26414"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 14 15:38:44 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iVGGi-0006lk-4z for ged-emacs-devel@m.gmane.org; Thu, 14 Nov 2019 15:38:44 +0100 Original-Received: from localhost ([::1]:58284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVGGg-0003Mm-Qa for ged-emacs-devel@m.gmane.org; Thu, 14 Nov 2019 09:38:42 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50551) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVGGZ-0003Me-Su for emacs-devel@gnu.org; Thu, 14 Nov 2019 09:38:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVGGY-0001EL-WB for emacs-devel@gnu.org; Thu, 14 Nov 2019 09:38:35 -0500 Original-Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:45140) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iVGGY-0001D3-OF for emacs-devel@gnu.org; Thu, 14 Nov 2019 09:38:34 -0500 Original-Received: by mail-wr1-x42c.google.com with SMTP id z10so6713571wrs.12 for ; Thu, 14 Nov 2019 06:38:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=T/11CZbioLlax/hc1h2RU5Md46w0iq6ID3RpcVEco2I=; b=KlaZM+ZcRfcsAED2vFpRGOM8mcezB+uARJvoFbhz9txTdWiexvfYcnRbY3plF7S//m Feid+VImTHdZ4PLRQAWf+4dU/7aoBTd/ESRZm2YXSJaN1XQBLwY9pdJSYgbPOzljbXrF NXg2u+sO18kptieZaS083DRFgStgAmgFY36UVW7ALP98OxJFtOgNtvbgZPaZyv+YzokH /wrGej7X3n51LJTjwra+P3iksXnN3RExuhk/w3RxO7up0NDyhY834qqXISr6zOYWW290 7l35OQIrxdHm8r8dHekELhgW4cSCEUGh2jRyFX40pNL8p8M97rTtOWBsTo6r0uoUWCie 58vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:cc:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=T/11CZbioLlax/hc1h2RU5Md46w0iq6ID3RpcVEco2I=; b=tU8vkY5vh9zxSm1r5KKlLtQMUgyl5CqvbLufohaiZYIkTdevxA7KA8HSRPc1ohvLhj ihIobAEbRss5VzavBqKh8MAOyOrOntHhiqqV27eIauKt177nax0RD0iuZhtzIVmv9CtA LPJeVjGe86XelG/D1kPiSENO2rKlN77pWNaIHdN4mN7ccMorWYZ06KFb0YaLfXpIyP8g j+dIvj538jTYZS97TSejMBlimzMQE0bW+3jEr8LJ/+RjpUf7/msCG6PZojcyX+XIOFlA 3G6Klh1FecyIPdY9Zc4w+ciILMeiahiq2agNJTovyIvzsWiJre9yMBxdDHRD6l/Gw8Jn vZ9w== X-Gm-Message-State: APjAAAXeD4G0h+ZEVQZWCfU7CZWOCp6XTQFTfEjuNXzNADa++AbI/v4Q 1CPMCBLn25JfH7boNorHyifOovyhFSw= X-Google-Smtp-Source: APXvYqy5yAVdlYLeTnAqSbpTAI++AqAWGt1BGs5lW/3VPKWv+viSXbRlQ9/j1vzJWfohzOpQfjddyw== X-Received: by 2002:adf:f60a:: with SMTP id t10mr8452812wrp.29.1573742313441; Thu, 14 Nov 2019 06:38:33 -0800 (PST) Original-Received: from [192.168.0.149] ([109.110.245.170]) by smtp.googlemail.com with ESMTPSA id g5sm6733717wma.43.2019.11.14.06.38.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 06:38:32 -0800 (PST) In-Reply-To: <6fc930a1-eb47-9e54-8752-8cf7ff041586@yandex.ru> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::42c 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:242173 Archived-At: On 14.11.2019 0:33, Dmitry Gutov wrote: > > Very interesting, thank you. I wonder if the patch below would fix it as > well. BTW, here's an alternative patch. If CC Mode is fine with only seeing the beginning of the buffer until point (for the purpose of maintaining its caches), this should work just as well, and it won't have to add a (widen) call itself. diff --git a/lisp/reposition.el b/lisp/reposition.el index 22f9986efb..5d9c3180ad 100644 --- a/lisp/reposition.el +++ b/lisp/reposition.el @@ -174,8 +174,8 @@ reposition-window (defun repos-count-screen-lines (start end) (save-excursion (save-restriction - (narrow-to-region start end) - (goto-char (point-min)) + (narrow-to-region (point-min) end) + (goto-char start) (vertical-motion (- (point-max) (point-min)))))) ;; Return number of screen lines between START and END; returns a negative