GNU bug report logs - #28771
26.0.60; A couple space display property feature requests

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Alex <agrambot@HIDDEN>; dated Tue, 10 Oct 2017 00:22:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 28771 <at> debbugs.gnu.org:


Received: (at 28771) by debbugs.gnu.org; 11 Oct 2017 15:37:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 11 11:37:46 2017
Received: from localhost ([127.0.0.1]:34385 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1e2J4s-0006AB-9Q
	for submit <at> debbugs.gnu.org; Wed, 11 Oct 2017 11:37:46 -0400
Received: from eggs.gnu.org ([208.118.235.92]:48498)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1e2J4q-00069y-Mc
 for 28771 <at> debbugs.gnu.org; Wed, 11 Oct 2017 11:37:44 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1e2J4g-0004rO-OY
 for 28771 <at> debbugs.gnu.org; Wed, 11 Oct 2017 11:37:39 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52306)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1e2J4g-0004rK-Kt; Wed, 11 Oct 2017 11:37:34 -0400
Received: from [176.228.60.248] (port=4542 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1e2J4g-000174-4b; Wed, 11 Oct 2017 11:37:34 -0400
Date: Wed, 11 Oct 2017 18:37:21 +0300
Message-Id: <83inflofv2.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: agrambot@HIDDEN
In-reply-to: <83r2u9on5h.fsf@HIDDEN> (message from Eli Zaretskii on Wed, 11
 Oct 2017 15:59:54 +0300)
Subject: Re: bug#28771: 26.0.60;
 A couple space display property feature requests
References: <87fuarc0px.fsf@HIDDEN> <83efqbqz1n.fsf@HIDDEN>
 <87tvz6dh26.fsf@HIDDEN> <83k202q0k8.fsf@HIDDEN>
 <87bmled788.fsf@HIDDEN> <83r2u9on5h.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 28771
Cc: 28771 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Would your problems be solved if we provided a function to return the
pixel-width of all the window decorations on the specified side (left
or right) of the window?  Then you could use this function in your
display specs to produce the whitespace of the width you want.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28771; Package emacs. Full text available.

Message received at 28771 <at> debbugs.gnu.org:


Received: (at 28771) by debbugs.gnu.org; 11 Oct 2017 13:00:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 11 09:00:35 2017
Received: from localhost ([127.0.0.1]:33158 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1e2Gck-0004c1-VJ
	for submit <at> debbugs.gnu.org; Wed, 11 Oct 2017 09:00:35 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56908)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1e2Gcj-0004bo-CI
 for 28771 <at> debbugs.gnu.org; Wed, 11 Oct 2017 09:00:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1e2GcY-000661-Cj
 for 28771 <at> debbugs.gnu.org; Wed, 11 Oct 2017 09:00:28 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:48781)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1e2GcY-00065m-99; Wed, 11 Oct 2017 09:00:22 -0400
