From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.bugs Subject: bug#28771: 26.0.60; A couple space display property feature requests Date: Tue, 10 Oct 2017 11:54:41 -0600 Message-ID: <87tvz6dh26.fsf@gmail.com> References: <87fuarc0px.fsf@gmail.com> <83efqbqz1n.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1507658174 501 195.159.176.226 (10 Oct 2017 17:56:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 10 Oct 2017 17:56:14 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.60 (gnu/linux) Cc: 28771@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 10 19:56:10 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 1e1ylB-0007gV-Rq for geb-bug-gnu-emacs@m.gmane.org; Tue, 10 Oct 2017 19:56:06 +0200 Original-Received: from localhost ([::1]:36462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1ylJ-0000xH-9z for geb-bug-gnu-emacs@m.gmane.org; Tue, 10 Oct 2017 13:56:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1ylB-0000x8-3f for bug-gnu-emacs@gnu.org; Tue, 10 Oct 2017 13:56:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1yl7-0002Ve-VD for bug-gnu-emacs@gnu.org; Tue, 10 Oct 2017 13:56:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52202) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e1yl7-0002VZ-RK for bug-gnu-emacs@gnu.org; Tue, 10 Oct 2017 13:56:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e1yl7-0003uq-KK for bug-gnu-emacs@gnu.org; Tue, 10 Oct 2017 13:56:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 10 Oct 2017 17:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28771 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 28771-submit@debbugs.gnu.org id=B28771.150765810314982 (code B ref 28771); Tue, 10 Oct 2017 17:56:01 +0000 Original-Received: (at 28771) by debbugs.gnu.org; 10 Oct 2017 17:55:03 +0000 Original-Received: from localhost ([127.0.0.1]:60883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1ykB-0003tY-32 for submit@debbugs.gnu.org; Tue, 10 Oct 2017 13:55:03 -0400 Original-Received: from mail-io0-f174.google.com ([209.85.223.174]:49415) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e1yk9-0003t1-4m for 28771@debbugs.gnu.org; Tue, 10 Oct 2017 13:55:01 -0400 Original-Received: by mail-io0-f174.google.com with SMTP id n137so1706553iod.6 for <28771@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) Original-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) In-Reply-To: <83efqbqz1n.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 10 Oct 2017 09:47:48 +0300") 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:138188 Archived-At: Eli Zaretskii writes: >> From: Alex >> 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.