unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Jörg Sommer" <joerg@jo-so.de>
To: help-gnu-emacs@gnu.org
Subject: Why is `(1 . width)` zero?
Date: Mon, 18 Jan 2021 09:51:13 +0100	[thread overview]
Message-ID: <20210118085113.7rz2pnm2t5sn7y3k@jo-so.de> (raw)

[-- 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 --]

             reply	other threads:[~2021-01-18  8:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18  8:51 Jörg Sommer [this message]
2021-01-18 15:06 ` Why is `(1 . width)` zero? 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210118085113.7rz2pnm2t5sn7y3k@jo-so.de \
    --to=joerg@jo-so.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).