Received: from [176.228.60.248] (port=4418 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1e2GcW-0007RH-2e; Wed, 11 Oct 2017 09:00:21 -0400
Date: Wed, 11 Oct 2017 15:59:54 +0300
Message-Id: <83r2u9on5h.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Alex <agrambot@HIDDEN>
In-reply-to: <87bmled788.fsf@HIDDEN> (message from Alex on Tue, 10 Oct 2017
 15:27:03 -0600)
Subject: Re: bug#28771: 26.0.60;
 A couple space display property feature requests
References: <87fuarc0px.fsf@HIDDEN> <83efqbqz1n.fsf@HIDDEN>
 <87tvz6dh26.fsf@HIDDEN> <83k202q0k8.fsf@HIDDEN>
 <87bmled788.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 28771
Cc: 28771 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

> From: Alex <agrambot@HIDDEN>
> Cc: 28771 <at> debbugs.gnu.org
> Date: Tue, 10 Oct 2017 15:27:03 -0600
> 
> To get an idea evaluate:
> (setq header-line-format
>       (concat (propertize " "
>                           'display
>                           '(space :align-to 0))
>               "test"))
> 
> The start of "test" is what I mean by the "left" of the "text-area".

Actually, my understanding is that 'left' is the number of pixels from
the left edge of the window to the start of "Test".  IOW, it's a pixel
width, not a position.  Right?

> For clarification, what you should see is 1 space before and 1 space
> after "Test", each the same pixel width as the left fringe.

Actually, by "space" you mean space displayed with 'highlight' face,
right?  Because there's a lot of "other" space in the header-line, but
you don't mean that space.  That's what tripped me originally.

> What should happen is that if you toggle the fringes/margins, then the
> spaces shrink and grow accordingly, with the exception of faulty
> scroll-bar width calculation. Using '(space :width left) does not have
> this faulty calculation.
> 
> The point is that the before/after stretch whitespace must have equal
> lengths at all times, regardless of fringe/margin/line-number/scroll-bar
> statuses.
> 
> > And again, this is limited to header-line, right?
> 
> I believe so (and the mode-line).

So what is the purpose of having the header-line or mode-line text
move relative to buffer text when some window decorations are
enabled/disabled or moved from left to right?  IOW, why did you need
the "space" on both sides of "Test" to be of the same pixel width,
independently of the scroll-bar position?  Right now, "Test" moves
together with buffer text, and so is always aligned with it, no matter
which side is the scroll bar on.  Why is that not TRT?

> >> 2. Suppose you want to align a string to the right edge of the window.
> >
> > What is "the right edge of the window" in this context?
> 
> The very ends of the window shown in the art in "(elisp) Window Sizes"
> (i.e., past RD).

Again, why do you need that?  Also, why cannot you use the existing
functions that return dimensions of the window and its decorations?

> > If you are talking only about header lines, maybe the solution (if we
> > need one) doesn't have to be such a general one.  Are there similar
> > problems with other lines in a window?
> 
> Maybe it doesn't, but since the general case is simple enough to
> implement, why not do it? I think it fits in with the existing code well
> enough.

It fits with the code, but not with the conceptual framework.  The
:align-to spec starts counting pixels at the left edge of the text
area, whereas with the new symbols you introduce it will start at a
different point.  That's confusing.

> Sorry, I should have been more clear -- appending/prepending a
> pixel-specified space string to an arbitrary string. Essentially a
> (concat <pixel-space> string <pixel-space>).

The only way to generate a stretch of whitespace is to use a 'space'
display spec.  So no, we don't have that.  The display engine cannot
display a glyph of a character with prepended or appended space,
because we ask the font back-end to produce the glyph metrics for us,
and those metrics come from the font.  That is why we must produce
stretch glyphs separately.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28771; Package emacs. Full text available.

Message received at 28771 <at> debbugs.gnu.org:


Received: (at 28771) by debbugs.gnu.org; 10 Oct 2017 21:27:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 10 17:27:25 2017
Received: from localhost ([127.0.0.1]:32780 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1e223g-0000ks-O5
	for submit <at> debbugs.gnu.org; Tue, 10 Oct 2017 17:27:25 -0400
Received: from mail-io0-f180.google.com ([209.85.223.180]:56103)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1e223f-0000ke-Ba
 for 28771 <at> debbugs.gnu.org; Tue, 10 Oct 2017 17:27:23 -0400
Received: by mail-io0-f180.google.com with SMTP id z187so248170ioz.12
 for <28771 <at> debbugs.gnu.org>; Tue, 10 Oct 2017 14:27:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=xEZ4YVfzj2EiKDW2KmK50r5oKo2JMEfdgP4NZgGG580=;
 b=rO7aBigEgDVHcORnsMeT4+0uMhlIb60cr64/0ujHoRc/op8syM/d0n3skjBLAWhcjb
 qAwZLa0/yXS7QATwu76shVp7A5l/7XOe1FXvDpZ0pQmdxiptvY5pF/sJaS3ky8vfAvSr
 rwoitYWcZwbYGeIz7IGGiV0zqYjC7LTYlhQAUUDKkvCvWJn1X2F4komrdrCm5eepCQR2
 /cJWMV2gwKSU20II4/iBgZQKEtAWd8ykL/WRPHTQFWE6S5ohchZh3rnRTHF5NvlZ/q7V
 AkgbeJzM3EgFa4TDI/qrRQRUQGJIrPTUjviio3IBnH3Dpi34WMg3LFEtamM58Y5RA1A/
 MBAw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=xEZ4YVfzj2EiKDW2KmK50r5oKo2JMEfdgP4NZgGG580=;
 b=nUZgQ/5MYoRIozTCssFWJzYqb1/5d5Elah4E+S4JKLoLDo4s7ypodM+xeB/0f84vpu
 Rej+diIvXv3GdfcicPzw7+ECea1MFADtd+g3vRtfxc8LE5JfX0uLBEcpssw8isGQp3/y
 DBdAoWZksYtbqGO3wR2iFptUkT6TRrhcc+Cicbnx/yUThIKlRvsHRMsJ8263bvCcjskM
 K1tzmmdQbnkBqJrbVP6p/Pj7nimaTPhfLVvlZGBoC1ZOJcJoZhnk3Yf1PHMyUKnydwS6
 dsNHR7Dwp6StpJ69D+qeCBzfd/X+qYbaIQ1XtGPWlwAYA58zSHL0eq6JRdteLDFyT5Tz
 59Xw==
X-Gm-Message-State: AMCzsaWmXgVUnCAqkYxpiyJCuZ4SlR/fA+zX/6F9vRdOQmQtHE9qYnXc
 gF3tyX/w7cnlB2lZP8Bq90wQ8Q==
X-Google-Smtp-Source: AOwi7QBy3PuSQq+GmXHljDFD/cQTCYErCBpFUWm3Tuuer6Ywh4T1pUngRBBjUvcYrp5VOeh6qPhE3A==
X-Received: by 10.107.142.208 with SMTP id q199mr15469028iod.186.1507670837538; 
 Tue, 10 Oct 2017 14:27:17 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id y6sm5404660ioy.54.2017.10.10.14.27.15
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 10 Oct 2017 14:27:16 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#28771: 26.0.60;
 A couple space display property feature requests
References: <87fuarc0px.fsf@HIDDEN> <83efqbqz1n.fsf@HIDDEN>
 <87tvz6dh26.fsf@HIDDEN> <83k202q0k8.fsf@HIDDEN>
Date: Tue, 10 Oct 2017 15:27:03 -0600
In-Reply-To: <83k202q0k8.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 10 Oct
 2017 22:12:39 +0300")
Message-ID: <87bmled788.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 28771
Cc: 28771 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Alex <agrambot@HIDDEN>
>> Cc: 28771 <at> debbugs.gnu.org
>> Date: Tue, 10 Oct 2017 11:54:41 -0600
>> 
>> 1. There is currently no robust way to specify a pixel width to the
>>    center or left/right edge of the text area in the 'space' display spec.
>
> There's some kind of miscommunication here.  For starters, what do you
> mean by "text area"?  For me, "text area" is the area of the window
> inside the fringes, see the definition in "(elisp)Frame Layout".  But
> you must mean something else, because with my interpretation,
> specifying pixel width of the text area makes no sense: it is
> determined by the window dimensions.

I'm using whatever "(elisp) Pixel Specification" uses. In this case, I
believe it's the start of either column 0 or the line-prefix (see the
gnu-emacs-help thread on that point).

To get an idea evaluate:
(setq header-line-format
      (concat (propertize " "
                          'display
                          '(space :align-to 0))
              "test"))

The start of "test" is what I mean by the "left" of the "text-area".
The point here is that :align-to has access to some pixel positions
using `left', `center', and `right'; the diff above allows :width to
return a stretch space as wide as that position.

>>    This is because there's no way to tell what's before the left edge of
>>    the text area. If there's a left-side scroll-bar, then its width
>>    should be included; but if it's on the right, its width shouldn't be.
>
> This is only true for a header-line and mode-line, right?  Because the
> rest of the window lines don't change their alignment when the scroll
> bar switches sides, as their pixel count starts where the left fringe
> ends, whether or not there's a scroll bar to the left of the fringe.

I believe so. I haven't really played around with these specs outside of
the header-line.

>>    As for an example, try this in a graphical emacs -Q:
>> 
>> (setq header-line-format
>>       (propertize
>>        (concat (propertize " "
>>                            'display
>>                            '(space :align-to 0))
>>                "Test"
>>                (propertize " "
>>                            'display
>>                            '(space :width (+ left-fringe left-margin))))
>>        'face 'highlight))
>> 
>>   
>>    By default, the spaces before and after test are equally sized.
>
> Again, there's some misunderstanding here, because this example shows
> "Text" in the header-line flushed all the way to the left, with only
> one space before "Test", to account for the left fringe (if I turn off
> fringe-mode, that space disappears).  That's not what you are
> describing, so I guess the example needs some change?

So you don't see the space after "Test"? Make sure the background of the
'highlight face is different than the 'header-line background to see the
space clearly. I mentioned `emacs -Q' since the face background should
be different there. Any face with a different background suffices.

For clarification, what you should see is 1 space before and 1 space
after "Test", each the same pixel width as the left fringe.

What should happen is that if you toggle the fringes/margins, then the
spaces shrink and grow accordingly, with the exception of faulty
scroll-bar width calculation. Using '(space :width left) does not have
this faulty calculation.

The point is that the before/after stretch whitespace must have equal
lengths at all times, regardless of fringe/margin/line-number/scroll-bar
statuses.

> And again, this is limited to header-line, right?

I believe so (and the mode-line).

>> 2. Suppose you want to align a string to the right edge of the window.
>
> What is "the right edge of the window" in this context?

The very ends of the window shown in the art in "(elisp) Window Sizes"
(i.e., past RD). Specifically, whatever is returned by
WINDOW_LEFT_PIXEL_EDGE and WINDOW_RIGHT_PIXEL_EDGE is what I'm referring
to.

>> That's my use-case at the moment.
>
> If you are talking only about header lines, maybe the solution (if we
> need one) doesn't have to be such a general one.  Are there similar
> problems with other lines in a window?

Maybe it doesn't, but since the general case is simple enough to
implement, why not do it? I think it fits in with the existing code well
enough.

I don't know of any similar problems, but I don't use these
:align-to/:width outside of the header-line.

>> Is there currently no display spec that allows for appending/prepending
>> (or would it be hard to add)?
>
> Appending/prepending what and to what kind of text/object?  Sorry,
> maybe it's too late, but I have trouble following your
> descriptions :-(

Sorry, I should have been more clear -- appending/prepending a
pixel-specified space string to an arbitrary string. Essentially a
(concat <pixel-space> string <pixel-space>).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28771; Package emacs. Full text available.

Message received at 28771 <at> debbugs.gnu.org:


Received: (at 28771) by debbugs.gnu.org; 10 Oct 2017 19:13:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 10 15:13:17 2017
Received: from localhost ([127.0.0.1]:60931 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1e1zxs-0005qD-Rg
	for submit <at> debbugs.gnu.org; Tue, 10 Oct 2017 15:13:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:35224)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1e1zxq-0005q0-4L
 for 28771 <at> debbugs.gnu.org; Tue, 10 Oct 2017 15:13:14 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1e1zxh-0005zI-IZ
 for 28771 <at> debbugs.gnu.org; Tue, 10 Oct 2017 15:13:08 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60731)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1e1zxh-0005zC-F6; Tue, 10 Oct 2017 15:13:05 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2671
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1e1zxf-00079Z-NT; Tue, 10 Oct 2017 15:13:05 -0400
Date: Tue, 10 Oct 2017 22:12:39 +0300
Message-Id: <83k202q0k8.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Alex <agrambot@HIDDEN>
In-reply-to: <87tvz6dh26.fsf@HIDDEN> (message from Alex on Tue, 10 Oct 2017
 11:54:41 -0600)
Subject: Re: bug#28771: 26.0.60;
 A couple space display property feature requests
References: <87fuarc0px.fsf@HIDDEN> <83efqbqz1n.fsf@HIDDEN>
 <87tvz6dh26.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 28771
Cc: 28771 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

> From: Alex <agrambot@HIDDEN>
> Cc: 28771 <at> debbugs.gnu.org
> Date: Tue, 10 Oct 2017 11:54:41 -0600
> 
> 1. There is currently no robust way to specify a pixel width to the
>    center or left/right edge of the text area in the 'space' display spec.

There's some kind of miscommunication here.  For starters, what do you
mean by "text area"?  For me, "text area" is the area of the window
inside the fringes, see the definition in "(elisp)Frame Layout".  But
you must mean something else, because with my interpretation,
specifying pixel width of the text area makes no sense: it is
determined by the window dimensions.

>    This is because there's no way to tell what's before the left edge of
>    the text area. If there's a left-side scroll-bar, then its width
>    should be included; but if it's on the right, its width shouldn't be.

This is only true for a header-line and mode-line, right?  Because the
rest of the window lines don't change their alignment when the scroll
bar switches sides, as their pixel count starts where the left fringe
ends, whether or not there's a scroll bar to the left of the fringe.

>    As for an example, try this in a graphical emacs -Q:
> 
> (setq header-line-format
>       (propertize
>        (concat (propertize " "
>                            'display
>                            '(space :align-to 0))
>                "Test"
>                (propertize " "
>                            'display
>                            '(space :width (+ left-fringe left-margin))))
>        'face 'highlight))
> 
>   
>    By default, the spaces before and after test are equally sized.

Again, there's some misunderstanding here, because this example shows
"Text" in the header-line flushed all the way to the left, with only
one space before "Test", to account for the left fringe (if I turn off
fringe-mode, that space disappears).  That's not what you are
describing, so I guess the example needs some change?

>    if you disable fringe-mode or enable margins (e.g. linum-mode), the
>    spaces are equal. However, try setting the scroll-bar to appear on
>    the left. Now, the left space is noticeably bigger than the right.

And again, this is limited to header-line, right?

> 2. Suppose you want to align a string to the right edge of the window.

What is "the right edge of the window" in this context?

> Can you put overlays in the header-line?

No, header-line (as any other Lisp string) can only have text
properties.

> That's my use-case at the moment.

If you are talking only about header lines, maybe the solution (if we
need one) doesn't have to be such a general one.  Are there similar
problems with other lines in a window?

> Is there currently no display spec that allows for appending/prepending
> (or would it be hard to add)?

Appending/prepending what and to what kind of text/object?  Sorry,
maybe it's too late, but I have trouble following your
descriptions :-(





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28771; Package emacs. Full text available.

Message received at 28771 <at> debbugs.gnu.org:


Received: (at 28771) by debbugs.gnu.org; 10 Oct 2017 17:55:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 10 13:55:03 2017
Received: from localhost ([127.0.0.1]:60883 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1e1ykB-0003tY-32
	for submit <at> debbugs.gnu.org; Tue, 10 Oct 2017 13:55:03 -0400
Received: from mail-io0-f174.google.com ([209.85.223.174]:49415)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1e1yk9-0003t1-4m
 for 28771 <at> debbugs.gnu.org; Tue, 10 Oct 2017 13:55:01 -0400
Received: by mail-io0-f174.google.com with SMTP id n137so1706553iod.6
 for <28771 <at> debbugs.gnu.org>; Tue, 10 Oct 2017 10:55:01 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version;
 bh=uBt3YvN7N0R4qWLksw7wXBt0duxEO2QS4MlPumBqrgY=;
 b=sjETrhtVRn7XxnLOaF4pQWbU7Y/2HW4274It7eESkrSuao4iFYK/n5Pwwm7pS0ZZxQ
 nhT0Dv7vfDZvDCgol+Bs2fuXjIrdqYwI4ZDf+gwH4AjauHTdNqtzunMEfLak/teUcSzk
 b+Epdgpox5C7Bi+4EtNc1FjpmJdj/xsOKCcGZZepolTz2XWlR6zRd2HbwfegxYtbRTr9
 rEGhrsVMPPYZqoPR0Zs2BHGDiFOOKZ9M/z7GvE/UgZa+qyIB5nvCv2hiAwTrIpa4ba6H
 GELwfBy6jkd3mU52RYlNP57xUuMISS9WkQSstsGY/XuFZ9mg7UXlNT8ewkSfjOjRnw8d
 SCPg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=uBt3YvN7N0R4qWLksw7wXBt0duxEO2QS4MlPumBqrgY=;
 b=BzHpjKjH/evbo5spnzGnHt8iCH6PphsGnXgQCg9fMJserVAuB31G6Odd9VAvpWTMx6
 5vD+g1XK6TdkTD7DEToi8GXgYlDI3PKy31U0Q0ci3NxdnvH1gB1St9ltVWlEIApnqFmV
 tHpSjzXjNFgRtDwM66BCo7VSXi+25JpfTlBbTuuXrxTeR1adxfEpkP+qHtqXAZ2tgVf4
 2bCp3c3+Lvj+LW0jMwxpHZSvsBUubjOghWQxQEoh3F3zKy/htYAGb7AZGFo3efjCE9wN
 ta7cB95AVUUNSDNe9n+U/EAwhRdLvdUlAYwFiADzubgQVtuKSl1T3mOWjPdq1hiIIUkL
 /vpA==
X-Gm-Message-State: AMCzsaWLh1tpcK4gv38B41VYFeM574N9hu1pCw8Hs4ydV6gqBAhe1yoh
 tU+vLaI999n3Pe1d4Oj8AKaseA==
X-Google-Smtp-Source: AOwi7QDk3RPg6BHM4lg7bJcD8IqprEuKpiN2CJUBNDCKSEp2IZi4U2GUwpHQ1NKiHVKgmVNkNHEaDA==
X-Received: by 10.107.189.129 with SMTP id n123mr20449019iof.48.1507658095030; 
 Tue, 10 Oct 2017 10:54:55 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id c15sm68748iob.67.2017.10.10.10.54.53
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 10 Oct 2017 10:54:54 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#28771: 26.0.60;
 A couple space display property feature requests
References: <87fuarc0px.fsf@HIDDEN> <83efqbqz1n.fsf@HIDDEN>
Date: Tue, 10 Oct 2017 11:54:41 -0600
In-Reply-To: <83efqbqz1n.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 10 Oct
 2017 09:47:48 +0300")
Message-ID: <87tvz6dh26.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 28771
Cc: 28771 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

Eli Zaretskii <eliz@HIDDEN> writes:

>> From: Alex <agrambot@HIDDEN>
>> Date: Mon, 09 Oct 2017 18:20:42 -0600
>>
>> 1. Specifying the pixel width to the left/center/right of the text area.
>>    This is helpful (I believe it's necessary if I want it to be robust)
>>    when one wants to pad either side of a string with the same number of
>>    pixels and the left side uses (:align-to 0).
>> 
>>    I could use (:width (+ left-fringe left-margin)) for the right
>>    padding, but this doesn't take into account line-number display, as
>>    well as the scroll-bar width (if it's on the left).
>> 
>> 2. Specifying the pixel position relative to the left or right edge of
>>    the window. The right edge of the window currently may be the right
>>    edge of the right fringe or the scroll bar, depending on what side it
>>    is on. Also, just in the case that in the future the
>>    fringe/scroll-bar may not be the outermost elements, there should be
>>    a way to explicitly specify one of the edges.
>
> These two requests are no in the original message, and I admit I don't
> really understand the situations they describe.  Can you elaborate
> about them, preferably with an example that shows what is currently
> possible and an explanation why the current capabilities are
> insufficient?  (Yes, I've seen the patches you propose, but I still
> would like to understand the problems better.)

Right, they're additions that I felt should go directly to a bug report.

1. There is currently no robust way to specify a pixel width to the
   center or left/right edge of the text area in the 'space' display spec.

   This is because there's no way to tell what's before the left edge of
   the text area. If there's a left-side scroll-bar, then its width
   should be included; but if it's on the right, its width shouldn't be.

   :align-to currently allows for this calculation, but :width doesn't.
   The diff adds the same calculation to :width.

   As for an example, try this in a graphical emacs -Q:

(setq header-line-format
      (propertize
       (concat (propertize " "
                           'display
                           '(space :align-to 0))
               "Test"
               (propertize " "
                           'display
                           '(space :width (+ left-fringe left-margin))))
       'face 'highlight))

  
   By default, the spaces before and after test are equally sized. Even
   if you disable fringe-mode or enable margins (e.g. linum-mode), the
   spaces are equal. However, try setting the scroll-bar to appear on
   the left. Now, the left space is noticeably bigger than the right.

   Changing the last space's :width spec to be '(+ left-fringe
   left-margin scroll-bar)' will now make the spaces equal with a left
   scroll-bar, but unequal with a right scroll-bar.

   If you apply my diff and change the second space's :width spec to be
   'left', then it is correct in both cases.

   I don't know of a good use-case for :width center or :width right,
   but I figured that for completeness I might as well implement them.

2. Suppose you want to align a string to the right edge of the window. I
   couldn't find a way to do this currently since there's no guarantee
   what elements are on the left/right edges. Try:

(setq header-line-format
      (concat (propertize " "
			  'display
			  '(space :align-to (- (+ scroll-bar
						  scroll-bar)
					       4)))
	      "Test"))

   This works if there's a right scroll-bar (or if there's none, oddly
   enough), but not if there's a left scroll-bar. Replacing `scroll-bar'
   with `right-fringe' doesn't work if there's a right scroll-bar.

   Replacing the :align-to spec with `right-edge' works in all cases.

   A similar argument can be made for aligning from the left edge.


>> 3. Following from "1." and the help-gnu-emacs thread, it would be nice
>>    if there was a display property that allowed you to pad a string on
>>    both sides with a pixel-specified space instead of surrounding it
>>    with 2 pixel-specified spaces.
>
> I replied on help-gnu-emacs.  In a nutshell, the 'space' display spec
> is a replacing spec, so it cannot be easily used on non-space text.
> You could probably have a before-string whose value is a space with
> the 'space' display spec, if that makes any difference.

Can you put overlays in the header-line? That's my use-case at the
moment.

> use the space-width spec, as described on help-gnu-emacs.

I believe in my case (since the text may contain spaces), that's
equivalent to just the :width spec on the first/last spaces.

#3 is just a convenience request -- it makes dealing with pixel-spaces a
bit easier, but as long as #1 is implemented then I don't think it bring
any new functionality.

Is there currently no display spec that allows for appending/prepending
(or would it be hard to add)? If so, then #3 can be ignored.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28771; Package emacs. Full text available.

Message received at 28771 <at> debbugs.gnu.org:


Received: (at 28771) by debbugs.gnu.org; 10 Oct 2017 06:48:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 10 02:48:14 2017
Received: from localhost ([127.0.0.1]:59008 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1e1oKs-0004SO-B9
	for submit <at> debbugs.gnu.org; Tue, 10 Oct 2017 02:48:14 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40790)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1e1oKr-0004SB-4s
 for 28771 <at> debbugs.gnu.org; Tue, 10 Oct 2017 02:48:13 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <eliz@HIDDEN>) id 1e1oKh-0005Oe-VZ
 for 28771 <at> debbugs.gnu.org; Tue, 10 Oct 2017 02:48:08 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47466)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1e1oKh-0005OX-SK; Tue, 10 Oct 2017 02:48:03 -0400
Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1629
 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1e1oKh-00010Z-9x; Tue, 10 Oct 2017 02:48:03 -0400
Date: Tue, 10 Oct 2017 09:47:48 +0300
Message-Id: <83efqbqz1n.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Alex <agrambot@HIDDEN>
In-reply-to: <87fuarc0px.fsf@HIDDEN> (message from Alex on Mon, 09 Oct 2017
 18:20:42 -0600)
Subject: Re: bug#28771: 26.0.60;
 A couple space display property feature requests
References: <87fuarc0px.fsf@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 28771
Cc: 28771 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Reply-To: Eli Zaretskii <eliz@HIDDEN>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

> From: Alex <agrambot@HIDDEN>
> Date: Mon, 09 Oct 2017 18:20:42 -0600
> 
> I've branched this out from the following thread instead of posting it
> there:
> https://lists.gnu.org/archive/html/help-gnu-emacs/2017-10/msg00037.html

Sorry, I've somehow missed that.  I answered there now.

> Here's a few features that would be nice for the pixel-specified space
> properties.
> 
> 1. Specifying the pixel width to the left/center/right of the text area.
>    This is helpful (I believe it's necessary if I want it to be robust)
>    when one wants to pad either side of a string with the same number of
>    pixels and the left side uses (:align-to 0).
> 
>    I could use (:width (+ left-fringe left-margin)) for the right
>    padding, but this doesn't take into account line-number display, as
>    well as the scroll-bar width (if it's on the left).
> 
> 2. Specifying the pixel position relative to the left or right edge of
>    the window. The right edge of the window currently may be the right
>    edge of the right fringe or the scroll bar, depending on what side it
>    is on. Also, just in the case that in the future the
>    fringe/scroll-bar may not be the outermost elements, there should be
>    a way to explicitly specify one of the edges.

These two requests are no in the original message, and I admit I don't
really understand the situations they describe.  Can you elaborate
about them, preferably with an example that shows what is currently
possible and an explanation why the current capabilities are
insufficient?  (Yes, I've seen the patches you propose, but I still
would like to understand the problems better.)

> 3. Following from "1." and the help-gnu-emacs thread, it would be nice
>    if there was a display property that allowed you to pad a string on
>    both sides with a pixel-specified space instead of surrounding it
>    with 2 pixel-specified spaces.

I replied on help-gnu-emacs.  In a nutshell, the 'space' display spec
is a replacing spec, so it cannot be easily used on non-space text.
You could probably have a before-string whose value is a space with
the 'space' display spec, if that makes any difference.  Or you could
use the space-width spec, as described on help-gnu-emacs.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28771; Package emacs. Full text available.

Message received at 28771 <at> debbugs.gnu.org:


Received: (at 28771) by debbugs.gnu.org; 10 Oct 2017 02:02:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 09 22:02:34 2017
Received: from localhost ([127.0.0.1]:58902 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1e1jsQ-0005Qc-Jd
	for submit <at> debbugs.gnu.org; Mon, 09 Oct 2017 22:02:34 -0400
Received: from mail-io0-f181.google.com ([209.85.223.181]:50804)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1e1jsO-0005QO-Tm
 for 28771 <at> debbugs.gnu.org; Mon, 09 Oct 2017 22:02:33 -0400
Received: by mail-io0-f181.google.com with SMTP id 97so10321981iok.7
 for <28771 <at> debbugs.gnu.org>; Mon, 09 Oct 2017 19:02:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:references:date:in-reply-to:message-id:user-agent
 :mime-version; bh=AEwc/X3vNMlGgiEhhPU+P/hFolaf0zdBqdJ0WrTz7X0=;
 b=OnJ4PsyvASdw5JMvCZmeaq0Ypqx9o7K/5ZP4L4orPUsV3pmBQHL1c2JxDlWXyJzXF6
 S3s0rN8o19K7rHbigXir9heByM4o+gq9F6iSXEBru4aYBdti9m/SM1tmNXxgwokPg2ec
 gRHkEg0GoOk6TCOYhcEC8uH0KIr30kXBl+VlT/+AlPQ68Ah9qXW+8EvUdb4j9rxallru
 mDWxARFD7tNDGjJKD8CFWfZN8cxUpAFh9WDuPAZbcjynTaDkj8RoL3tbB0znYE/+6/TO
 lQ06oaCBdui2S4Mw32NC7ERnv/z7U6k2GMGs1QQuJl5+EUFepnWrT58annH5vwek94vI
 +7jQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:references:date:in-reply-to
 :message-id:user-agent:mime-version;
 bh=AEwc/X3vNMlGgiEhhPU+P/hFolaf0zdBqdJ0WrTz7X0=;
 b=EZg99FX0UOYclDASTtlbegL0CNHcKkaUM5ypvKMb7HmfHw+qYvHO6iI663S+ay5qhm
 2sR/ewrq1Hx5LpdwXxhne7mHJcBcuFEXW1fdlYgGtYJvoBs4ZfH2HjquO+lqeiIuOCnS
 fMl5SJ92kWQmfz9X9aYnjsBGaQDZ2qIheJkjhOKG6KnBotzURI6Ykf8K2B+jZh+b0BMr
 s5lUVx6xusNuZGt3SD0VxqEKXII39zeeb2zzXM1BnsUOtNO1MYWd6eSMAZfT5Octb+cV
 UTfaitxIFvAsq/oD8pMHz1NjqnXpNaXZh0YfulsUiSi5nXY7Ig0jAkjORqSYr8tVey/a
 6deA==
X-Gm-Message-State: AMCzsaWwvwU1oyKZKt8JGv+s4wyYFWE+tfa5DfN5GyZmR5/S02sjvATf
 PWpr/i9rJrfujTvIA2Pc5ATr7w==
X-Google-Smtp-Source: AOwi7QBzuMYemXNDqeOt/wXjzqnZpIpwJ+oXrHU458RHjVivvvG5vutuMe5urhuwaW0i+IEhjPnjLQ==
X-Received: by 10.107.17.209 with SMTP id 78mr14482500ior.247.1507600946822;
 Mon, 09 Oct 2017 19:02:26 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id d143sm4695098itd.8.2017.10.09.19.02.25
 for <28771 <at> debbugs.gnu.org>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Mon, 09 Oct 2017 19:02:25 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: 28771 <at> debbugs.gnu.org
Subject: Re: bug#28771: 26.0.60;
 A couple space display property feature requests
References: <87fuarc0px.fsf@HIDDEN>
Date: Mon, 09 Oct 2017 20:02:23 -0600
In-Reply-To: <87fuarc0px.fsf@HIDDEN> (Alex's message of "Mon, 09 Oct 2017
 18:20:42 -0600")
Message-ID: <87bmlfbw0g.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 28771
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--=-=-=
Content-Type: text/plain

Alex <agrambot@HIDDEN> writes:

> 1. Specifying the pixel width to the left/center/right of the text area.
>    This is helpful (I believe it's necessary if I want it to be robust)
>    when one wants to pad either side of a string with the same number of
>    pixels and the left side uses (:align-to 0).
>
>    I could use (:width (+ left-fringe left-margin)) for the right
>    padding, but this doesn't take into account line-number display, as
>    well as the scroll-bar width (if it's on the left).
>
> 2. Specifying the pixel position relative to the left or right edge of
>    the window. The right edge of the window currently may be the right
>    edge of the right fringe or the scroll bar, depending on what side it
>    is on. Also, just in the case that in the future the
>    fringe/scroll-bar may not be the outermost elements, there should be
>    a way to explicitly specify one of the edges.

Here's a diff that implements both #1 and #2:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=space.diff
Content-Description: space

diff --git a/src/xdisp.c b/src/xdisp.c
index b14b7daf2b..d5fa3a1cfe 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -25210,6 +25210,10 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
 				   + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (it->w)
 				      ? WINDOW_RIGHT_FRINGE_WIDTH (it->w)
 				      : 0)));
+          if (EQ (prop, Qleft_edge))
+            return OK_ALIGN_TO (WINDOW_LEFT_PIXEL_EDGE (it->w));
+          if (EQ (prop, Qright_edge))
+            return OK_ALIGN_TO (WINDOW_RIGHT_PIXEL_EDGE (it->w));
 	}
       else
 	{
@@ -25223,6 +25227,13 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
 	    return OK_PIXELS (WINDOW_RIGHT_MARGIN_WIDTH (it->w));
 	  if (EQ (prop, Qscroll_bar))
 	    return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
+	  if (EQ (prop, Qleft))
+            return OK_PIXELS (window_box_left_offset (it->w, TEXT_AREA));
+          if (EQ (prop, Qright))
+	    return OK_PIXELS (window_box_right_offset (it->w, TEXT_AREA));
+	  if (EQ (prop, Qcenter))
+	    return OK_PIXELS (window_box_left_offset (it->w, TEXT_AREA)
+				+ window_box_width (it->w, TEXT_AREA) / 2);
 	}
 
       prop = buffer_local_value (prop, it->w->contents);
@@ -32207,6 +32218,8 @@ They are still logged to the *Messages* buffer.  */);
   DEFSYM (Qspace, "space");
   DEFSYM (Qmargin, "margin");
   DEFSYM (Qpointer, "pointer");
+  DEFSYM (Qleft_edge, "left-edge");
+  DEFSYM (Qright_edge, "right-edge");
   DEFSYM (Qleft_margin, "left-margin");
   DEFSYM (Qright_margin, "right-margin");
   DEFSYM (Qcenter, "center");

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#28771; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 10 Oct 2017 00:21:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 09 20:21:02 2017
Received: from localhost ([127.0.0.1]:58875 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1e1iIA-0002iz-Dv
	for submit <at> debbugs.gnu.org; Mon, 09 Oct 2017 20:21:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:54585)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <agrambot@HIDDEN>) id 1e1iI9-0002i8-3q
 for submit <at> debbugs.gnu.org; Mon, 09 Oct 2017 20:21:01 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <agrambot@HIDDEN>) id 1e1iI2-00006U-Pv
 for submit <at> debbugs.gnu.org; Mon, 09 Oct 2017 20:20:55 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:36152)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <agrambot@HIDDEN>) id 1e1iI2-00006L-Ms
 for submit <at> debbugs.gnu.org; Mon, 09 Oct 2017 20:20:54 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45536)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <agrambot@HIDDEN>) id 1e1iI1-0006I5-6T
 for bug-gnu-emacs@HIDDEN; Mon, 09 Oct 2017 20:20:54 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <agrambot@HIDDEN>) id 1e1iHy-0008Vp-2d
 for bug-gnu-emacs@HIDDEN; Mon, 09 Oct 2017 20:20:53 -0400
