From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#29279: Sharing the margins Date: Mon, 13 Nov 2017 17:46:37 +0200 Message-ID: <83375imbaa.fsf@gnu.org> References: <0a54e927-cab1-1f1d-4996-85bb36949a33@yandex.ru> Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1510588115 24827 195.159.176.226 (13 Nov 2017 15:48:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Nov 2017 15:48:35 +0000 (UTC) Cc: 29279@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Nov 13 16:48:30 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEGyJ-0005zG-1Q for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Nov 2017 16:48:27 +0100 Original-Received: from localhost ([::1]:55061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEGyQ-0007LT-FR for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Nov 2017 10:48:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEGx0-0006RQ-Tt for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2017 10:47:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEGwx-00025b-Ji for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2017 10:47:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58289) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eEGwx-00025W-GB for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2017 10:47:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eEGww-0000Pv-6y for bug-gnu-emacs@gnu.org; Mon, 13 Nov 2017 10:47:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Nov 2017 15:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29279 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 29279-submit@debbugs.gnu.org id=B29279.15105880031577 (code B ref 29279); Mon, 13 Nov 2017 15:47:02 +0000 Original-Received: (at 29279) by debbugs.gnu.org; 13 Nov 2017 15:46:43 +0000 Original-Received: from localhost ([127.0.0.1]:38737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEGwb-0000PK-Dg for submit@debbugs.gnu.org; Mon, 13 Nov 2017 10:46:43 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:58052) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eEGwZ-0000P9-TN for 29279@debbugs.gnu.org; Mon, 13 Nov 2017 10:46:40 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eEGwQ-0001va-Jh for 29279@debbugs.gnu.org; Mon, 13 Nov 2017 10:46:34 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eEGwQ-0001vW-G5; Mon, 13 Nov 2017 10:46:30 -0500 Original-Received: from [176.228.60.248] (port=1665 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1eEGwP-0007aG-Va; Mon, 13 Nov 2017 10:46:30 -0500 In-reply-to: <0a54e927-cab1-1f1d-4996-85bb36949a33@yandex.ru> (message from Dmitry Gutov on Mon, 13 Nov 2017 01:51:53 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:139830 Archived-At: I tend to like better the proposal originally made by Joost Kremers in http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01540.html. Here it is with slight variations of my own: We add 3 new functions: (defun window-margin-add (window side symbol cols &optional ordinal) "Request allocation of COLS columns of WINDOW's marginal area. WINDOW must be a live window and defaults to the selected one. SIDE is the window side, either `left' or `right', in whose margin the allocation is requested. SYMBOL identifies the request, in case the allocation needs to be changed or deleted. ORDINAL is the optional ordinal number of the requested area, counted from left to right. Negative ordinal numbers count from right to left. Zero means the value of COLS is the maximum width of the marginal area, and no separate allocation is requested. Value is the actual positive ordinal number of the allocated area." (defun window-margin-remove (window side symbol) "Remove a previously allocated part of WINDOW's marginal area. WINDOW must be a live window and defaults to the selected one. SIDE is the window side, either `left' or `right', in whose margin the removal is requested. SYMBOL identifies the request to be deleted." (defun window-margin-modify (window side symbol cols) "Modify a previously allocated part of WINDOW's marginal area. WINDOW must be a live window and defaults to the selected one. SIDE is the window side, either `left' or `right', in whose margin the modification is requested. SYMBOL identifies the request to be modified." The details of the allocated portions of the marginal area are maintained in window parameters `left-margin-params' and `right-margin-params', which are modified by those 2 functions. The display engine uses these parameters to calculate the number of the portions and the width of each one of them, and pre-allocates them in the window's glyph matrices whenever a redisplay follows a change in margin allocation. The display spec for display in the margins will include the symbol of the allocated portion pertaining to the display spec. Like this: '(display ((margin left-margin 'toto) STRING)) If the stuff (text, image, etc.) to be displayed in a specified portion of the marginal area is too wide and doesn't fit the width of the portion, it will be truncated; if it is narrower, it will be padded. This keeps the display engine design intact, and I think will allow relatively straightforward implementation (although some non-trivial changes in management of the glyph matrices will be necessary). It can also be implemented in a way that keeps backward compatibility with the current APIs. WDYT?