unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#55478: 29.0.50; pp-emacs-lisp-code prints '("a") as (a)
@ 2022-05-17 10:12 Visuwesh
  2022-05-17 10:18 ` Visuwesh
  0 siblings, 1 reply; 5+ messages in thread
From: Visuwesh @ 2022-05-17 10:12 UTC (permalink / raw)
  To: 55478

Sorry for the awful subject line.  To reproduce,

        1. emacs -Q
        2. (pp-emacs-lisp-code '("a"))
        3. C-x C-e

instead of (pp-emacs-lisp-code '("a")) you can also try
(pp-emacs-lisp-code '("a" . "b")).  However, if the argument is '("a"
"b"), then there are no such problems.        

A quick through edebug shows that this is due to the usage of `princ'.

In GNU Emacs 29.0.50 (build 2, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0, Xaw scroll bars)
 of 2022-05-16 built on astatine
Repository revision: f171a36c0ad7a0b5b69c3d4bad2875c54e2ccdd9
Repository branch: imenu-xref
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: NixOS 21.11 (Porcupine)

Configured using:
 'configure --with-sqlite3 --with-x-toolkit=lucid --with-json
 --without-gsettings --with-x --without-libsystemd --with-modules'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM HARFBUZZ JPEG JSON
LIBOTF LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP
SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2
XPM LUCID ZLIB

Important settings:
  value of $LC_MONETARY: ta_IN.UTF-8
  value of $LC_NUMERIC: ta_IN.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr dabbrev emacsbug message mailcap yank-media rmc
puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived
epg rfc6068 epg-config gnus-util text-property-search mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
time-date edebug help-fns radix-tree seq cl-print gv subr-x byte-opt
bytecomp byte-compile cconv debug backtrace help-mode find-func pp
cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice simple cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting font-render-setting cairo x-toolkit xinput2 x multi-tty
make-network-process emacs)

Memory information:
((conses 16 53277 8750)
 (symbols 48 6843 1)
 (strings 32 19698 1754)
 (string-bytes 1 610797)
 (vectors 16 12914)
 (vector-slots 8 178761 10605)
 (floats 8 26 26)
 (intervals 56 335 1)
 (buffers 992 13))





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

* bug#55478: 29.0.50; pp-emacs-lisp-code prints '("a") as (a)
  2022-05-17 10:12 bug#55478: 29.0.50; pp-emacs-lisp-code prints '("a") as (a) Visuwesh
@ 2022-05-17 10:18 ` Visuwesh
  2022-05-17 17:45   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Visuwesh @ 2022-05-17 10:18 UTC (permalink / raw)
  To: 55478

[செவ்வாய் மே 17, 2022] Visuwesh wrote:

I hit send too early.  

> Sorry for the awful subject line.  To reproduce,
>
>         1. emacs -Q
>         2. (pp-emacs-lisp-code '("a"))
>         3. C-x C-e
>
> instead of (pp-emacs-lisp-code '("a")) you can also try
> (pp-emacs-lisp-code '("a" . "b")).  However, if the argument is '("a"
> "b"), then there are no such problems.
>
> A quick through edebug shows that this is due to the usage of `princ'.
    ^^^^^^^^^^^^^^^^^^^^^^

A quick edebug through pp--insert-lisp shows that it is due to use of
`princ' in this condition,

      (cons (cond
               ((consp (cdr sexp))
                (if (and (length= sexp 2)
                         (memq (car sexp) '(quote function)))
                    (cond
                     ((symbolp (cadr sexp))
                      (let ((print-quoted t))
                        (prin1 sexp (current-buffer))))
                     ((consp (cadr sexp))
                      (insert (if (eq (car sexp) 'quote)
                                  "'" "#'"))
                      (pp--format-list (cadr sexp)
                                       (set-marker (make-marker) (1- (point))))))
                  (pp--format-list sexp)))
               (t
                (princ sexp (current-buffer)))))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^





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

* bug#55478: 29.0.50; pp-emacs-lisp-code prints '("a") as (a)
  2022-05-17 10:18 ` Visuwesh
@ 2022-05-17 17:45   ` Lars Ingebrigtsen
       [not found]     ` <87sfp6ut7t.fsf@gmail.com>
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-17 17:45 UTC (permalink / raw)
  To: Visuwesh; +Cc: 55478

Visuwesh <visuweshm@gmail.com> writes:

> A quick edebug through pp--insert-lisp shows that it is due to use of
> `princ' in this condition,

[...]

>                (t
>                 (princ sexp (current-buffer)))))
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^

Thanks; I've now pushed a fix for this to Emacs 29.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#55478: 29.0.50; pp-emacs-lisp-code prints '("a") as (a)
       [not found]     ` <87sfp6ut7t.fsf@gmail.com>
@ 2022-05-19 23:39       ` Lars Ingebrigtsen
  2022-05-20  4:41         ` Visuwesh
  0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-19 23:39 UTC (permalink / raw)
  To: Visuwesh; +Cc: 55478

Visuwesh <visuweshm@gmail.com> writes:

> Thanks for the quick fix.  But it begs the question: what about other
> instances of princ?  Should they be replaced with prin1 as well?

I had a very quick skim over the other instances of princ, but nothing
immediately stood out as problematic.  Did you have anything in
particular in mind?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

* bug#55478: 29.0.50; pp-emacs-lisp-code prints '("a") as (a)
  2022-05-19 23:39       ` Lars Ingebrigtsen
@ 2022-05-20  4:41         ` Visuwesh
  0 siblings, 0 replies; 5+ messages in thread
From: Visuwesh @ 2022-05-20  4:41 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 55478

[வெள்ளி மே 20, 2022] Lars Ingebrigtsen wrote:

> Visuwesh <visuweshm@gmail.com> writes:
>
>> Thanks for the quick fix.  But it begs the question: what about other
>> instances of princ?  Should they be replaced with prin1 as well?
>
> I had a very quick skim over the other instances of princ, but nothing
> immediately stood out as problematic.  Did you have anything in
> particular in mind?

I was thinking the vector case could be problematic: I just realised why
the cookies file randomly got "corrupted" (strings were printed as
symbols).  But I'm trying it with the cookie that was problematic again,
and I don't see the problem anymore, so I don't think there's anything
to do here (I also took a quick glance).





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

end of thread, other threads:[~2022-05-20  4:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-17 10:12 bug#55478: 29.0.50; pp-emacs-lisp-code prints '("a") as (a) Visuwesh
2022-05-17 10:18 ` Visuwesh
2022-05-17 17:45   ` Lars Ingebrigtsen
     [not found]     ` <87sfp6ut7t.fsf@gmail.com>
2022-05-19 23:39       ` Lars Ingebrigtsen
2022-05-20  4:41         ` Visuwesh

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).