Received: from mail-io0-x232.google.com ([2607:f8b0:4001:c06::232]:51383)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <agrambot@HIDDEN>) id 1e1iHx-0008VG-Ti
 for bug-gnu-emacs@HIDDEN; Mon, 09 Oct 2017 20:20:49 -0400
Received: by mail-io0-x232.google.com with SMTP id b186so2715739iof.8
 for <bug-gnu-emacs@HIDDEN>; Mon, 09 Oct 2017 17:20:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:mime-version;
 bh=cjkMhq6OV1MN+smg/VuZru6hvIQB/zgQHBpleayUEaE=;
 b=AxWBcxydkpac6D6TDvbnaEIP8EclAQOQbwlkZ3aUsIHiolEhazcThNshmslZhygE+w
 40cwNlKQEQvOMl2jWeNhq8NTp441rvJ4P5VS24ib4nnK45nQHceSk3eOPKNSqkcAcUks
 n7UKCTB42BS5Tjooo3CfchOX/ni5Mo2/7LX2NRQ4+CDBqlztmTCR/TdqFQ/qomqVDyck
 pJ7Ex6DAB0nmmVGf8Yw5ioFZ1yCxCOXadESuRcCGyfMTEKki4L5JO16uVifGN06EJG1B
 WBvZaAdZ4FQlKZYSFvnF97p+UxfOjiWBsW/xLsRtVmxuofKMlDYgpJXNeyzBxwyCm7lV
 fSLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:mime-version;
 bh=cjkMhq6OV1MN+smg/VuZru6hvIQB/zgQHBpleayUEaE=;
 b=QTdYlxMkl84hc0j3GT/YvF8T7Vjucvhufo5vhFdPKMnKbGbuJpfBxvySqENSnY88iv
 1dHVY37BjJjCJgK6/j08MgWZ6CEEOfOCqLMyHMF7cgKpFiuKBQhu3pDQHW/+3n1Go+7o
 UEvtx6EWMrpTEtZFVpmv47O2+JKNvFGpfZK8msI3ciOFG2DI6gxPdchPVO5uoq3eyJuC
 9vkXa3iCdaur03o/YWf/lZoPXrYOmtqeC/hd+iG2YABkXfdVui+JzL1cUgBef/s8CT+z
 80SWJlqHxIk6ZGhyZf6JzxM0lUfK2hREhNdjK3ECcxheht+APKgmlRaa1DS/X8yENQKE
 BNpg==
