freenode/lisp - IRC Chatlog
Search
15:23:33
phoe
What should be printed when (print-unreadable-object (nil *standard-output* :type t :identity nil)) is evaluated?
15:23:50
lukego
I'm trying to `C-)' in paredit but all Emacs is getting is plain old 0. Maybe because I'm running Emacs over ssh in a terminal? Any workaround?
15:24:45
phoe
The CLHS says this: If type is true, the output from forms is preceded by a brief description of the object's type and a space character.
15:31:56
Xach
lukego: i've had similar trouble when running through screen, but it produces a sequence of control characters that come out wrong. so i bind those codes in my .emacs to make things work.
15:32:43
lukego
Yeah `M-x view-lossage' is only showing it as a plain 0. Maybe I will use this as an excuse to not learn paredit-mode today.
15:34:14
lukego
I'm using iTerm2 on macOS and talking to Emacs via ssh and tmux. (ugh.) I'm planning to switch to Linux desktop in a few weeks so maybe I'll kick the can until then.
15:39:59
vsync
if I decrease the fill pointer of an array, then increase it again, is there any risk the elements hidden in that interval will disappear?
15:40:50
Shinmera
if anything decreasing the fill pointer and not clearing out the elements can be a memory leak.
15:41:33
Fade
lukego: I've found inconsistent results using emacs/slime over ssh to a session suspended in a terminal multiplexer. does it still happen if you take tmux out of the stack?
15:43:36
lukego
Guess I'll revisit this when I'm "linux native." I might run Emacs locally instead of via ssh then.
15:44:19
davepdotorg
FWIW, macOS and iTerm2: if I emacs -nw locally and try C-0 I just get a self-insert command on 0, so that would seem to eliminate most things along that chain.
15:46:54
lukego
Shinmera: Thanks but I'm over the whole Mac thing and looking forward to putting it behind me.
16:26:40
phoe
https://gitlab.common-lisp.net/ansi-test/ansi-test/blob/master/printer/print-structure.lsp#L22
16:27:11
phoe
This is supposed to read in the form #S(print-struct-1 :foo 1 :bar 2) with standard IO syntax
19:01:07
Bike
the printing is done in the cl-user package, and without print-escape or print-readably so there should be no symbol prefix in the text
19:02:25
Bike
(defpackage "CL-TEST" (:use)) (write 'cl-test::foo :escape nil :readably nil) => FOO here
19:04:35
kpoeck
(with-standard-io-syntax (write-to-string foo :readably nil :case :upcase :escape nil))
19:09:32
Bike
(with-standard-io-syntax (write (list 'cl-test::foo (cl-test::make-foo)) :escape nil :readably nil :case :upcase)) prints (FOO #S(CL-TEST::FOO)) in my clasp
19:10:38
phoe
maybe let us start from the beginning - is the test testing what is mentioned in the spec
19:11:42
phoe
When the symbol is printed, if it is in the KEYWORD package, then it is printed with a preceding colon; otherwise, if it is accessible in the current package, it is printed without any package prefix; otherwise, it is printed with a package prefix.
19:11:49
Bike
clasp uses prin1 to print the class name, so it overrides the escape setting from outside
19:12:47
phoe
(write-to-string (cl-test::make-blah) :readably nil :case :upcase :escape nil) ;=> "#S(BLAH)"
19:14:44
Bike
i don't see anything saying it's printed abnormally, and if printed the same as everything else there shouldn't be a prefix.
19:14:59
phoe
once again: https://gitlab.common-lisp.net/ansi-test/ansi-test/blob/master/printer/print-structure.lsp#L22
19:15:19
Bike
well you said (write-to-string (cl-test::make-blah) :readably nil :case :upcase :escape nil) ;=> "#S(BLAH)"
19:15:32
Bike
that's not what i'm seeing on clasp or sbcl. presumably ccl's method doesn't prin1 in the same way
19:16:02
Bike
ccl doesn't seem to have a print-object method on structure-object, so i dunno where that would be defined
19:23:44
Bike
i guess? i'm not sure why the structure class name would be treated ddifferently, is all
19:26:08
phoe
because otherwise READ would read a symbol in the current package which is CL-USER which fails the test
19:26:43
Bike
listen. sbcl treats the structure class name specially. it uses prin1 to print it, so the outside readability and escape settings are discarded.
19:28:11
phoe
and I don't feel like forcing to let Paul dig up his memories from fifteen years ago again
19:29:32
phoe
22.1.3.3.1 says, When the symbol is printed, if it is in the KEYWORD package, then it is printed with a preceding colon; otherwise, if it is accessible in the current package, it is printed without any package prefix; otherwise, it is printed with a package prefix.
19:30:50
phoe
A symbol that is apparently uninterned is printed preceded by ``#:'' if *print-gensym* is true and printer escaping is enabled; if *print-gensym* is false or printer escaping is disabled, then the symbol is printed without a prefix, as if it were in the current package.
19:30:58
phoe
the part "if *print-gensym* is false or printer escaping is disabled, then the symbol is printed without a prefix, as if it were in the current package. "
19:31:13
phoe
does "the symbol" mean the symbol being printed, or that gensym that was just mentioned
19:32:29
phoe
since I think it means the gensym that was just mentioned, being on the same paragraph and all
19:33:47
Bike
none of that stuff should matter. the second sentence of 22.1.3.3 says the rest of the section doesn't apply unless printer escaping is enabled
19:34:31
phoe
why the hell does the test require that a symbol read with standard IO syntax be in CL-TEST package and not in CL-USER
19:36:35
Bike
like i said, i don't see anything saying the structure class name is necessarily printed with the prefix.
19:38:34
kpoeck
My last input: In 22.1.3.3 Printing Symbols it says ...The remainder of Section 22.1.3.3 applies only when printer escaping is enabled
19:40:16
Bike
well, i don't know, it might be ok to print the prefix for the structure class name, i just don't see anything saying it HAS to
19:41:53
kpoeck
so for me the solution is to change the test to: (assert (or (eq (car vals) 'print-struct-1) (eq (car vals) 'cl-user::'print-struct-1)))
19:43:12
kpoeck
(assert (or (eq (car vals) 'print-struct-1) (eq (car vals) 'cl-user::print-struct-1)))
19:58:44
kpoeck
(let ((symbol (car vals))) (assert (and (string-equal (symbol-name (car vals)) "print-struct-1") (or (eql (symbol-package symbol) (find-package :cl-user)) (eql (symbol-package symbol)(find-package :cl-test))))))