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#56682: locked narrowing Date: Wed, 17 Aug 2022 15:38:46 -0400 Message-ID: References: <83edxgfi75.fsf@gnu.org> <5e3c3081-f098-8140-c767-b895c32bf30b@yandex.ru> <835yisffil.fsf@gnu.org> <831qtgff78.fsf@gnu.org> <83zgg4dw4y.fsf@gnu.org> <83r11gdrr4.fsf@gnu.org> <83edxfds7s.fsf@gnu.org> <83r11fc80o.fsf@gnu.org> <83o7wjc6o2.fsf@gnu.org> <83lernc5gu.fsf@gnu.org> <83k076dd7d.fsf@gnu.org> <83ilmqdcgc.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="8495"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: 56682@debbugs.gnu.org, gregory@heytings.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 17 21:39:20 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 1oOOsp-0001zp-La for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Aug 2022 21:39:19 +0200 Original-Received: from localhost ([::1]:55382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oOOso-0003jv-Cq for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Aug 2022 15:39:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36244) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oOOsY-0003iS-85 for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2022 15:39:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oOOsX-0000nc-VL for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2022 15:39:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oOOsX-0003Sz-Po for bug-gnu-emacs@gnu.org; Wed, 17 Aug 2022 15:39: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: Wed, 17 Aug 2022 19:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56682 X-GNU-PR-Package: emacs Original-Received: via spool by 56682-submit@debbugs.gnu.org id=B56682.166076514113316 (code B ref 56682); Wed, 17 Aug 2022 19:39:01 +0000 Original-Received: (at 56682) by debbugs.gnu.org; 17 Aug 2022 19:39:01 +0000 Original-Received: from localhost ([127.0.0.1]:53102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oOOsW-0003Sh-Id for submit@debbugs.gnu.org; Wed, 17 Aug 2022 15:39:00 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:15265) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oOOsQ-0003SO-UI for 56682@debbugs.gnu.org; Wed, 17 Aug 2022 15:38:58 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 4C308100138; Wed, 17 Aug 2022 15:38:49 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 9BD7E100091; Wed, 17 Aug 2022 15:38:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1660765127; bh=HntgiW4yVrVJloq/80SRGcjc38+rwBqQBgwPgdsRKcw=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fsR8q9mnNSzavomFKNnBmTnTkpxh1fKV1NwaGq7U5mIwvLOVA+7YNDAxfPWRovzoM +2jO6La1wKaksXDzo1eZB1sBw0ThbRzb/thBr31wHcBuvB0HvLhb3kWzjQlaoj5TlD spLmJRxHWEe8CiNObcpAVIbAv37owLDZSGKOuV/Vu1g5g1qcN9+SMDvR3GzRPDkDAr tXmX/lTOgMIoxwCDHcNN5O97ggLtTllQt0LcZucUx6/NDQ7+bH39QEdontLdu0HSRC W8Zs8Pu7Nn2rvddpAAnbdaZvUiA1ZjDmOYKSn+JEGdoRuvAhoiA/MtN7ABG/F/xLQX 5ZDHAwVs6pYVg== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8BC2E1202FC; Wed, 17 Aug 2022 15:38:47 -0400 (EDT) In-Reply-To: <83ilmqdcgc.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 17 Aug 2022 20:09:07 +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:240109 Archived-At: > And another thought: did you try using format-mode-line as the means > to get the line number from which you could start? Yes, but in my tests, it wasn't any faster. BTW, while I have now found which code flushes the base_line cache during redisplay (there are a few different places, in `redisplay_window` and `try_scrolling` (not sure why it needs to be done at more than one place, tho)), I still haven't found where that cache gets flushed or ignored for the case where it's used for `format-mode-line`. That code doesn't seem to pay attention to BEG_UNCHANGED nor even to the changes in narrowing. Oh... wait... aha! I still don't know how it handles buffer modifications, but I now know that it just fails to pay attention to changes to the narrowing: so, it's no surprised that I couldn't find the corresponding flushing code, it's just missing: emacs -Q lisp/subr.el M-> M-: (list (format-mode-line "%l") (save-restriction (narrow-to-region (+ (point-min) 4000) (point-max)) (format-mode-line "%l"))) returns twice the same line number. Stefan