X-Gm-Message-State: AMCzsaXOdIM5hnGeU/zX2DWVkhQFBITPRNqm4xKn0a2PKp+emT8TGdjd
 Jd6eRGStjulzLP9hMMV65qYo3Q==
X-Google-Smtp-Source: AOwi7QAEAVc5QojnQcyB/9JUChNlSH0X0l5XBc0Ywv+UazQQgc3zGObv4nPBvi9c5h0hyy4BksaX+g==
X-Received: by 10.107.21.1 with SMTP id 1mr14720387iov.209.1507594847741;
 Mon, 09 Oct 2017 17:20:47 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
 by smtp.gmail.com with ESMTPSA id j81sm4335999ioj.13.2017.10.09.17.20.46
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Mon, 09 Oct 2017 17:20:46 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 26.0.60; A couple space display property feature requests
Date: Mon, 09 Oct 2017 18:20:42 -0600
Message-ID: <87fuarc0px.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

I've branched this out from the following thread instead of posting it
there:
https://lists.gnu.org/archive/html/help-gnu-emacs/2017-10/msg00037.html

Here's a few features that would be nice for the pixel-specified space
properties.

1. Specifying the pixel width to the left/center/right of the text area.
   This is helpful (I believe it's necessary if I want it to be robust)
   when one wants to pad either side of a string with the same number of
   pixels and the left side uses (:align-to 0).

   I could use (:width (+ left-fringe left-margin)) for the right
   padding, but this doesn't take into account line-number display, as
   well as the scroll-bar width (if it's on the left).

2. Specifying the pixel position relative to the left or right edge of
   the window. The right edge of the window currently may be the right
   edge of the right fringe or the scroll bar, depending on what side it
   is on. Also, just in the case that in the future the
   fringe/scroll-bar may not be the outermost elements, there should be
   a way to explicitly specify one of the edges.

3. Following from "1." and the help-gnu-emacs thread, it would be nice
   if there was a display property that allowed you to pad a string on
   both sides with a pixel-specified space instead of surrounding it
   with 2 pixel-specified spaces.




Acknowledgement sent to Alex <agrambot@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#28771; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.