[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is `(1 . width)` zero?
From: |
Robert Pluim |
Subject: |
Re: Why is `(1 . width)` zero? |
Date: |
Mon, 18 Jan 2021 16:06:08 +0100 |
>>>>> On Mon, 18 Jan 2021 09:51:13 +0100, Jörg Sommer <joerg@jo-so.de> said:
Jörg> Hi,
Jörg> I'm using GNU Emacs 27.1¹ with X and the font DejaVu Sans Mono. I
would like
Jörg> to align a text on the right side and thought I can use this:
Jörg> ```lisp
Jörg> (let* ((text " abcd")
Jörg> (len (length text))
Jörg> )
Jörg> (add-text-properties 0 1 `(display (space :align-to (- text (,len .
width)))) text)
Jörg> (insert "\n" (format "%S" text) "\n" text "\n"))
Jörg> ```
Jörg> but it doesn't work. The text is outside the visible space. Similar
with a
Jörg> text that should be indented:
Jörg> ```lisp
Jörg> (let ((text " abcd"))
Jörg> (add-text-properties 0 1 `(display (space :width (10 . width)))
text)
Jörg> (insert "\n" (format "%S" text) "\n" text "\n"))
Jörg> ```
Jörg> It shows up in the first column. But in the TUI it works. So, what's
wrong
Jörg> with `width` in GUI?
Both of those work fine for me in emacs-27 under X (using DejaVu Sans
Mono Book). Does it do the same in 'emacs -Q' and in emacs compiled
from the latest emacs-27 sources?
Jörg> Are there any other ways to get this?
:align-to is the way to do it.
Robert
Re: Why is `(1 . width)` zero?, Robert Thorpe, 2021/01/19