From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Two questions about overlays Date: Tue, 21 Feb 2023 15:21:14 +0200 Message-ID: <838rgrtar9.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37326"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: dalanicolai Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Feb 21 14:22:01 2023 Return-path: Envelope-to: ged-emacs-devel@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 1pUSam-0009Ve-ET for ged-emacs-devel@m.gmane-mx.org; Tue, 21 Feb 2023 14:22:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pUSZu-0006vP-Cu; Tue, 21 Feb 2023 08:21:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUSZt-0006v6-54 for emacs-devel@gnu.org; Tue, 21 Feb 2023 08:21:05 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUSZs-0005r2-RF; Tue, 21 Feb 2023 08:21:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=f/ekWK043s1/bNObUN7kHeF0FTVozzBDIbnQzeXb3W0=; b=gZE1AxpFwkdO wSJuCBGDpkJoePvbZUnZXICIp71g4KxyCW9g8rizkWJ9mE3IO2kQAIqZuhIsSyr27nE7ceHIPU2xV kqd4qcdrshtnqj3MzUk0tYeXPQ4T4OGk6Mh8qcdTDHbnnxk3TG0KsdtfmgjOacu+fVyQ5uzW530Z2 UDw7nwthTn+ZHkVgqrCR8WFhgT+fK4/UChcfN1kriOqrnP9xTtVGWR55UnAyVYI8FI2MH/PQdhyWQ L4J4s1Ym2DYK95VQBJvY6n+wvYzhGcEbnUMGxtn/wC5Os/L6ZoetjQSW9qhjeI3FOsILEQl3KxSm9 1bmp5XDMW4WVkEJpAxKGQg==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pUSZs-0000jS-Ax; Tue, 21 Feb 2023 08:21:04 -0500 In-Reply-To: (message from dalanicolai on Tue, 21 Feb 2023 13:46:56 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:303642 Archived-At: > From: dalanicolai > Date: Tue, 21 Feb 2023 13:46:56 +0100 > > So now here are the questions: > > - when displaying multiple pages in columns, I would like to use the > overlays-in function to determine which overlays should display > images. So I am creating a full 'book roll' by giving the overlays a > size via the 'space' display property, after which I use overlays-in > to determine which overlays are actually visible. However, after it > takes some time for the 'space' display property to take effect, so I > am manuall adding a 'sit-for' with some reasonable delay > time. However, I would like to ask if there is someone has an idea for > a 'better' mechanism to wait until/detect if the 'overlay expansion' > has finished. > > If the explanation is not clear then please load the following file > and do 'M-x scrap-dir-images' on a directory that contains enough > images to not fit all on a single screen. It will print the number of > overlays found via 'overlays-in' directly after 'displaying the > images' (here by assigning the image as display property instead of > space). You will find it prints all overlays in the buffer (instead of > only the ones on screen). To find what I expect it to print now > (again) do 'M-: (overlays-in (window-start) (window-end))'. I did all that, and I still don't understand the question. In particular, your code doesn't call sit-for, so I'm unsure what exactly is the problem you are asking about here. > My second question is about the function 'overlay-recenter' I don't > really understand its docstring. What kind of 'overlay lookup' would > go faster? What is 'overlay-lookup' anyway? Looking up overlays that are relevant to a particular buffer position. But this function is a no-op in Emacs 29 and later, since the overlays were reimplemented in a way that makes it unnecessary to "center" the list of overlays. So you can forget about that and ignore this function.