From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Using :align-to with non-spaces Date: Tue, 10 Oct 2017 23:01:55 +0300 Message-ID: <83bmlepya4.fsf@gnu.org> References: <87zi90yjws.fsf@gmail.com> <83fuarqzd9.fsf@gnu.org> <87mv4ydgcu.fsf@gmail.com> <83lgkiq2nu.fsf@gnu.org> <87fuaqdd6n.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1507665769 21787 195.159.176.226 (10 Oct 2017 20:02:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 10 Oct 2017 20:02:49 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Oct 10 22:02:43 2017 Return-path: Envelope-to: geh-help-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 1e20ja-0003lD-U6 for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Oct 2017 22:02:35 +0200 Original-Received: from localhost ([::1]:36940 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e20jg-0002JD-6M for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Oct 2017 16:02:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e20jF-0002J6-IZ for help-gnu-emacs@gnu.org; Tue, 10 Oct 2017 16:02:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e20jC-0004Ee-Ep for help-gnu-emacs@gnu.org; Tue, 10 Oct 2017 16:02:13 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:33509) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e20jC-0004EN-Bu for help-gnu-emacs@gnu.org; Tue, 10 Oct 2017 16:02:10 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2696 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e20jB-0000WX-Py for help-gnu-emacs@gnu.org; Tue, 10 Oct 2017 16:02:10 -0400 In-reply-to: <87fuaqdd6n.fsf@gmail.com> (message from Alex on Tue, 10 Oct 2017 13:18:24 -0600) 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-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114545 Archived-At: > From: Alex > Cc: help-gnu-emacs@gnu.org > Date: Tue, 10 Oct 2017 13:18:24 -0600 > > > :align-to doesn't align the space, it produces a stretch of white > > space that _ends_ at the place which :align-to defines. That's why it > > makes sense to put this property on a SPC character: it makes that SPC > > character's width on display be as you need it. > > Right, I misspoke. What would be nice is to have the above 'align-to > display property prepend a stretch space that ends at an :align-to > expression. Then the stretch would have no buffer/string position on it, and the code which processes glyphs would become more complex. IMO, the gain is too small to justify the complexity. > I believe it makes the code a bit neater when using other text > properties on the string. If it does, then only slightly so, IMO. Prepending a space is not a big deal. > > It doesn't because neither does that happen with line-prefix or > > wrap-prefix. IOW, :align-to measures from the edges of the window's > > text area. > > I would consider it not recognizing {line,wrap}-prefix to be a bug as > well (either in behaviour or documentation). Everything in the text area counts: images, stretches, line numbers, etc. This was always so, since Emacs 21. > > The "text area" is everything inside the fringes/display margins > > (whichever comes last), so it includes the space used for the > > line-number display. > > >From a user perspective, I don't think the prefix/line-numbers should be > considered as part of the text area. At the very least, not the > line-numbers. That's your linum-mode experience talking ;-) It takes time to get used to a different view of this. > > The solution I can suggest is to use the value returned by > > line-number-display-width. > > Right, but shouldn't it be recomputed at the same times that the other > element's widths are (i.e., toggling display-line-numbers should > automatically change the display width of relevant :align-to/:width > spaces)? We discussed that briefly on emacs-devel, and decided not to, mainly due to the line/wrap-prefix precedent. I still don't see any reason to revise that decision, the few problems that are caused for that were solved relatively easily. > So even if `left' doesn't mean column 0 (I find this poor behaviour, > though), then one can use `(:align-to (+ left prefix)' or something of > the sort to always mean column 0, even if there are > prefixes/line-numbers displayed. I think you underestimate the number of different "things" that could precede the leftmost text character. We have so many display features that can put stuff to the left of the leftmost character that we will have hard time deciding what should and shouldn't be considered 'prefix'. It is easier to write a function that computes their summary width, if that's what you need. More generally, doing layout in Lisp (which is what I think you are trying) isn't easy, and was never supposed to be. It is better to extend the display engine to do layout for you, if that makes sense.