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:05:13 +0200 Message-ID: <81e61ed6-27a3-dbdd-34fa-fda779d3e991@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="155957"; 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: Alan Mackenzie , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 14 15:06:04 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 1iVFl5-000eQ4-DV for ged-emacs-devel@m.gmane.org; Thu, 14 Nov 2019 15:06:03 +0100 Original-Received: from localhost ([::1]:58040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVFl4-0005Pw-8M for ged-emacs-devel@m.gmane.org; Thu, 14 Nov 2019 09:06:02 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40859) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVFkM-0005Nn-PI for emacs-devel@gnu.org; Thu, 14 Nov 2019 09:05:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVFkL-0007CY-FC for emacs-devel@gnu.org; Thu, 14 Nov 2019 09:05:18 -0500 Original-Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:38048) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iVFkL-0007Ap-5S for emacs-devel@gnu.org; Thu, 14 Nov 2019 09:05:17 -0500 Original-Received: by mail-wr1-x433.google.com with SMTP id i12so6607177wro.5 for ; Thu, 14 Nov 2019 06:05:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Rt3GZ4FYdw8gtNWsO2NryTQvm3qBE+3gaNrlA4pdxAo=; b=SVPJXWLZkcB0xVBdbrZSOLtBo+i+QuZwOqedq4nH1xD6yFa15zkDFxDxKqM6UB7Nsi t+sq/3t/fLCefW+Fl0VddlDWSUhGUmrJxV5Ftof+8pV/06mGZ20ZoleP3mGfyk5rdHt+ c25rGtojpBbXPhDK3A877F+HHjHlGZS3JvesVGeyAsBSmV8maGJjlcsXri6WYHjPTgwA Ek15K/O4qHZLLlvxH+mDoiru4oPKWR2Tq98CLPLnjckN7jTmxcwzUMiCqRqj9mpUKIT6 cb07S2pt2Mumtkn2Qw1g6UBv1iTACNjrVXff89QKagZYY70BeVsp6oV2rETSl+T8nY8p S9Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Rt3GZ4FYdw8gtNWsO2NryTQvm3qBE+3gaNrlA4pdxAo=; b=D+5KHzGRcOEvVIPe1IX5lWwHLdxUf5rhLGmIgyqwtMTiflqP/xuITj4dkX4zU50ksK 5ySmMqP8/EYBX/ypZZBMBkRHpDeiwqV/24M9aLnhtjQ2gePHOos2/zEItFhgHrYJH0RC Z5Cowi7UD1svZrBPHUYjB0WqeR+1D1xJ4joCQmAWEtYNZPfwbqIkIsH8suA19m6R+l7p HfTuBaVekDostzDwfCGD0yMSVOzba0u8S1aMyvuzZrsKXdHd9d4yZuFBtE77hhXHcOzf 55jLBGssnIT+gNBaimVZHQxKGMmQX1b/WfXkZvb2ufhL7tZr6wWNZ0QY0hGhjJZUZWFI vUCQ== X-Gm-Message-State: APjAAAXPCzQ4ianVuiNO7hafHNX3/Tm4KLJpU+qeQPk4eDBrIjwhZoWv f98eEPtTaBEp//7wt7X+OR77UONfK1w= X-Google-Smtp-Source: APXvYqybATwEugA6m8hxuJi+X5z8TsR2/RbUdJCPEr4kpvq5q4++oo9D7IDr1/xVxc6iicriDEJVag== X-Received: by 2002:a5d:4a85:: with SMTP id o5mr8795947wrq.109.1573740315430; Thu, 14 Nov 2019 06:05:15 -0800 (PST) Original-Received: from [192.168.0.149] ([109.110.245.170]) by smtp.googlemail.com with ESMTPSA id b196sm6622373wmd.24.2019.11.14.06.05.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Nov 2019 06:05:14 -0800 (PST) In-Reply-To: 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::433 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:242161 Archived-At: On 14.11.2019 15:42, Stefan Monnier wrote: >> ;; Return number of screen lines between START and END. >> (defun repos-count-screen-lines (start end) >> + ;; Make sure jit-lock doesn't have to run in a narrowed context. >> + (font-lock-ensure start end) >> (save-excursion >> (save-restriction >> (narrow-to-region start end) > > Hmm... the buffer might have font-lock disabled, in which case we'd > be fontifying where the user didn't want fontification. We could wrap it in (when font-lock-mode ...), then? Or something to that effect. > But I haven't followed the thread enough to know what we're talking > about, really. E.g. I have no idea what's the connection between > CC-mode, font-lock-dont-widen, and the above hunk. More specifically, > when looking at the above patch my first reaction is "if it's needed > here, why isn't it needed almost everywhere else as well?" The hope is that calling vertical-motion (or font-lock-ensure directly) inside narrowing is a rare occasion, and it doesn't happen in a lot of functions. At least that has been my experience.