Linus Björnstam writes: > On Tue, 3 Aug 2021, at 00:50, Vivien Kraus via General Guile related discussions wrote: >> (syntax-case >> (call-with-input-string "(a\r b)" read-syntax) () >> ((a b) >> (values (syntax-source #'a) (syntax-source #'b)))) >> >> => >> >> $1 = ((line . 0) (column . 1)) >> $2 = ((line . 0) (column . 1)) >> >> This is obviously because of #\return. > > Well, if anything this has confused the guile reader. It is probably a > bug: I suspect it resets the column because it anticipates a > windows-style newline. Maybe the correct behavior should be to entirely ignore #\return when computing the line/column? I see in libguile/ports.c (update_port_position) that #\return and #\backspace may break the monotony of the position by strictly reducing it. I read here: https://www.gnu.org/prep/standards/html_node/Errors.html#Errors that the recommended solution is to use wcwidth, to give every non-ASCII character at least a null width. Is there a reason not to use wcwidth? If not, what do you think of the attached patch? > But are you often dealing with lonely "\r" in sources? Using either > \n (unix-style) or \r\n (window-style) will give you the correct > results. Agreed. I don’t control the input, but I can silently drop all weird characters (#\return, #\backspace and #\alarm) and almost noone [1] will notice. Vivien [1] If it’s in a string literal, we can replace it with \r, \b or \a anyway.