[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is `(1 . width)` zero?
From: |
Jörg Sommer |
Subject: |
Re: Why is `(1 . width)` zero? |
Date: |
Tue, 19 Jan 2021 10:37:24 +0100 |
Jörg Sommer schrieb am Mo 18. Jan, 23:23 (+0100):
> Robert Pluim schrieb am Mo 18. Jan, 16:06 (+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?
>
> Thank you Robert for your feedback. I've tried the latest master and it
> works fine. Hence, there was something between 27.1 and 8f4b3b812aa. I've
> bisect this range and found this commit:
>
Sorry, I've picked the wrong commit. This one fixes the problem and a
backport to 27.1 fixes it there, too.
commit c7804ac4018fb03787f291d7ef1739b34914d930 (HEAD, refs/bisect/with-space)
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date: Thu Oct 8 09:49:20 2020 -0400
* src/ftcrfont.c (ftcrfont_open): Initialize the `max_width` field
On a 32bit build, Emacs can otherwise crash with a !FIXNUM_OVERFLOW_P
assertion in `Ffont_info` by simply doing `emacs -Q` and then `C-s`.
* src/font.c: Try and detect uninitialized `max_width` fields.
(font_make_object): Set max_width to a silly value.
(Ffont_info): Check the value is not silly any more.
--
$ cat /dev/random
#!/usr/bin/perl -WT
print "hello world\n";
signature.asc
Description: PGP signature
Re: Why is `(1 . width)` zero?, Robert Thorpe, 2021/01/19