help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why is `(1 . width)` zero?


From: tomas
Subject: Re: Why is `(1 . width)` zero?
Date: Tue, 19 Jan 2021 08:59:49 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Jan 19, 2021 at 06:53:57AM +0000, Robert Thorpe wrote:
> Jörg Sommer <joerg@jo-so.de> writes:
> 
> > [1:text/plain Hide]
> >
> > 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"))
> > ```
> 
> I don't understand your problem.  But I this snippet looks wrong:
> 
> >   (- text (,len . width))
> 
> You can't do arithmetic on a pair.

I think this is misleading. The :align-to takes its own mini-language [1],
where this (num . unit) has its own meaning (behind the scenes, unit is
just "how many pixels per unit, in good old TeX tradition, as far as my
yet-coffeine-depleted status allows me to see).

Cheers

[1] 39.16.3 Pixel Specification for Spaces
    
https://www.gnu.org/software/emacs/manual/html_node/elisp/Pixel-Specification.html

 - t

Attachment: signature.asc
Description: Digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]