unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Problems with a dynamic binding
@ 2020-03-15 15:56 Alan Mackenzie
  2020-03-15 16:14 ` Noam Postavsky
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2020-03-15 15:56 UTC (permalink / raw)
  To: emacs-devel

Hello, Emacs.

I'm going crazy!

In emacs -Q (whether emacs-27 or master), put the following into
*scratch*:

    (let ((print-escape-control-characters t)) "\n\r\t")

, and type C-u C-x C-e.  The expected result would be:

    "\12\15\11"

, but instead this is painted onto the screen:

    "
    ^M      "

.  As far as I can tell, the dynamic binding of p-e-c-c is being
correctly made.  If I do

    (setq print-escape-control-characters t)

, followed by executing the `let' form, I get the expected string with
octal escapes.  It is as though the print routine is ignoring the
dynamic binding entirely.

Help!  Am I doing something blaringly obviously wrong, that everybody
but me can see right away?

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).



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

* Re: Problems with a dynamic binding
  2020-03-15 15:56 Problems with a dynamic binding Alan Mackenzie
@ 2020-03-15 16:14 ` Noam Postavsky
  2020-03-15 16:33   ` Alan Mackenzie
  0 siblings, 1 reply; 3+ messages in thread
From: Noam Postavsky @ 2020-03-15 16:14 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: Emacs developers

On Sun, 15 Mar 2020 at 12:02, Alan Mackenzie <acm@muc.de> wrote:
>

>     (let ((print-escape-control-characters t)) "\n\r\t")
>
> , and type C-u C-x C-e.  The expected result would be:
>
>     "\12\15\11"
>
> , but instead this is painted onto the screen:
>
>     "
>     ^M      "

C-u C-x C-e prints the return value of C-x C-e into the buffer, but
that printing occurs after the let-bindings in the expression that
you've evaluated have finished. Try C-x C-e on the following instead

(let ((print-escape-newlines t)) (prin1 "\r\n" (current-buffer)))



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

* Re: Problems with a dynamic binding
  2020-03-15 16:14 ` Noam Postavsky
@ 2020-03-15 16:33   ` Alan Mackenzie
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2020-03-15 16:33 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Emacs developers

Hello, Noam.

On Sun, Mar 15, 2020 at 12:14:57 -0400, Noam Postavsky wrote:

[ .... ]

> C-u C-x C-e prints the return value of C-x C-e into the buffer, but
> that printing occurs after the let-bindings in the expression that
> you've evaluated have finished. Try C-x C-e on the following instead

> (let ((print-escape-newlines t)) (prin1 "\r\n" (current-buffer)))

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).



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

end of thread, other threads:[~2020-03-15 16:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-15 15:56 Problems with a dynamic binding Alan Mackenzie
2020-03-15 16:14 ` Noam Postavsky
2020-03-15 16:33   ` Alan Mackenzie

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