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 09:40:50 +0300 Message-ID: <83fuarqzd9.fsf@gnu.org> References: <87zi90yjws.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1507617705 13948 195.159.176.226 (10 Oct 2017 06:41:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 10 Oct 2017 06:41:45 +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 08:41:36 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 1e1oEL-0001k5-Oq for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Oct 2017 08:41:29 +0200 Original-Received: from localhost ([::1]:33104 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1oET-0007y0-3n for geh-help-gnu-emacs@m.gmane.org; Tue, 10 Oct 2017 02:41:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1oE1-0007xk-Sr for help-gnu-emacs@gnu.org; Tue, 10 Oct 2017 02:41:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e1oDy-0002ML-0U for help-gnu-emacs@gnu.org; Tue, 10 Oct 2017 02:41:09 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e1oDx-0002ME-TF for help-gnu-emacs@gnu.org; Tue, 10 Oct 2017 02:41:05 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1628 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1e1oDx-0000VJ-8d for help-gnu-emacs@gnu.org; Tue, 10 Oct 2017 02:41:05 -0400 In-reply-to: <87zi90yjws.fsf@gmail.com> (message from Alex on Sun, 08 Oct 2017 23:22:59 -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:114531 Archived-At: > From: Alex > Cc: eliz@gnu.org > Date: Sun, 08 Oct 2017 23:22:59 -0600 > > (setq header-line-format > (concat (propertize " " > 'display > '(space . (:align-to 0))) > "test")) > > (setq header-line-format > (propertize "test" > 'display > '(space . (:align-to 0)))) > > It's not a big deal, but it's makes things look cleaner, especially when > the string in question is also being propertized. The 'space' display property is of the "replacing" kind, i.e. it completely replaces the text which has that property. So implementing what you want would need a new property at least. Or maybe you could use the '(space-width FACTOR)' display spec instead, and prepending a single SPC character that precedes the string characters? (This assumes the string itself doesn't have embedded SPC characters; if it does, put this display property only on the initial SPC character.) FWIW, having a 'space' display property on some whitespace character sounds very intuitive to me, since this feature was supposed to be used to display white space subject to pixel-level resolution considerations of a GUI frame. > P.S. I noticed that the above does not take into account the space taken > by `display-line-numbers'. That's because it isn't clear whether it should be done for every header-line. For example, the Info mode will certainly not want that. So this has to be done by the Lisp program, because only it knows whether the text in the header line should be aligned with the rest of buffer text.