From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.devel Subject: Re: Adding olivetti to GNU ELPA Date: Tue, 14 May 2019 18:05:15 +0200 Message-ID: <877eat58ec.fsf@fastmail.fm> 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> <875d1b0c-7f44-ba5d-4660-84637533b8f3@gmx.at> 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="85908"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: mu4e 1.3.2; emacs 26.2 Cc: martin rudalics , Eli Zaretskii , Stefan Monnier To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 14 18:07:50 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 1hQZy1-000MDP-Tk for ged-emacs-devel@m.gmane.org; Tue, 14 May 2019 18:07:50 +0200 Original-Received: from localhost ([127.0.0.1]:50512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZy0-0000Jq-O6 for ged-emacs-devel@m.gmane.org; Tue, 14 May 2019 12:07:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:35822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQZvl-0007D9-4T for emacs-devel@gnu.org; Tue, 14 May 2019 12:05:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQZvj-0003Jg-Ur for emacs-devel@gnu.org; Tue, 14 May 2019 12:05:29 -0400 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53715) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hQZvd-00039P-VG; Tue, 14 May 2019 12:05:22 -0400 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 5301026456; Tue, 14 May 2019 12:05:20 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 14 May 2019 12:05:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= references:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type; s=fm3; bh=92KGAmauol+0z7kIdoYdm5eVZc ZS3yyxMDgzEdKtkLY=; b=Hx/nI8kDcP7lFp6R7VAVXGW6+QoqUI965DA2G270Bn C2kseX3DFrzl+1vk1NTXM3BUDgt50m4XjpFYBSWkwzJRqyx++zIUuI4a/AbGaBMb H/xuFwwUifZ5VVrihq4z6mOOmfNmTHNteP5rYT0Ogg0A/m0MGobnUq3AUvK0ag+I QQEwqUee4rnJbR2hFzjH66VwkFAaTEvbWMu92Vf54DdVrzoH+jI37xzMmJrR2wnx 7DssvmBPmd2BA+8K4HhIkbSx53RX8rMH2cQQz/jTX2n15WespmJWixgxEPPiXxap BdZnCOEp0XXpKiwMQeiVVaIEz7cM5+xJcINTaEN/qRDQ== 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=92KGAm auol+0z7kIdoYdm5eVZcZS3yyxMDgzEdKtkLY=; b=T23b45igdSmeINk+zu9hm1 Y9cGTzQude/PslvAY17Ts8eyzJEQFt0qdYh7esbQPwSn9etI0QRcMyW+2oYjU8aJ c0nFxZV490hodFy/eB7gDzvQ6dWIMVDNfPTL7jTzfKrpJ5Tu01xQ7yB9kup3s7xn ExhHmigu6acEH0fYa9f43D4doZYhEj8eCk0k/M4DiSNa4WG+krtAbZyAkoC75Nay fcfngYiGZcXl+V7xFGAu7c6JY2XNDaH3LWyStVSUGj4vU9ckWiF0eovDEugW8lwr eOpNDte8RhZyu+xReubILK1UsN3FKpx0qyZvs0/nJ5kf30dExrbIDENnaKfy8GmQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrleeigdeljecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpehffgfhvffujgffkfggtgesthdtredttdertdenucfhrhhomheplfhoohhsthcu mfhrvghmvghrshcuoehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgrihhlrdhfmheqne cuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepuddvledrjedtrddutdehrddu geegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjohhoshhtkhhrvghmvghrshesfhgrsh htmhgrihhlrdhfmhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Original-Received: from Swift.fastmail.com (dhcp-129-70-105-144.dhcp.uni-bielefeld.de [129.70.105.144]) by mail.messagingengine.com (Postfix) with ESMTPA id 8D03580064; Tue, 14 May 2019 12:05:18 -0400 (EDT) In-reply-to: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.111.4.26 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:236510 Archived-At: On Tue, May 14 2019, Paul W. Rankin wrote: > (cond ((<= emacs-major-version 24) > (add-hook 'window-configuration-change-hook > 'olivetti--??? t t)) > ((<= emacs-major-version 26) > (add-hook 'window-configuration-change-hook > 'olivetti--??? t t) > (add-hook 'window-size-change-functions > 'olivetti--??? t t)) > ((<= 27 emacs-major-version) > (add-hook 'window-size-change-functions > 'olivetti--??? t t))) I have no idea if this helps (I'm not entirely sure if I correctly understand the issues you're facing), but FWIW, this is what I do in `visual-fill-column-mode` , which must solve essentially the same problem: ``` (defun visual-fill-column-mode--enable () "Set up `visual-fill-column-mode' for the current buffer." (add-hook 'window-configuration-change-hook #'visual-fill-column--adjust-window 'append 'local) (if (>= emacs-major-version 26) (add-hook 'window-size-change-functions #'visual-fill-column--adjust-frame 'append)) (visual-fill-column--adjust-window)) ``` So I use `window-configuration-change-hook` in every Emacs version and `window-size-change-functions` in Emacs >= 26. ISTR that it's not possible to forego `window-configuration-change-hook` in Emacs 26, but I can't remember why... I have at least one report of this working on Emacs 27, but I must admit that I'm running Emacs 26 myself, so perhaps there are problems this particular user doesn't care about. `visual-fill-column--adjust-frame simply calls `visual-fill-column--adjust-window` for every window on the relevant frame. In Emacs 27, this function must be in the global part of `window-size-change-functions`, because Emacs 27 changed the way the local part is called. `visual-fill-column-mode` could of course be adapted to use the local part of the hook, but there are more hooks involved with window size/config changes in Emacs 27 and I haven't looked into which ones I should use. `visual-fill-column--adjust-window` does the following: ``` (defun visual-fill-column--adjust-window () "Adjust the window margins and fringes." ;; Only run when we're really looking at a buffer that has v-f-c-mode enabled. See #22. (when (buffer-local-value 'visual-fill-column-mode (window-buffer (selected-window))) (set-window-fringes (get-buffer-window (current-buffer)) nil nil visual-fill-column-fringes-outside-margins) (if (>= emacs-major-version 25) (set-window-parameter (get-buffer-window (current-buffer)) 'split-window #'visual-fill-column-split-window)) (visual-fill-column--set-margins))) ``` So it has additional code for Emacs >= 25 to set the window parameter `split-window` to `visual-fill-column-split-window`, which unsets the margins before calling `split-window`. In addition, there is a function `visual-fill-column-split-window-sensibly`, which can be used as the value of `split-window-preferred-function`. It handles virtual splitting of windows with wide margins. HTH -- Joost Kremers Life has its moments