From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: "Paul W. Rankin" Newsgroups: gmane.emacs.devel Subject: Re: Adding olivetti to GNU ELPA Date: Thu, 09 May 2019 16:54:48 +1000 Message-ID: References: <83tvemzcn2.fsf@gnu.org> <9bb5fc63-61ae-44dc-a8d5-b67803eab1e5@www.fastmail.com> <83h8amz24g.fsf@gnu.org> <24cca761-36ea-4c16-bce1-e3651aad52c8@www.fastmail.com> <83ftq6yx5o.fsf@gnu.org> <83ftppii16.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="63852"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.2.0; emacs 26.2 Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 09 08:55:42 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hOcxx-000GTR-Bb for ged-emacs-devel@m.gmane.org; Thu, 09 May 2019 08:55:42 +0200 Original-Received: from localhost ([127.0.0.1]:49264 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOcxw-0003WR-6I for ged-emacs-devel@m.gmane.org; Thu, 09 May 2019 02:55:40 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:56066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hOcxL-0003WI-Ai for emacs-devel@gnu.org; Thu, 09 May 2019 02:55:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hOcxK-0007IP-3G for emacs-devel@gnu.org; Thu, 09 May 2019 02:55:03 -0400 Original-Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:48369) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hOcxH-0007EG-CO; Thu, 09 May 2019 02:54:59 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 78AD7378; Thu, 9 May 2019 02:54:56 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Thu, 09 May 2019 02:54:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paulwrankin.com; h=references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; s=fm3; bh=Z7fFloxf0uvUeG0fxacbqF1BPo 2s4oKhz3QgcKmU5tA=; b=Mwh8NLhOYXDJb5y99GIDK5HVPpc9BdslsHKpz/ADhK P0Rezg3xhTYiWZKqgI+DDQ1d9bd+OfU73yZFLSCN9x5KQBP0geUiUeXXyUfIhD+M xsgybg7iERx8UpkLTko4FkMqitYVizj+LugkowCxnqvKLMcMq4p1kCaTOInuPRkv ueWLmN0m31NG64CDmzWsHXe06LbbnMWahcDzF/ylKjwiKboUNcJWpCURVd3zcVmQ mb2/FFC3CNrAlXtSqyf8hHZTvg4AqD4edUk9xkL1DRarASQq6hqxfCm5yKH6Smax C3Mm8MDUZoLjT04Oqhs96ELQpTxA6rAsVNe1U3q5JDqA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=Z7fFlo xf0uvUeG0fxacbqF1BPo2s4oKhz3QgcKmU5tA=; b=ZxmyN3XtfUQjMeTFXKHQYE CjwfYBhkaFnKPP1plok5zzizUe7cyKb/NrJnvfunUfR9LBSxBlI3pV7vyqo5qk2g MSLEFntO8zR3aYXcy06pjaUcmVl4JbkEDiLBWIzjMFv/7YdGT9UIb7/YjgfJqH45 WzxGyUvlhkEIYs3ihZBkCMdgBmiO4qhLECORI3a1JaMBcLJCvyGFn8wrDaVrcIYb U3EU0h47IHlTS7KrUlaK432vPdCPVhGNyuxHL17WBAqPpTK2MpAVjKFtDTaw1++t PSzsAzkWg8cOoMsVW8yR4Zju0jc7RMVXvnwEVXGtrJZx4tL4fACSCsxhdaPPhSrA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrkeeggdduudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvufgjfffkgggtsehttdertddtredtnecuhfhrohhmpedfrfgruhhl ucghrdcutfgrnhhkihhnfdcuoehhvghllhhosehprghulhifrhgrnhhkihhnrdgtohhmqe enucffohhmrghinhepphgruhhlfihrrghnkhhinhdrtghomhenucfkphepvddtvddrkeei rdefvddrudegtdenucfrrghrrghmpehmrghilhhfrhhomhephhgvlhhlohesphgruhhlfi hrrghnkhhinhdrtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Original-Received: from localhost (unknown [202.86.32.140]) by mail.messagingengine.com (Postfix) with ESMTPA id D4E6480062; Thu, 9 May 2019 02:54:54 -0400 (EDT) In-reply-to: <83ftppii16.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 64.147.123.21 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236325 Archived-At: On Wed, May 08 2019, Eli Zaretskii wrote: >> From: "Paul W. Rankin" >> Cc: emacs-devel@gnu.org >> Date: Wed, 08 May 2019 14:07:24 +1000 >> >> I'm sorry to say but this goes a bit over my head... From Emacs 24 - >> 27 >> there seem to be three hooks that have shifting/overlapping >> capabilities. The hooks are: >> >> - window-configuration-change-hook >> - post-command-hook >> - window-size-change-functions >> >> When I first created the minor mode, window-configuration-change-hook >> was enough for all situations I encountered. > I agree that we have a royal mess with these hooks. And if you think > the above 3 are all of it, then, unfortunately, they aren't: there are > also pre-redisplay-functions and window-scroll-functions -- those may > be necessary if your mode needs to pay attention to when the screen > space used by line numbers changes, either because the buffer is > scrolled past the point where the line numbers need more or less > digits than before, or because the user customizes the line-number > face in a way which changes the font used by the face, with your mode > already active. > > I'd like to try to help you, but I'm not sure I understand the problem > well enough. Are you asking whether what you did could be simplified > by using less hooks? Or are you saying that the current code doesn't > yet handle well some situations? In the latter case, could you please > describe those problematic situations? I think there are three separate but perhaps related problems. At its most basic, olivetti is really just a single main function, which could be distilled to: (set-window-margins (current-window) (/ 2 (- (window-width) olivetti-body-width))) There are some other ancillary functions, but really it's just a case of running this function in all windows displaying the current buffer when olivetti-body-width changes or when the window width changes. For compatibility with changes in Emacs 25.x, we also reset the margins to 0 before any window splitting, to prevent the combined window width being too large to split. So the three problems I'm running into are: 1. Some users have complained of lagging input, which seems to be due to olivetti setting the margins too often, i.e. on too many hooks. So using the minimal number of hooks is preferable. 2. But I've experienced olivetti failing to set the margins during a few common cases, e.g.: - splitting window with icomplete "*Completions*" buffer - splitting window with ispell-word "*Choices*" buffer - splitting window with magit-status - splitting window vertically with any buffers in a side-window in the same frame (which results in window being too large to split -- I think this is a separate issue) It would be nice to achieve consistency with these. 3. Issues scrolling with display-line-numbers-mode, but I don't mind about this. >> I *think* what is needed is a way to apply the hooks contingent on >> emacs-major-version <= 24 and <= 25 or 26(?) and <= 27. > > Yes, and there's nothing wrong with that for a package that wants to > support multiple Emacs versions. My difficulty is that I don't understand enough how these hooks have changed from 24 -> 27. Stefan tried to explain it to me, but... I still didn't get it :( -- https://www.paulwrankin.com