all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: display/encoding issue from python-code
Date: Mon, 12 Aug 2024 14:45:06 +0200	[thread overview]
Message-ID: <750d6ef2-ec28-4948-93f6-eacd21fff5ef@easy-emacs.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 897 bytes --]

Hi,

got a display and encoding issue from some python-code:

day = [
     r'\d{2}',    #  "DD"
]

In a plain python-file all seems fine.

See attached align-day.py

But, check with the following snippet:

(defun my-test()
   (interactive)
   (set-buffer (get-buffer-create "my-test-buffer"))
   (switch-to-buffer (current-buffer))
   (python-mode)
   (insert "day = [
     r'\d{2}',    #  \"DD\"
]"))

In my-test-buffer instead of

r'\d

appears

r'^?

See attached my-test.png

Not only that it looks strange, ‘\d’ now seems to count as one character 
in buffer, so ‘string-match’ for example doesn't return the correct 
position any more.

Setting ‘buffer-file-coding-system’ to ‘utf-8-unix’ explicitly didn't help.

Any suggestion?

Thanks,
Andreas

GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, 
cairo version 1.16.0) of 2024-08-12

[-- Attachment #2: align-day.py --]
[-- Type: text/x-python, Size: 35 bytes --]

day = [
    r'\d{2}'    #  "DD" 
]

[-- Attachment #3: my-test.png --]
[-- Type: image/png, Size: 123187 bytes --]

             reply	other threads:[~2024-08-12 12:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 12:45 Andreas Röhler [this message]
2024-08-12 13:03 ` display/encoding issue from python-code Stephen Berman
2024-08-12 18:22   ` Andreas Röhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=750d6ef2-ec28-4948-93f6-eacd21fff5ef@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.