From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: overlays and movement Date: Tue, 28 Jun 2022 12:39:38 +0200 Message-ID: <877d5183l8.fsf@gnu.org> References: <87tu855eqs.fsf@elite.giraud> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8437"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.7.28; emacs 29.0.50 Cc: help-gnu-emacs@gnu.org To: Manuel Giraud Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 28 12:54:22 2022 Return-path: Envelope-to: geh-help-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 1o68rN-000214-Vh for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 28 Jun 2022 12:54:22 +0200 Original-Received: from localhost ([::1]:53306 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o68rM-0007WU-Jd for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 28 Jun 2022 06:54:20 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33176) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o68nD-0003Ii-0J for help-gnu-emacs@gnu.org; Tue, 28 Jun 2022 06:50:03 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:56068) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o68nB-0005ek-O5; Tue, 28 Jun 2022 06:50:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-reply-to:Date:Subject:To:From: References; bh=R2tnyEzqfabOGcllXbz2zii/klP2zuAvPjlED3YeStQ=; b=WgnRQNmvcnw7xe pa83yadjLWnL4b5NphuzDHVaR5fxOOOvR56fahoVHGX0cBKqy70UewoBRGIv4MMDWpo+rYhLGLjHk qf59zKQ7rZ9u1wDsXa8cuxac+OOp/DGTVMO1r7exUDgglOHYh54yHnGP0V9MdsAzJN5kFj0mKeCyN gZw6+wFxhbnYRVGutuAywHka59oKZMkvUVVI3SaEy3guWEE4RRY/k1lWLb8APlMKKKJaejKcL5d3S eFKVhP8ukGVk1MwhGpbcZvPgqq5JEzuoZYvabOFLk2Ff6COG9qMENVCpzf+Pe308dZnkOJXJGjiSA HGzv9PZdeXu+4grgGo3A==; Original-Received: from auth1-smtp.messagingengine.com ([66.111.4.227]:33165) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o68n8-0003Hm-M3; Tue, 28 Jun 2022 06:50:01 -0400 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id 131AB27C0054; Tue, 28 Jun 2022 06:49:58 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 28 Jun 2022 06:49:58 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudegjedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvvefuffgjkfggtgesthdtredttdertdenucfhrhhomhepvfgrshhs ihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucggtffrrghtthgvrhhnpe dujedtheduvdelffejkeetgedvheelhedvueefhfeukeekkeehvdfggeegffevgfenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnod hmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedv leekqdhtshguhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhm X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 28 Jun 2022 06:49:57 -0400 (EDT) In-reply-to: <87tu855eqs.fsf@elite.giraud> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138156 Archived-At: Manuel Giraud writes: Hi Manuel, > I'd like to have some overlays (just 2 in fact) that have to be > updated each time I'm moving into the buffer. What does that mean exactly? Do you mean "the position of point changes in that buffer" or "the buffer becomes shown in a window"? If it's the former, I'd use a buffer-local post-command-hook checking if point moved by comparing to the former value and recording that. If it's the latter, a buffer-local window-configuration-change-hook. If you only need to update the overlays when the buffer contents have changed, then after-change-functions are your friend. > I have tried to add a hook on `post-command-hook'. It kind of works > but it seems to lag sometimes and the docstring says that this is a > bad idea anyway. It says it's a bad idea for expensive functions. But when you can cheaply detect that nothing has to be done in most of the cases and you do it buffer-locally, it won't be too bad, I guess. Bye, Tassilo