From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: split-window-right doesn't work with wide margins Date: Wed, 20 Jan 2016 20:43:57 +0100 Message-ID: <569FE37D.1050406@gmx.at> References: <87io2rgrom.fsf@fastmail.fm> <569CBEDE.1000806@gmx.at> <874me82yr1.fsf@fastmail.fm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020604010201080605070808" X-Trace: ger.gmane.org 1453319082 12778 80.91.229.3 (20 Jan 2016 19:44:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 Jan 2016 19:44:42 +0000 (UTC) Cc: emacs-devel To: Joost Kremers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 20 20:44:30 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aLyg9-000711-Fz for ged-emacs-devel@m.gmane.org; Wed, 20 Jan 2016 20:44:29 +0100 Original-Received: from localhost ([::1]:44840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLyg8-0001EM-Sy for ged-emacs-devel@m.gmane.org; Wed, 20 Jan 2016 14:44:28 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47831) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLyfp-0001CB-5s for emacs-devel@gnu.org; Wed, 20 Jan 2016 14:44:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLyfl-0002Zb-W5 for emacs-devel@gnu.org; Wed, 20 Jan 2016 14:44:09 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:52258) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLyfl-0002ZM-LZ for emacs-devel@gnu.org; Wed, 20 Jan 2016 14:44:05 -0500 Original-Received: from [192.168.1.100] ([212.95.7.100]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0MgL1q-1aXTgU1BPa-00Njga; Wed, 20 Jan 2016 20:44:00 +0100 In-Reply-To: <874me82yr1.fsf@fastmail.fm> X-Provags-ID: V03:K0:ANmKX6dZ6HVCyvVvUsTSMI7TCvDBXgdk8MEtwob2Rn5SRSylUkX eMJLc2XSZeDtO/WFmZDGhe5Tj1RNwtQu5NWHs1Rtuie0b43AUJkCv2kPfp3umLmKr/9w+NN LgQRWsERcBoiNgGzc/P82jWCtabJW9PxvRn8uBni/Tr1c3TkUkVuNWG7hW6Tz5hP+g4sX0m fDhFR7lGmUlZKdf6zoHDQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:g8vNbMpJsz0=:OqbSMrcVqwPjAjkbiiixoS q1UUnBf8VXse51OvgcjZFTKd8iPVychW/MhB67m3ejpUy/8pF/ri22lDRGWRqlX03iRWTfWcK By37ocNbNUjgIGI7SZdEu89RYNsVFdlSV2efbyUJQxupxnjS/awWr55lVRAniMZhTNnxiW32i D6ZT2w1nC4m0Ddmow2WUs0+FrpPKdYjbIbhZHsZM6r2RGQkBCBnPE0AdV73FyAHMCNlUJSv7g ta8aRFT3kFVLu9saGCfDK2Isq6tDib7INWh63/SFRi/lz2yiO5XzPL4R8yi0mkjUL9vNgbZhF VDrYcNPKGCrbddq41kALOm+fUhRd2tSAScxs2igfOMxMcMocJ77NvPZl7DhdBpBg+3PtCoYXW YUZQkE3waw49arzdlMCVZOOQsFWxzc7HKonrI+bNgByoNTX34BLJDpGaUhmrRbhVy7sq164XK VbTc5NZc/RaIDg23bQbX+LSTHrqN1HjSTn7mH80HAHaO4Dmm6kMzZ8ltaEIX0UtViYiwio8aG Dc6Z5llEkf2DuAWEaN4pl03/cHx7B6/81S7Vb0Phitqg4ulVmR+ZbqYDro63CyUA4dMIRhkKq mknknkO6kRuA/PerWun43mf5ein5YPbk1YwjDbVCO8DDm+MvHbvVb61ohOa6n5NpilYyBJ22x qfYgLqncGey8VI36gPF9hBMXH2r0ki+WOlMhyhyUochUTt09tOZy/z5SiUQQA5cmsNfa2RhNn 0oPlcyd8B07FJmKZfsqufwHNkL26HFE6OJYU/hPInXaEK8jkVXQcSvBSA9nTGG+DKSxlV8ZO X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.18 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198451 Archived-At: This is a multi-part message in MIME format. --------------020604010201080605070808 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable > `git bisect` points to commit 3477e27 `Complete pixelwise frame/window= > resizing, add horizontal scrollbar support.' I remember now. The situation is as follows: There is a common function =E2=80=98window-min-size=E2=80=99 which reports the minimum possible size= for each window. In the horizontal case this includes the window's margins. This function is used in virtually all size sanity checks, when resizing windows or frames, adding scroll bars, fringes or margins, or splitting windows as in the case at hand. Now we have two choices: Either we do count margins in this function. Then =E2=80=98split-window=E2=80=99 will fail as indicated in this report= =2E Or we do not count them. Then we will have to automatically cut margins down as we did previously. This will, however, affect user-set margins that are _not_ continuously refreshed via a hook. Suppose, for example, that you have a window on the left with user-set margins and drag the divider of that window to the left in order to show more contents of the window on the right. In this case you may lose the margins in the window on the left and Emacs won't restore them when you drag the divider back. >> Or write a =E2=80=98split-window-function=E2=80=99 which, when a wind= ow shall be split >> horizontally, first resets the margins of the original window to a sm= all >> value, calls the orginal =E2=80=98split-window=E2=80=99 and restores = the margins to some >> suitable value afterwards. > > I found a variable `split-window-preferred-function`, which is probabl= y > what you mean? Would it be possible to give that variable a buffer-loc= al > value and set it to a function that first resets the window margins an= d > then calls the default value of `split-window-preferred-function`? No. =E2=80=98split-window-preferred-function=E2=80=99 only affects =E2=80= =98display-buffer=E2=80=99. It does not affect =E2=80=98split-window=E2=80=99. I attached a possible= solution which is far from ideal. I hope you get the idea. A similar solution would be needed for =E2=80=98split-window-preferred-function=E2=80=99. Essenti= ally you would have to rewrite =E2=80=98split-window-sensibly=E2=80=99 with a reset/rest= ore mechanism around the (window-splittable-p window t) and (split-window-right) forms. Slightly more tricky ... Sooner or later we should find a way to dynamically insert some stretch space on the left and right of a window body without affecting the value of =E2=80=98window-margins=E2=80=99. martin --------------020604010201080605070808 Content-Type: application/emacs-lisp; name="window-margins.el" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="window-margins.el" KGRlZnVuIG15LXNwbGl0LXdpbmRvdyAod2luZG93IHNpemUgc2lkZSkKICAiLi4uIgogIChs ZXQgKChob3Jpem9udGFsIChtZW1xIHNpZGUgJyh0IGxlZnQgcmlnaHQpKSkKCW1hcmdpbnMg bmV3KQogICAgKHdoZW4gaG9yaXpvbnRhbAogICAgICA7OyBSZXNldCBtYXJnaW5zLgogICAg ICAoc2V0cSBtYXJnaW5zICh3aW5kb3ctbWFyZ2lucyB3aW5kb3cpKQogICAgICAoc2V0LXdp bmRvdy1tYXJnaW5zIHdpbmRvdyBuaWwgbmlsKSkKICAgIDs7IE5vdyB0cnkgdG8gc3BsaXQg dGhlIHdpbmRvdy4KICAgIChzZXQtd2luZG93LXBhcmFtZXRlciB3aW5kb3cgJ3NwbGl0LXdp bmRvdyBuaWwpCiAgICAodW53aW5kLXByb3RlY3QKCShzZXRxIG5ldyAoc3BsaXQtd2luZG93 IHdpbmRvdyBzaXplIHNpZGUpKQogICAgICAoc2V0LXdpbmRvdy1wYXJhbWV0ZXIgd2luZG93 ICdzcGxpdC13aW5kb3cgJ215LXNwbGl0LXdpbmRvdykKICAgICAgOzsgUmVzdG9yZSBvbGQg bWFyZ2lucyBpZiB3ZSBmYWlsZWQuCiAgICAgICh3aGVuIChhbmQgaG9yaXpvbnRhbCAobm90 IG5ldykpCgkoc2V0LXdpbmRvdy1tYXJnaW5zIHdpbmRvdyAoY2FyIG1hcmdpbnMpIChjZHIg bWFyZ2lucykpKSkpKQoKKGRlZnVuIG15LXNldC13aW5kb3ctbWFyZ2lucyAoJm9wdGlvbmFs IGZyYW1lKQogICIuLi4iCiAgKHdhbGstd2luZG93LXRyZWUKICAgKGxhbWJkYSAodykKICAg ICAobGV0ICgoc2l6ZSAoLyAod2luZG93LWJvZHktd2lkdGggdykgMykpKQogICAgICAgKHNl dC13aW5kb3ctcGFyYW1ldGVyIHcgJ3NwbGl0LXdpbmRvdyAnbXktc3BsaXQtd2luZG93KQog ICAgICAgKHNldC13aW5kb3ctbWFyZ2lucyB3IHNpemUgc2l6ZSkpKQogICBmcmFtZSBuaWwg J25vLW1pbmkpKQoKKGFkZC1ob29rICd3aW5kb3ctY29uZmlndXJhdGlvbi1jaGFuZ2UtaG9v ayAnbXktc2V0LXdpbmRvdy1tYXJnaW5zKQooYWRkLWhvb2sgJ3dpbmRvdy1zaXplLWNoYW5n ZS1mdW5jdGlvbnMgJ215LXNldC13aW5kb3ctbWFyZ2lucykK --------------020604010201080605070808--