GNU bug report logs - #57266
Maintaining the base_line_number cache

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Wed, 17 Aug 2022 21:20:02 UTC

Severity: normal

Tags: patch

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: Maintaining the base_line_number cache
Date: Wed, 17 Aug 2022 17:18:44 -0400
[Message part 1 (text/plain, inline)]
Tags: patch

Based on the recent discussion around counting lines, I proposed the
patch below.  Part of it aims to just document the way in which
the `w->base_line_number` cache is maintained, but it goes further,
fixing the problem with format-mode-line and narrowing I discovered
and simplifying some of the code based on the new understanding of how
the cache is supposed to work.


        Stefan


2022-08-17  Stefan Monnier  <monnier <at> iro.umontreal.ca>

    * src/xdisp.c (BASE_LINE_NUMBER_VALID_P): New macro.
    (try_scrolling): Use it.  Ignore `just_this_one_p` because it was
    too pessimistic.
    (redisplay_window): Remove `buffer_unchanged_p`, not used any more.
    Check BASE_LINE_NUMBER_VALID_P once and for all at the beginning and
    don't rely on other side-information that is only correlated with
    BASE_LINE_NUMBER_VALID_P to decide when to flush this cache.
    (decode_mode_spec): Check `BASE_LINE_NUMBER_VALID_P` before using
    the cache.

    * src/window.c (set_window_buffer): Flush the `base_line_number` cache.


In GNU Emacs 29.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.16.0)
 of 2022-08-15 built on lechazo
Repository revision: 5564f72d5b3e2f162f52d935c077f6ea15fb60b7
Repository branch: work
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure -C --enable-checking --enable-check-lisp-object-type --with-modules --with-cairo --with-tiff=ifavailable
 'CFLAGS=-Wall -g3 -Og -Wno-pointer-sign'
 PKG_CONFIG_PATH=/home/monnier/lib/pkgconfig'

[base_line.patch (text/patch, attachment)]

This bug report was last modified 2 years and 297 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.