From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#57266: Maintaining the base_line_number cache Date: Mon, 22 Aug 2022 08:41:41 -0400 Message-ID: References: <831qteccli.fsf@gnu.org> <834jy4bhqp.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26261"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 57266@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 22 14:43:02 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oQ6lh-0006YU-Jo for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Aug 2022 14:43:01 +0200 Original-Received: from localhost ([::1]:48648 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQ6lg-0003uX-4Y for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Aug 2022 08:43:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQ6kl-0003Ey-KQ for bug-gnu-emacs@gnu.org; Mon, 22 Aug 2022 08:42:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48520) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQ6kk-0002vb-86 for bug-gnu-emacs@gnu.org; Mon, 22 Aug 2022 08:42:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oQ6kj-0004qT-Ql for bug-gnu-emacs@gnu.org; Mon, 22 Aug 2022 08:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Aug 2022 12:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57266 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 57266-submit@debbugs.gnu.org id=B57266.166117211518610 (code B ref 57266); Mon, 22 Aug 2022 12:42:01 +0000 Original-Received: (at 57266) by debbugs.gnu.org; 22 Aug 2022 12:41:55 +0000 Original-Received: from localhost ([127.0.0.1]:38269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ6kc-0004q5-Q8 for submit@debbugs.gnu.org; Mon, 22 Aug 2022 08:41:55 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:31375) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQ6kY-0004pj-1i for 57266@debbugs.gnu.org; Mon, 22 Aug 2022 08:41:53 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 7193C100142; Mon, 22 Aug 2022 08:41:44 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0DD6E100091; Mon, 22 Aug 2022 08:41:43 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1661172103; bh=XFJV2Z66l8rnkirqPEBx1qt0vJkYur7BKwdrDVDaHn8=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=NLhBJ4Zn8ijBpvbTv7dLWDOg2wjdar6lPRWIFMB+Aryznt43F4qhjSksPC6+RboIW ZnVPTIutgi44x/4FKPflgk0yZvKZ3Q9ydC2MIGo6vc490EMdh/ge+IKhyhgvNT3rrt Iopnsxzj+/tFzf3D+XKocEO7hmZ8jQKLbqUS/Qn1FuCHgNkHB/GI5tpgl1j498W/F4 oUZS0oeFHlbSs2/DXSFm+eFoHiAR1CxYeBzCL3BCEYNAeyEovPxCHndOmnJYsv3DeM BuFb75aLCsNwt5Jw1uaKnalQtuNsZUUMnNFNCq8Omemu1ybey/xpv+5+E0PkHwmjWR 19Lj9ep0/uRUg== Original-Received: from pastel (unknown [45.72.195.111]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CBEF9120201; Mon, 22 Aug 2022 08:41:42 -0400 (EDT) In-Reply-To: <834jy4bhqp.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 22 Aug 2022 15:11:26 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:240418 Archived-At: >> I think the `!just_this_one_p` is important enough since the test isn't >> needed, and it otherwise prevents caching the base_line when a buffer is >> displayed in more than 1 window, which can slow down redisplay noticeably >> in such a case. > > I didn't just mean just_this_one_p thingy, I meant all the changes > that attempt to somehow "clean up" the use of the line-number cache. > Why do we have to do that at all? This stuff is not too complex, and > it works for ages! Isn't the fact that we find more and more small > issues with the changes telling you something? Yes, it's telling me that the code is a mess and I'm trying to fix it by documenting what is actually needed. >> It's not necessary because the only way the cache can be out of date >> if when either clipping or buffer text or w->contents is changed and >> that is already taken into account. > What about the w->last_overlay_modified part, which window_outdated > takes into account? Overlays have no influence over the line number count, because the base_line cache only counts real \n characters, not display lines. > Once again, I'd prefer that we didn't touch working code, which Code we don't dare to change is a problem we should fix. > nowadays supports at least 3e features: the mode-line display, the > display-line-numbers mode, and the line-number-at-pos function and its > callers. AFAIK it's not used (yet) in `line-number-at-pos`. Stefan