Yuri Khan <[email protected]> writes:
> On Mon, Mar 23, 2026 at 7:47 PM Heime <[email protected]> wrote:
>
>> ((:cm :10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937 :ft 0.03281)
>> (:in :10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333)
>> (:ft :10pt 8640 :pt 864 :mm 304.8 :cm 30.48 :in 12))
>>
>> How can I get the new list being printed as
>>
>> ((:cm . (:10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937 :ft 0.03281))
>> (:in . (:10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333))
>> (:ft . (:10pt 8640 :pt 864 :mm 304.8 :cm 30.48 :in 12)))
>
> Nohow, barring a custom prettyprinter. These are two equivalent forms,
> and there is no information in the data structure that encodes which
> form you’d prefer.
>
> (equal
> '((:cm . (:10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937 :ft 0.03281))
> (:in . (:10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333))
> (:ft . (:10pt 8640 :pt 864 :mm 304.8 :cm 30.48 :in 12)))
> '((:cm :10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937 :ft 0.03281)
> (:in :10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333)
> (:ft :10pt 8640 :pt 864 :mm 304.8 :cm 30.48 :in 12)))
> ⇒ t
>
> (defun pp-aplist (aplist)
> (format "(%s)"
> (mapconcat (lambda (pair)
> (format "(%s . %s)" (car pair) (cdr pair)))
> aplist "\n ")))
>
> (pp-aplist '((:cm :10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937
> :ft 0.03281)
> (:in :10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333)
> (:ft :10pt 8640 :pt 864 :mm 304.8 :cm 30.48 :in 12)))
> ⇒ "((:cm . (:10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937 :ft 0.03281))
> (:in . (:10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333))
> (:ft . (:10pt 8640 :pt 864 :mm 304.8 :cm 30.48 :in 12)))"
>
>
Alternatively, using the definitions of ‘mpl-plist-to-alist’ and
‘mpl-length’ given earlier:
(pp-to-string (mpl-plist-to-alist mpl-length))
;;=> "((:cm (:10pt 283.46456 :pt 28.34646 :mm 10 :in 0.3937 :ft 0.03281))
(:in (:10pt 720 :pt 72 :mm 25.4 :cm 2.54 :ft 0.083333))
(:ft (:10pt 8640 :pt 864 :mm 304.8 :cm 30.48 :in 12)))
There is no Info documentation for the ‘pp’ package, so use:
1. C-h P pp
Package pp is built-in.
Status: Built-In.
Summary: pretty printer for Emacs Lisp
(No detailed description.)
2. M-x apropos
--
The lyf so short, the craft so long to lerne.
- Geoffrey Chaucer, The Parliament of Birds.
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.