unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Why is `(1 . width)` zero?
@ 2021-01-18  8:51 Jörg Sommer
  2021-01-18 15:06 ` Robert Pluim
  2021-01-19  6:53 ` Robert Thorpe
  0 siblings, 2 replies; 11+ messages in thread
From: Jörg Sommer @ 2021-01-18  8:51 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1513 bytes --]

Hi,

I'm using GNU Emacs 27.1¹ with X and the font DejaVu Sans Mono. I would like
to align a text on the right side and thought I can use this:

```lisp
(let* ((text " abcd")
       (len (length text))
       )
  (add-text-properties 0 1 `(display (space :align-to (- text (,len . width)))) text)
  (insert "\n" (format "%S" text) "\n" text "\n"))
```

but it doesn't work. The text is outside the visible space. Similar with a
text that should be indented:

```lisp
(let ((text " abcd"))
  (add-text-properties 0 1 `(display (space :width (10 . width))) text)
  (insert "\n" (format "%S" text) "\n" text "\n"))
```

It shows up in the first column. But in the TUI it works. So, what's wrong
with `width` in GUI?

My main goal is to place a text on the right side that the user might scale
down with face attributes:

```lisp
(set-face-attribute 'lsp-ui-sideline-global nil :height 0.5)

(let* ((text " abcd")
       (len (length text))
       )
  (add-text-properties 0 len '(font-lock-face (error lsp-ui-sideline-global)) text)
  (add-text-properties 0 1 `(display (space :align-to (- text (,len . width)))) text)
  (insert "\n" (format "%S" text) "\n" text "\n"))
```

Are there any other ways to get this?


Kind regards

Jörg


¹ build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.23, cairo version 1.16.0
  of 2020-11-08, modified by Debian

-- 
> Definiere ‚Demokratie‘ …
… eine Mehrheit beweist einer Minderheit, dass Widerstand zwecklos ist.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 269 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-01-24 14:54 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-18  8:51 Why is `(1 . width)` zero? Jörg Sommer
2021-01-18 15:06 ` Robert Pluim
2021-01-18 20:49   ` Michael Heerdegen
2021-01-18 22:23   ` Jörg Sommer
2021-01-19  9:37     ` Jörg Sommer
2021-01-19 10:32       ` Robert Pluim
2021-01-24 10:45       ` Robert Pluim
2021-01-24 14:54         ` Eli Zaretskii
2021-01-19  6:53 ` Robert Thorpe
2021-01-19  7:59   ` tomas
2021-01-19  9:37     ` Robert Thorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).