From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: pmercatoris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Dec 2022 03:35:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 60142@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16712480834369 (code B ref -1); Sat, 17 Dec 2022 03:35:03 +0000 Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 03:34:43 +0000 Received: from localhost ([127.0.0.1]:53349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6NyE-00018J-2o for submit@debbugs.gnu.org; Fri, 16 Dec 2022 22:34:43 -0500 Received: from lists.gnu.org ([209.51.188.17]:53822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6JbB-0007qn-1d for submit@debbugs.gnu.org; Fri, 16 Dec 2022 17:54:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6JbA-00009V-QP for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 17:54:36 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6Jb7-00081j-BC for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 17:54:36 -0500 Received: by mail-wm1-x329.google.com with SMTP id ja17so2833906wmb.3 for ; Fri, 16 Dec 2022 14:54:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:to:subject:from:date:from:to:cc:subject :date:message-id:reply-to; bh=IckLNHgqwF6ey9NUu1zVtIw4btcmAHxqeugLpXYAMC8=; b=N/fYKfDNFBHtgmLzS7VHNYaopx8+HwYQDpvfhaUwWbw0ol45ajgGu0gI7jBfg9MSgw ckWgmL9B1vGD6s2SOONc/xEg55sUvMV5u4DkdywqONOAtu7iPQctMx4obHsLc43DnLIN 0U7KOpwTylprig6YsQ0DvAN4fwLLjWbPFDcn8wsgYBXmmVjctXGVCM4XpfhVJQPisFTf MGY8p+fcUQOQwm0VOVAz2esivth3MLZKuDx8DIAS20mzDOsns81775lBwpUoMHo7J1c2 3RBWJuVC8BYIR2nx9LbeqUstDrtlrHZqNwSg39lfyOwrvVBagXtBs2xcU2t1nsIFM0Ia 8cVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:to:subject:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IckLNHgqwF6ey9NUu1zVtIw4btcmAHxqeugLpXYAMC8=; b=duNcG8TVXV7F1rbtLJ15HOY3+NZ7w02KkYW+hmbnW1qHs3nBjQVU530+q0QpWhPnkM y3oehxX9w1YVQao5HdynWdQFpWV6mvws7QleBmJ7U5AuO0iXMzZTAQ6kjk9542q7wwer Q/l4YiIGrlSYltKgDqf5q5wjVkGoP0MK15fwa090Q9Oe3E03bjRogyjefMrvHqeyk6Rn EU4Qhz6DqZZGeTIXiSboBwWcpc9RHgEfbjEE7Th/VupbC46XNR7JpNzwoOq0+dU4ntIV wfgk0dUQmrEdon7o5quWuY2lZxMJQI1WvoLdrFv4agnZuUbHjdlsxJ1BLiQLtl9/wJVk uQ+Q== X-Gm-Message-State: ANoB5pkI1CbnH73KeGmbciTXcsPLpJ7QOZQDCFqnH5g3obA1WdV2k2+H iVv2ZS4aGsM4s0zFS+57m/stErUXYWZL0w== X-Google-Smtp-Source: AA0mqf5Zop3fgFZMp59YWLDwaLQseEflmyzfK+WIibMlr3RptZXrauBCiO9mNuYt+paTQUqvLmXP+Q== X-Received: by 2002:a05:600c:554b:b0:3d2:1761:3742 with SMTP id iz11-20020a05600c554b00b003d217613742mr21137178wmb.15.1671231270329; Fri, 16 Dec 2022 14:54:30 -0800 (PST) Received: from [192.168.1.28] (239.47.76.188.dynamic.jazztel.es. [188.76.47.239]) by smtp.gmail.com with ESMTPSA id f24-20020a1c6a18000000b003b95ed78275sm3763680wmc.20.2022.12.16.14.54.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 14:54:29 -0800 (PST) Date: Fri, 16 Dec 2022 23:54:23 +0100 From: pmercatoris Message-Id: X-Mailer: geary/43.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-FLbspB5tltfBm87xaRfP" Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=mercatorispierre@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Mailman-Approved-At: Fri, 16 Dec 2022 22:34:38 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-FLbspB5tltfBm87xaRfP Content-Type: text/plain; charset=us-ascii; format=flowed Hello, First of all, this is my first bug report, I'm not sure I am doing this correctly, so forgive my ignorance. I am unable to get correct behavious when sending a region from indented code to the python shell. Consider this python code: ```python if True: if True: a = "test" ``` If I select the first `True` and `python-shell-send-region`, it will correctly send it to the consol and print `True`. Now if I do the same thing with the second `True` it will throw an error: `IndentationError: expected an indented block after 'if' statement on line 1` Although it would also reffer to unexpected block after `if` even it it were `for`, `try`, ... If I select the `a` or `a = "test"` it will correctly send it to the console, however it won't echo the evaluation of the statement. If I select the string "test" and send, it will throw the same error as the second True. My python config is very minimal: (use-package python :ensure nil :mode ("\\.py\\'" . python-mode) :init (setq-default indent-tabs-mode nil) :config (setq python-indent-offset 4 python-indent-guess-indent-offset-verbose nil ) (setq python-shell-interpreter "jupyter" python-shell-interpreter-args "console --simple-prompt" python-shell-prompt-detect-failure-warning nil) (add-to-list 'python-shell-completion-native-disabled-interpreters "jupyter")) Kind regards, Pierre In GNU Emacs 28.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-07-21 built on buildvm-x86-04.iad2.fedoraproject.org Windowing system distributor 'The X.Org Foundation', version 11.0.12201005 System Description: Fedora Linux 37 (Workstation Edition) Configured using: 'configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm --with-x-toolkit=gtk3 --with-gpm=no --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json --with-native-compilation build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=-Wl,-z,relro PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB Important settings: value of $LC_MONETARY: en_GB.UTF-8 value of $LC_NUMERIC: en_GB.UTF-8 value of $LC_TIME: en_GB.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Python Minor modes in effect: which-key-mode: t display-line-numbers-mode: t rainbow-delimiters-mode: t envrc-global-mode: t envrc-mode: t tree-sitter-hl-mode: t global-tree-sitter-mode: t tree-sitter-mode: t eglot--managed-mode: t flymake-mode: t marginalia-mode: t global-corfu-mode: t corfu-mode: t vertico-mode: t doom-modeline-mode: t global-undo-tree-mode: t undo-tree-mode: t global-evil-surround-mode: t evil-surround-mode: t global-evil-collection-unimpaired-mode: t evil-collection-unimpaired-mode: t shell-dirtrack-mode: t evil-mode: t evil-local-mode: t windmove-mode: t recentf-mode: t savehist-mode: t save-place-mode: t global-hl-line-mode: t electric-pair-mode: t delete-selection-mode: t override-global-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /home/pmercatoris/.config/emacs/elpa/transient-20221202.1727/transient hides /usr/share/emacs/28.1/lisp/transient Features: (shadow sort mail-extr emacsbug sendmail cua-base misearch multi-isearch avy evil-nerd-commenter evil-nerd-commenter-operator evil-nerd-commenter-sdk sgml-mode facemenu mule-util evil-collection-markdown-mode markdown-mode vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc evil-collection-which-key which-key face-remap display-line-numbers rainbow-delimiters envrc inheritenv tree-sitter-langs tree-sitter-langs-build evil-collection-tar-mode tar-mode evil-collection-arc-mode arc-mode archive-mode tree-sitter-hl tree-sitter tree-sitter-load tree-sitter-cli tsc tsc-dyn tsc-dyn-get dired-aux tsc-obsolete ob-python evil-collection-python python tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat ls-lisp hydra lv consult-eglot evil-collection-consult consult-vertico consult compat-28 evil-collection-bookmark bookmark evil-collection-eglot eglot array filenotify jsonrpc evil-collection-ert ert pp ewoc evil-collection-debug debug backtrace evil-collection-xref xref evil-collection-flymake flymake-proc flymake evil-collection-compile compile pcase project evil-collection-imenu imenu orderless marginalia evil-collection-corfu corfu evil-collection-vertico vertico doom-modeline doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path f f-shortdoc evil-collection-shortdoc shortdoc s all-the-icons all-the-icons-faces data-material data-weathericons data-octicons data-fileicons data-faicons data-alltheicons rainbow-mode xterm-color color ef-duo-dark-theme ef-themes undo-tree diff queue evil-surround evil-collection-unimpaired evil-collection-vc-git evil-collection-tabulated-list evil-collection-tab-bar evil-collection-speedbar evil-collection-simple evil-collection-replace evil-collection-process-menu evil-collection-package-menu evil-collection-outline evil-collection-org evil-collection-info evil-collection-indent evil-collection-image evil-collection-help evil-collection-gnus evil-collection-eww evil-collection-epa evil-collection-elisp-mode evil-collection-eldoc evil-collection-doc-view evil-collection-dired evil-collection-diff-mode evil-collection-comint evil-collection-calendar calc-ext evil-collection-calc evil-collection-buff-menu evil-collection-auto-package-update evil-collection annalist evil evil-integration evil-maps evil-commands reveal flyspell ispell evil-jumps evil-command-window evil-search evil-ex shell evil-types evil-macros evil-repeat evil-states evil-core comp comp-cstr warnings evil-common windmove calc calc-loaddefs calc-macs rect evil-digraphs evil-vars edmacro kmacro recentf tree-widget savehist saveplace hl-line elec-pair delsel no-littering compat compat-macs diary-lib diary-loaddefs auto-package-update dash use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key use-package-core finder-inf vc-git diff-mode vc-dispatcher org-element avl-tree generator ol-eww eww xdg url-queue thingatpt mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search eieio-opt speedbar ezimage dframe gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message rmc puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search mail-utils mm-util mail-prsvr wid-edit ol-docview doc-view jka-compr image-mode exif dired dired-loaddefs ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi cl-extra help-mode org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color ring org-list org-faces org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex iso8601 time-date ol rx org-keys oc org-compat advice org-macs org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs info package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv 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 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 simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads xwidget-internal dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 773438 128306) (symbols 48 46851 49) (strings 32 207758 12187) (string-bytes 1 6926856) (vectors 16 89108) (vector-slots 8 2338965 214323) (floats 8 1053 928) (intervals 56 7474 3578) (buffers 992 27)) --=-FLbspB5tltfBm87xaRfP Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable
Hello,

First of all, this is my first bug report, I'm not sure I am doing this<= /div>
correctly, so forgive my ignorance.

I am= unable to get correct behavious when sending a region from indented code
to the python shell. Consider this python code:

```python
if True:
    if True:
<= div>        a =3D "test"
```

If I select the first `True` and `python-shell-send-region`, it wi= ll
correctly send it to the consol and print `True`.
Now if I do the same thing with the second `True` it will thro= w an
error: `IndentationError: expected an indented block after '= if'
statement on line 1` Although it would also reffer to unexpec= ted block
after `if` even it it were `for`, `try`, ...
=
If I select the `a` or `a =3D "test"` it will correctly send= it to the
console, however it won't echo the evaluation of the s= tatement.

If I select the string "test" and send, = it will throw the same error as
the second True.

My python config is very minimal:

  = (use-package python
    :ensure nil
  &n= bsp; :mode
    ("\\.py\\'" . python-mode)
    :init
    (setq-default inden= t-tabs-mode nil)

    :config
&= nbsp;   (setq python-indent-offset 4
      &n= bsp;   python-indent-guess-indent-offset-verbose nil
  =         )

    (setq = python-shell-interpreter "jupyter"
        &n= bsp; python-shell-interpreter-args "console --simple-prompt"
&nbs= p;         python-shell-prompt-detect-failure-warning n= il)

    (add-to-list 'python-shell-compl= etion-native-disabled-interpreters
        &n= bsp;        "jupyter"))

Kind r= egards,
Pierre

In GNU Emacs 28.1 (build = 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6)
 of 2022-07-21 built on buildvm-x86-04.iad2.fedoraproject.org
Windowing system distributor 'The X.Org Foundation', version 11.0.= 12201005
System Description: Fedora Linux 37 (Workstation Edition= )

Configured using:
 'configure --b= uild=3Dx86_64-redhat-linux-gnu
 --host=3Dx86_64-redhat-linux= -gnu --program-prefix=3D
 --disable-dependency-tracking --pr= efix=3D/usr --exec-prefix=3D/usr
 --bindir=3D/usr/bin --sbin= dir=3D/usr/sbin --sysconfdir=3D/etc
 --datadir=3D/usr/share = --includedir=3D/usr/include --libdir=3D/usr/lib64
 --libexec= dir=3D/usr/libexec --localstatedir=3D/var
 --sharedstatedir= =3D/var/lib --mandir=3D/usr/share/man
 --infodir=3D/usr/shar= e/info --with-dbus --with-gif --with-jpeg --with-png
 --with= -rsvg --with-tiff --with-xpm --with-x-toolkit=3Dgtk3 --with-gpm=3Dno
<= div> --with-xwidgets --with-modules --with-harfbuzz --with-cairo --wit= h-json
 --with-native-compilation build_alias=3Dx86_64-redha= t-linux-gnu
 host_alias=3Dx86_64-redhat-linux-gnu CC=3Dgcc '= CFLAGS=3D-DMAIL_USE_LOCKF -O2
 -flto=3Dauto -ffat-lto-object= s -fexceptions -g -grecord-gcc-switches
 -pipe -Wall -Werror= =3Dformat-security -Wp,-D_FORTIFY_SOURCE=3D2
 -Wp,-D_GLIBCXX= _ASSERTIONS
 -specs=3D/usr/lib/rpm/redhat/redhat-hardened-cc= 1 -fstack-protector-strong
 -specs=3D/usr/lib/rpm/redhat/red= hat-annobin-cc1 -m64 -mtune=3Dgeneric
 -fasynchronous-unwind= -tables -fstack-clash-protection -fcf-protection'
 LDFLAGS= =3D-Wl,-z,relro
 PKG_CONFIG_PATH=3D:/usr/lib64/pkgconfig:/us= r/share/pkgconfig'

Configured features:
= ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP N= OTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT= _SCROLL_BARS
X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: en_GB.= UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  v= alue of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_US.UTF-8<= /div>
  value of $XMODIFIERS: @im=3Dibus
  locale-c= oding-system: utf-8-unix

Major mode: Python
<= div>
Minor modes in effect:
  which-key-mode: = t
  display-line-numbers-mode: t
  rainbow-de= limiters-mode: t
  envrc-global-mode: t
  env= rc-mode: t
  tree-sitter-hl-mode: t
  global-= tree-sitter-mode: t
  tree-sitter-mode: t
  e= glot--managed-mode: t
  flymake-mode: t
  mar= ginalia-mode: t
  global-corfu-mode: t
  corf= u-mode: t
  vertico-mode: t
  doom-modeline-m= ode: t
  global-undo-tree-mode: t
  undo-tree= -mode: t
  global-evil-surround-mode: t
  evi= l-surround-mode: t
  global-evil-collection-unimpaired-mode:= t
  evil-collection-unimpaired-mode: t
  she= ll-dirtrack-mode: t
  evil-mode: t
  evil-loc= al-mode: t
  windmove-mode: t
  recentf-mode:= t
  savehist-mode: t
  save-place-mode: t
  global-hl-line-mode: t
  electric-pair-mode: = t
  delete-selection-mode: t
  override-globa= l-mode: t
  global-eldoc-mode: t
  eldoc-mode= : t
  show-paren-mode: t
  electric-indent-mo= de: t
  mouse-wheel-mode: t
  file-name-shado= w-mode: t
  global-font-lock-mode: t
  font-l= ock-mode: t
  auto-composition-mode: t
  auto= -encryption-mode: t
  auto-compression-mode: t
&nb= sp; buffer-read-only: t
  column-number-mode: t
&n= bsp; line-number-mode: t
  transient-mark-mode: t
=
Load-path shadows:
/home/pmercatoris/.config/emacs= /elpa/transient-20221202.1727/transient hides /usr/share/emacs/28.1/lisp/tr= ansient

Features:
(shadow sort mail-extr= emacsbug sendmail cua-base misearch multi-isearch
avy evil-nerd-= commenter evil-nerd-commenter-operator
evil-nerd-commenter-sdk sg= ml-mode facemenu mule-util
evil-collection-markdown-mode markdown= -mode vc-mtn vc-hg vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc = evil-collection-which-key which-key
face-remap display-line-numbe= rs rainbow-delimiters envrc inheritenv
tree-sitter-langs tree-sit= ter-langs-build evil-collection-tar-mode
tar-mode evil-collection= -arc-mode arc-mode archive-mode tree-sitter-hl
tree-sitter tree-s= itter-load tree-sitter-cli tsc tsc-dyn tsc-dyn-get
dired-aux tsc-= obsolete ob-python evil-collection-python python tramp-sh
tramp t= ramp-loaddefs trampver tramp-integration files-x tramp-compat
ls-= lisp hydra lv consult-eglot evil-collection-consult consult-vertico
consult compat-28 evil-collection-bookmark bookmark
evil-colle= ction-eglot eglot array filenotify jsonrpc evil-collection-ert
er= t pp ewoc evil-collection-debug debug backtrace evil-collection-xref
<= div>xref evil-collection-flymake flymake-proc flymake
evil-collec= tion-compile compile pcase project evil-collection-imenu
imenu or= derless marginalia evil-collection-corfu corfu
evil-collection-ve= rtico vertico doom-modeline doom-modeline-segments
doom-modeline-= env doom-modeline-core shrink-path f f-shortdoc
evil-collection-s= hortdoc shortdoc s all-the-icons all-the-icons-faces
data-materia= l data-weathericons data-octicons data-fileicons
data-faicons dat= a-alltheicons rainbow-mode xterm-color color
ef-duo-dark-theme ef= -themes undo-tree diff queue evil-surround
evil-collection-unimpa= ired evil-collection-vc-git
evil-collection-tabulated-list evil-c= ollection-tab-bar
evil-collection-speedbar evil-collection-simple= evil-collection-replace
evil-collection-process-menu evil-collec= tion-package-menu
evil-collection-outline evil-collection-org evi= l-collection-info
evil-collection-indent evil-collection-image ev= il-collection-help
evil-collection-gnus evil-collection-eww evil-= collection-epa
evil-collection-elisp-mode evil-collection-eldoc
evil-collection-doc-view evil-collection-dired evil-collection-dif= f-mode
evil-collection-comint evil-collection-calendar calc-ext
evil-collection-calc evil-collection-buff-menu
evil-coll= ection-auto-package-update evil-collection annalist evil
evil-int= egration evil-maps evil-commands reveal flyspell ispell
evil-jump= s evil-command-window evil-search evil-ex shell evil-types
evil-m= acros evil-repeat evil-states evil-core comp comp-cstr warnings
e= vil-common windmove calc calc-loaddefs calc-macs rect evil-digraphs
evil-vars edmacro kmacro recentf tree-widget savehist saveplace hl-line<= /div>
elec-pair delsel no-littering compat compat-macs diary-lib
<= div>diary-loaddefs auto-package-update dash use-package use-package-ensure<= /div>
use-package-delight use-package-diminish use-package-bind-key bin= d-key
use-package-core finder-inf vc-git diff-mode vc-dispatcher = org-element
avl-tree generator ol-eww eww xdg url-queue thingatpt= mm-url ol-rmail
ol-mhe ol-irc ol-info ol-gnus nnselect gnus-sear= ch eieio-opt speedbar
ezimage dframe gnus-art mm-uu mml2015 mm-vi= ew mml-smime smime dig
gnus-sum shr kinsoku svg dom gnus-group gn= us-undo gnus-start gnus-dbus
dbus xml gnus-cloud nnimap nnmail ma= il-source utf7 netrc nnoo parse-time
gnus-spec gnus-int gnus-rang= e message rmc puny rfc822 mml mml-sec epa
derived epg rfc6068 epg= -config mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbr= ev gmm-utils mailheader gnus-win gnus nnheader gnus-util
rmail rm= ail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search
mail= -utils mm-util mail-prsvr wid-edit ol-docview doc-view jka-compr
= image-mode exif dired dired-loaddefs ol-bibtex ol-bbdb ol-w3m ol-doi
<= div>org-link-doi cl-extra help-mode org ob ob-tangle ob-ref ob-lob ob-table=
ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pc= omplete
comint ansi-color ring org-list org-faces org-entities no= utline outline
easy-mmode org-version ob-emacs-lisp ob-core ob-ev= al org-table oc-basic
bibtex iso8601 time-date ol rx org-keys oc = org-compat advice org-macs
org-loaddefs format-spec find-func cal= -menu calendar cal-loaddefs info
package browse-url url url-proxy= url-privacy url-expand url-methods
url-history url-cookie url-do= msuf url-util mailcap url-handlers
url-parse auth-source cl-seq e= ieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x= map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-load= defs cl-lib iso-transl tooltip eldoc paren
electric uniquify edif= f-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-wi= n term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fri= nge tabulated-list replace newcomment text-mode lisp-mode
prog-mo= de register page tab-bar menu-bar rfn-eshadow isearch easymenu
ti= mer select scroll-bar mouse jit-lock font-lock syntax font-core
t= erm/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms<= /div>
cp51932 hebrew greek romanian slovak czech european ethiopic indi= an
cyrillic chinese composite emoji-zwj charscript charprop case-= table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloa= ded nadvice
button loaddefs faces cus-face macroexp files window = text-properties
overlay sha1 md5 base64 format env code-pages mul= e custom widget
hashtable-print-readable backquote threads xwidge= t-internal dbusbind
inotify dynamic-setting system-font-setting f= ont-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty m= ake-network-process
native-compile emacs)

Memory information:
((conses 16 773438 128306)
 = (symbols 48 46851 49)
 (strings 32 207758 12187)
&= nbsp;(string-bytes 1 6926856)
 (vectors 16 89108)
=  (vector-slots 8 2338965 214323)
 (floats 8 1053 928)
 (intervals 56 7474 3578)
 (buffers 992 27))

--=-FLbspB5tltfBm87xaRfP-- From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 10:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: kobarity , Augusto Stoffel Cc: pmercatoris , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.167135994127283 (code B ref 60142); Sun, 18 Dec 2022 10:40:01 +0000 Received: (at 60142) by debbugs.gnu.org; 18 Dec 2022 10:39:01 +0000 Received: from localhost ([127.0.0.1]:33187 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6r4O-00075v-R4 for submit@debbugs.gnu.org; Sun, 18 Dec 2022 05:39:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59134) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6r4M-00075o-TY for 60142@debbugs.gnu.org; Sun, 18 Dec 2022 05:38:59 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6r4H-00067j-L9; Sun, 18 Dec 2022 05:38:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=jDt7DHVihSkXozZWOkxPYrkEnICKbisg9yRw6PeoH6w=; b=ZWzfqQ4V937V Hs815NT85XZzjRnAPqi8dQnhp6U8xcs7qdOoCeFfQnF93ozGD51GsUyMkUwgbo++8IlsYcRfTvcIv f2YQv9ZNspB3PSjwhe7vwaO6cc0uH4ZSCD0ZXS98D6LHVw6cCDzPeSWW2XpyUDLPtdMmfQXpos0zS rfdIOJKHpakcAfJ8bS9JcVp97iFxOb2fkQJ6+DqXRpiWudjzn2bYvWCm/xNYGYwedqTkrK1rQPlGo f1PKBtsrUn4mjPIHbhojB9kYpNaDBuU2My+RjtCfgbfA/wEqbDP1cy2rPXOR1zJytMcc4ymW0Esbc IX2TrZXS5VJYhlp+i3866g==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6r4H-000712-4R; Sun, 18 Dec 2022 05:38:53 -0500 Date: Sun, 18 Dec 2022 12:39:01 +0200 Message-Id: <83mt7lf12y.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from pmercatoris on Fri, 16 Dec 2022 23:54:23 +0100) References: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Fri, 16 Dec 2022 23:54:23 +0100 > From: pmercatoris > > I am unable to get correct behavious when sending a region from indented code > to the python shell. Consider this python code: > > ```python > if True: > if True: > a = "test" > ``` > > If I select the first `True` and `python-shell-send-region`, it will > correctly send it to the consol and print `True`. > > Now if I do the same thing with the second `True` it will throw an > error: `IndentationError: expected an indented block after 'if' > statement on line 1` Although it would also reffer to unexpected block > after `if` even it it were `for`, `try`, ... > > If I select the `a` or `a = "test"` it will correctly send it to the > console, however it won't echo the evaluation of the statement. > > If I select the string "test" and send, it will throw the same error as > the second True. > > My python config is very minimal: > > (use-package python > :ensure nil > :mode > ("\\.py\\'" . python-mode) > > :init > (setq-default indent-tabs-mode nil) > > :config > (setq python-indent-offset 4 > python-indent-guess-indent-offset-verbose nil > ) > > (setq python-shell-interpreter "jupyter" > python-shell-interpreter-args "console --simple-prompt" > python-shell-prompt-detect-failure-warning nil) > > (add-to-list 'python-shell-completion-native-disabled-interpreters > "jupyter")) Could you two please look into this? It sounds to me like Emacs works as expected here, but I'm not an expert on Python and our interfaces with it. Thanks. From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: Pierre Mercatoris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 15:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: kobarity , Augusto Stoffel , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.167137591225132 (code B ref 60142); Sun, 18 Dec 2022 15:06:01 +0000 Received: (at 60142) by debbugs.gnu.org; 18 Dec 2022 15:05:12 +0000 Received: from localhost ([127.0.0.1]:34382 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6vE0-0006XI-DP for submit@debbugs.gnu.org; Sun, 18 Dec 2022 10:05:12 -0500 Received: from mail-ej1-f42.google.com ([209.85.218.42]:33387) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6vDy-0006X8-Te for 60142@debbugs.gnu.org; Sun, 18 Dec 2022 10:05:11 -0500 Received: by mail-ej1-f42.google.com with SMTP id n20so16476361ejh.0 for <60142@debbugs.gnu.org>; Sun, 18 Dec 2022 07:05:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=aceXH8cXOVCz1ckXIOAM88iHsmJaAdD+sqbspP4hTSg=; b=Ck8j8GAFkAFTzKVT6qZxBS7m5tf9mFcG98L0XoY6d4QHvDs+lZfuw2nnLwkRAVzVuQ oHnt5PO0hcUVXN5n94AqR4mgl9SLKQE0vWNPkkYRQ24rud9+G2iow+dMpPxcIgLtSeNU uStxZ2rQPR61j5si3+/1A3HaS/lz8zUTNkEBX6+VNnSDXMQ4TA8Kk9egGJphq4u64LL1 6F7Q5FP9rVmGP/6Dil+bC49V10xyK8L34TbZPjVupJ4BQkwFjFkV8ZpBJaE3qq+bz3Ox kqNru1c3H09UboobVG4inu1IZXkb/tb8Y9a4mThxQpygCyoLx+JrE4Nq60WhXYkv5NF9 8cZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=aceXH8cXOVCz1ckXIOAM88iHsmJaAdD+sqbspP4hTSg=; b=mRAVqqRRE1igYTo9L6iFKO4P2Y2QcRnS+Q6bksWJybfAa253lRLkRP5aRri3q6NyuG kGCEuwx2BFqA8Clp3VW6cBoXYZz7cJ6NzupgQdQLg5aGk0UGqXcOgeayvbuBwEEQDHWF 8WtUnOrF6CkQRGbWaupiAKzTETL4T1YmKKUU/594u+SIB73VhDdSFRNm5WODUBdSifmJ hGe2NzN5E3ttGAQjLZ1fLiddBxwDSd4BDcn8LWCJQxPJTwPWhcnPz0H+mivuAI5TqhHv pR7Th9zgiMY0drUTZVskVp6xN6v8qZY8wLjxk8Ru5foZsb4eM2UyjIiKrhXVK8rV4iec 2JiQ== X-Gm-Message-State: ANoB5pmsE2flQ7ZwRATDby+N92Rb5gli6GFCVKJRcuXSXnf+dwc7tYfj bY1Ec0StEUglTeTpQ1KBC+xkWR6MNk3nPDzB2/rr1vJi X-Google-Smtp-Source: AA0mqf4yE7yye7aEqAxndsjcmV2Ryi/Sfgw/76JeazLqh75j+KVtCsadtisjQV3FRv7AJvAXQruUQnEpuTAIWhRKR0s= X-Received: by 2002:a17:907:774e:b0:7ae:39b4:7208 with SMTP id kx14-20020a170907774e00b007ae39b47208mr17821960ejc.766.1671375905077; Sun, 18 Dec 2022 07:05:05 -0800 (PST) MIME-Version: 1.0 References: <83mt7lf12y.fsf@gnu.org> In-Reply-To: <83mt7lf12y.fsf@gnu.org> From: Pierre Mercatoris Date: Sun, 18 Dec 2022 16:04:54 +0100 Message-ID: Content-Type: multipart/alternative; boundary="0000000000001bbf1e05f01b87e7" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --0000000000001bbf1e05f01b87e7 Content-Type: text/plain; charset="UTF-8" I wanted to give more details. But I basically get the same issue with Emacs -Q and the default python console. On Sun, 18 Dec 2022 at 11:38, Eli Zaretskii wrote: > > Date: Fri, 16 Dec 2022 23:54:23 +0100 > > From: pmercatoris > > > > I am unable to get correct behavious when sending a region from indented > code > > to the python shell. Consider this python code: > > > > ```python > > if True: > > if True: > > a = "test" > > ``` > > > > If I select the first `True` and `python-shell-send-region`, it will > > correctly send it to the consol and print `True`. > > > > Now if I do the same thing with the second `True` it will throw an > > error: `IndentationError: expected an indented block after 'if' > > statement on line 1` Although it would also reffer to unexpected block > > after `if` even it it were `for`, `try`, ... > > > > If I select the `a` or `a = "test"` it will correctly send it to the > > console, however it won't echo the evaluation of the statement. > > > > If I select the string "test" and send, it will throw the same error as > > the second True. > > > > My python config is very minimal: > > > > (use-package python > > :ensure nil > > :mode > > ("\\.py\\'" . python-mode) > > > > :init > > (setq-default indent-tabs-mode nil) > > > > :config > > (setq python-indent-offset 4 > > python-indent-guess-indent-offset-verbose nil > > ) > > > > (setq python-shell-interpreter "jupyter" > > python-shell-interpreter-args "console --simple-prompt" > > python-shell-prompt-detect-failure-warning nil) > > > > (add-to-list 'python-shell-completion-native-disabled-interpreters > > "jupyter")) > > Could you two please look into this? It sounds to me like Emacs works > as expected here, but I'm not an expert on Python and our interfaces > with it. > > Thanks. > --0000000000001bbf1e05f01b87e7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I wanted to give more details. But I basically get the sa= me issue with Emacs -Q and the default python console.=C2=A0

=
On Sun, 18= Dec 2022 at 11:38, Eli Zaretskii <eliz@= gnu.org> wrote:
> Date: Fri, 16 Dec 202= 2 23:54:23 +0100
> From: pmercatoris <mercatorispierre@gmail.com>
>
> I am unable to get correct behavious when sending a region from indent= ed code
> to the python shell. Consider this python code:
>
> ```python
> if True:
>=C2=A0 =C2=A0 =C2=A0if True:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0a =3D "test"
> ```
>
> If I select the first `True` and `python-shell-send-region`, it will > correctly send it to the consol and print `True`.
>
> Now if I do the same thing with the second `True` it will throw an
> error: `IndentationError: expected an indented block after 'if'= ;
> statement on line 1` Although it would also reffer to unexpected block=
> after `if` even it it were `for`, `try`, ...
>
> If I select the `a` or `a =3D "test"` it will correctly send= it to the
> console, however it won't echo the evaluation of the statement. >
> If I select the string "test" and send, it will throw the sa= me error as
> the second True.
>
> My python config is very minimal:
>
>=C2=A0 =C2=A0(use-package python
>=C2=A0 =C2=A0 =C2=A0:ensure nil
>=C2=A0 =C2=A0 =C2=A0:mode
>=C2=A0 =C2=A0 =C2=A0("\\.py\\'" . python-mode)
>
>=C2=A0 =C2=A0 =C2=A0:init
>=C2=A0 =C2=A0 =C2=A0(setq-default indent-tabs-mode nil)
>
>=C2=A0 =C2=A0 =C2=A0:config
>=C2=A0 =C2=A0 =C2=A0(setq python-indent-offset 4
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0python-indent-guess-indent-off= set-verbose nil
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)
>
>=C2=A0 =C2=A0 =C2=A0(setq python-shell-interpreter "jupyter"<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0python-shell-interpreter-args = "console --simple-prompt"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0python-shell-prompt-detect-fai= lure-warning nil)
>
>=C2=A0 =C2=A0 =C2=A0(add-to-list 'python-shell-completion-native-di= sabled-interpreters
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "ju= pyter"))

Could you two please look into this?=C2=A0 It sounds to me like Emacs works=
as expected here, but I'm not an expert on Python and our interfaces with it.

Thanks.
--0000000000001bbf1e05f01b87e7-- From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Dec 2022 22:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pierre Mercatoris Cc: Eli Zaretskii , Augusto Stoffel , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.167140238031444 (code B ref 60142); Sun, 18 Dec 2022 22:27:01 +0000 Received: (at 60142) by debbugs.gnu.org; 18 Dec 2022 22:26:20 +0000 Received: from localhost ([127.0.0.1]:36254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p726u-0008B6-7s for submit@debbugs.gnu.org; Sun, 18 Dec 2022 17:26:20 -0500 Received: from mail-qk1-f177.google.com ([209.85.222.177]:34427) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p726d-0008Ah-8y for 60142@debbugs.gnu.org; Sun, 18 Dec 2022 17:26:18 -0500 Received: by mail-qk1-f177.google.com with SMTP id pe2so3034268qkn.1 for <60142@debbugs.gnu.org>; Sun, 18 Dec 2022 14:26:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4Jrzc42XiWFWFz62RsYESwJMqkmnOnovZqNq6KJpgEg=; b=B2ALKdKYe46V6odvvUBNWDpoKde+WK+izGMUI8skrIDrJbJUwtZhskEDGfwuyaMYQ9 P1pj6/+0OmMhrYBv+4M7s1z83/Yqwhvc+fd8+2ddg+1YdMxq1Xwl5hUqewSS3pmBA3lu CbzqqY/FHsWnqOzTHGKRMwG8PLqFPRhhEBsj4coGcmu/5sw5aeQgjPYVMsD+AZUTIhUY Rhp6szU/YlPHR+fc2TIdmJgRPiurqZYLTFsp7buXy6ID2fPkPxZG5e/CawJe40Fkb/ie QWnev8TtdxSBTvduyuOR85KDvD5fNGiQhy/BGL+2k4j13CnM9Hzz7iBqLuRdzNgktsbl Givw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4Jrzc42XiWFWFz62RsYESwJMqkmnOnovZqNq6KJpgEg=; b=7DrRFxvCHuEiYhQSRwlKfYtx+RpZsShK0RGN/z3lBC/hZ/fXdu0cD3kAGJaPny2h27 14W3Urof5c+et2qQ1GN8j+v1E4Ng0KCwEpmpu7jKE06v0Z9rUnSgWbqKz2BAg1fhSI7O mvtXpGtIRKxKU22ykCMj1qwEKUMxMb7/H3yE3PBuu8riAzg6eQqxVf3ixgCi0gFZYX7B D4euOp6FkzYjPh6bSq3LZD2S0+xcwNfgy1V7h2HTkWnegIVpP/8vj/9oiV3wKUhhrl5E MFj6wNQLv6gDQUSDXwwnoEM1vrzhDpvaayCVya5NQrQtWqEnBpObGWnoY32bYMgQYnP0 ZOjg== X-Gm-Message-State: AFqh2kp5fU1epWZWn2g+GnV43gi5DFbPgj0qsRKCFRwquCprwYkGYPIk cvoxM4zkW14QXBCCdwrMEdN7iaTE0UvhpLvSv5c= X-Google-Smtp-Source: AMrXdXugVSz0IgylcCW0mlmK3JEOpPUiC1Xr0CRBVNo+jWQcSfZwVYWRC2g4KtAoTfm5IUCqfNEUKSdT2REDm0aey5g= X-Received: by 2002:a37:640e:0:b0:702:1765:8f38 with SMTP id y14-20020a37640e000000b0070217658f38mr659991qkb.608.1671402357265; Sun, 18 Dec 2022 14:25:57 -0800 (PST) MIME-Version: 1.0 References: <83mt7lf12y.fsf@gnu.org> In-Reply-To: From: kobarity Date: Mon, 19 Dec 2022 07:25:46 +0900 Message-ID: Content-Type: multipart/alternative; boundary="000000000000c81a9e05f021af4f" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000c81a9e05f021af4f Content-Type: text/plain; charset="UTF-8" Pierre Mercatoris : > > ```python >> > if True: >> > if True: >> > a = "test" >> > ``` >> > >> > If I select the first `True` and `python-shell-send-region`, it will >> > correctly send it to the consol and print `True`. >> > >> > Now if I do the same thing with the second `True` it will throw an >> > error: `IndentationError: expected an indented block after 'if' >> > statement on line 1` Although it would also reffer to unexpected block >> > after `if` even it it were `for`, `try`, ... >> > >> > If I select the `a` or `a = "test"` it will correctly send it to the >> > console, however it won't echo the evaluation of the statement. >> > >> > If I select the string "test" and send, it will throw the same error as >> > the second True. > > Hi, I could reproduce and workaround the bug. But could you give me a few more days to consider well and revise the patch? --000000000000c81a9e05f021af4f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Pierre Mercatoris <mercatorispierre@gmail.com&g= t;:
> ```python
> if True:
>=C2=A0 =C2=A0 =C2=A0if True:
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0a =3D "test"
> ```
>
> If I select the first `True` and `python-shell-send-region`, it will > correctly send it to the consol and print `True`.
>
> Now if I do the same thing with the second `True` it will throw an
> error: `IndentationError: expected an indented block after 'if'= ;
> statement on line 1` Although it would also reffer to unexpected block=
> after `if` even it it were `for`, `try`, ...
>
> If I select the `a` or `a =3D "test"` it will correctly send= it to the
> console, however it won't echo the evaluation of the statement. >
> If I select the string "test" and send, it will throw the sa= me error as
> the second True.

Hi,

I could reproduce and workaround the bug.=C2=A0 But c= ould you give me a few more days to consider well and revise the patch?

--000000000000c81a9e05f021af4f-- From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Dec 2022 03:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: kobarity Cc: arstoffel@gmail.com, mercatorispierre@gmail.com, 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.167142048318738 (code B ref 60142); Mon, 19 Dec 2022 03:29:02 +0000 Received: (at 60142) by debbugs.gnu.org; 19 Dec 2022 03:28:03 +0000 Received: from localhost ([127.0.0.1]:37498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p76os-0004sA-Np for submit@debbugs.gnu.org; Sun, 18 Dec 2022 22:28:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52068) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p76or-0004rl-AO for 60142@debbugs.gnu.org; Sun, 18 Dec 2022 22:28:01 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p76ol-0003mo-Qb; Sun, 18 Dec 2022 22:27:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=QmD4/EjIhlQD6UjT37g3z+QP6eQxrL3A1IIQj4V1XdE=; b=RWkbtWUHmy++ f7a3ykUBpLNnx5PkBFoDAXku/b4A9YbXosEB+Ohb1umaWuikeCQe86cEvhy9rXf1fwBbffk4U25Jp RED4lJqfns3NIW1B9twlzCLP8VjYDnzKRfNh8SJlQYx8J9wSfhG0AA7yurfMj//uFdvVk7Aku8lEc 0moAT7LtUk5Paz4PT5gxrUZYGKRAmsDbj79xLLF2FR8z1wuEC7KPXUeqW/HUXa1J1jnv1NZgDvQ6I Q5p7kgyEsa+DzEFmGKSFpC7AL1T8877oX/CsaCicgAx5h3/4ohuHhZDFKwmsV0OTIesAC/X+v1jVD sm69wwzDc+GC5eroeV9wNg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p76ok-0007aY-Tc; Sun, 18 Dec 2022 22:27:55 -0500 Date: Mon, 19 Dec 2022 05:28:03 +0200 Message-Id: <83zgbkdqd8.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from kobarity on Mon, 19 Dec 2022 07:25:46 +0900) References: <83mt7lf12y.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: kobarity > Date: Mon, 19 Dec 2022 07:25:46 +0900 > Cc: Eli Zaretskii , 60142@debbugs.gnu.org, > Augusto Stoffel > > I could reproduce and workaround the bug. But could you give me a few more days to consider well and > revise the patch? No problem, take your time. Thanks. From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Dec 2022 10:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: kobarity , pmercatoris , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.167144554013907 (code B ref 60142); Mon, 19 Dec 2022 10:26:02 +0000 Received: (at 60142) by debbugs.gnu.org; 19 Dec 2022 10:25:40 +0000 Received: from localhost ([127.0.0.1]:38232 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7DL1-0003cF-Sy for submit@debbugs.gnu.org; Mon, 19 Dec 2022 05:25:40 -0500 Received: from mail-ej1-f50.google.com ([209.85.218.50]:45883) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7DL0-0003c7-95 for 60142@debbugs.gnu.org; Mon, 19 Dec 2022 05:25:38 -0500 Received: by mail-ej1-f50.google.com with SMTP id fc4so20238475ejc.12 for <60142@debbugs.gnu.org>; Mon, 19 Dec 2022 02:25:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=2zjOdlZOtdJqnUSOUXsDt2v21qF8idvAG7LzFGv3KYc=; b=jCTJGKByFZBtC1sNxUSbqSmJi5K3do5iDsUScn89KYZ9G8BetCGipzX4EsKPbOI99y derjF8FdLMTENr3MaAyTbiAsHCaF9w3oTxwubztdFAKmyu++XzlVG4oGPfkKcpE1AzBU XvVKNHjXR2dA9Tmfjf2MGgkubcRhL3Ks5unjFb1v2Y54OIcstgks5tkvsmmwzjQXNcn5 p0Jd5AR8PikYoi66aPBgSESohPRWXSmXys4pU2qeW+/Yd1Vt3g8EhOlNuwQYtCyEzxQp Fm67A1d33Yo/l9VKoaYrUSgnvyputnTN2hshdclqZTFFxvgpyovgohxL3DIXEFFkXj6t p5cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2zjOdlZOtdJqnUSOUXsDt2v21qF8idvAG7LzFGv3KYc=; b=m/c0YUTNOjBW5Ug/zI0rMRqkelR2cweEv4Cetbun6njm5TFtAl1AUz4wwflkQx7TCk eBjNPplDFQ+EH6pdrIkCRytQWzYov/3kiZYrxbl2gJ4SWhnBTA4GgfLjWMI0bbzSmKW2 czREtLayVcI8Adkytf/hs4YdwIh/kJRgsl9XwIuv7LuAJNkxyp0cCy5J0EEgGOxndrOR 0Q2w6PgICBIv+K8Hx7MjuWmORJoy9PQ3PcZdX5aTXN7zYoLeLxbN6ZbuofYZcSWuGY75 hVldLVdo90IZyqSf1r1kav3frWTa4rB3K+E+9WFMvlTWEqY+6R0WhgQo9lDiGQORLcVA rrPw== X-Gm-Message-State: ANoB5pnAh9GhdSsmquz6BnbhMByb9bAuoV9rz3L4Uh9ytfaQBjxIXvnN tDgbgoo/NbDdGE92rKJ6fgacYB2EYpFhlw== X-Google-Smtp-Source: AA0mqf5pt5OXgSaT4pnMTl/tfRBvD0SN9oaZbwDLdkuZIgaszjbD7WamNUXvb+Nn5b7+lf7sZndKUQ== X-Received: by 2002:a17:906:2449:b0:7c0:f44d:984 with SMTP id a9-20020a170906244900b007c0f44d0984mr52909732ejb.74.1671445532355; Mon, 19 Dec 2022 02:25:32 -0800 (PST) Received: from ars3 ([2a02:8109:8ac0:56d0::a34]) by smtp.gmail.com with ESMTPSA id r9-20020a1709061ba900b00816edcb4e59sm1836391ejg.146.2022.12.19.02.25.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Dec 2022 02:25:31 -0800 (PST) From: Augusto Stoffel In-Reply-To: <83mt7lf12y.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 18 Dec 2022 12:39:01 +0200") References: <83mt7lf12y.fsf@gnu.org> Date: Mon, 19 Dec 2022 11:25:30 +0100 Message-ID: <87zgbjheqt.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Sun, 18 Dec 2022 at 12:39, Eli Zaretskii wrote: >> If I select the `a` or `a = "test"` it will correctly send it to the >> console, however it won't echo the evaluation of the statement. I can at least explain why this happens and is expected. An evaluation result is printed only if you send a bunch of statements, the last of which is an expression. OTOH, since whitespace is significant in Python, if you evaluate anything that's not a "toplevel form" it gets wrapper in a `if True:` statement, so the actually evaluated code is not a simple expression anymore. It seems hard to work around this limitation. From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 22 Dec 2022 16:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Augusto Stoffel , Eli Zaretskii , pmercatoris , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.16717270972137 (code B ref 60142); Thu, 22 Dec 2022 16:39:02 +0000 Received: (at 60142) by debbugs.gnu.org; 22 Dec 2022 16:38:17 +0000 Received: from localhost ([127.0.0.1]:36026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8OaG-0000YP-PG for submit@debbugs.gnu.org; Thu, 22 Dec 2022 11:38:17 -0500 Received: from mail-yw1-f175.google.com ([209.85.128.175]:35684) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p8OaE-0000YG-SY for 60142@debbugs.gnu.org; Thu, 22 Dec 2022 11:38:15 -0500 Received: by mail-yw1-f175.google.com with SMTP id 00721157ae682-45ef306bd74so34021397b3.2 for <60142@debbugs.gnu.org>; Thu, 22 Dec 2022 08:38:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=/e+OhHpyXoOLafGPKR9IzTLsa942PI28R6nHcB2gl7w=; b=Rm3VxzlPSeB6l3CH7fohos8dLdJKnwYIDTC8nGbk6qG5gfeYvrQIoZ5rQunlKoaQWd Bf310BibjN84VeTmUfsJwuO7QA9XaKLZm8Dwd4C557I75C4jA/yfPFOTJPH5/WvMln9P bxuvWXCuIvsYorNGsQEz7JybfPh06ExcidlIInF0bte73JyoGSC9OmKnJUp8G1BX95MJ oI0YLxXjj9roAhYVY7yRZQY5ODRrnBLvDDACxaeaiNAQuiPP+1AjvtvY3Jv6HJj25CCE SdkEQjtv+aduPOWyyKhMhgPbnJukqwYdxCjZIPmGUcykww5nz8qc79RhJmT0JVDzO2FN oEmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/e+OhHpyXoOLafGPKR9IzTLsa942PI28R6nHcB2gl7w=; b=c6s1N0hHQ6yqYPNfzgJhJ7nM3QO5AsGzWYJDvp/o0FptspQEuJCBcTgr9vyFu2Slvb WKKfLpq2Ddj96jNooQOfhyHPkQtiqn3u4KzRTX/+29fEAnTD/SCrtPagJtbn7RrdkG3G wz0pXYPvFSjmS80uTiWm8tcM8h9WEcO+mhO/z8/K5AS0dBNz8xZ4m30KfJcyDm6meA9d xIebgrSy29J43H6udO/HL3Jtpv1yFfAtIlAkqin6uWAj3ncV7m5c6uUnS1GLwncjToJx K9uEVWkNPrPOgf5T/ICDggz9+dgmwTIuJp8Gh/ndKKqS4WS5NXR6nlNysauc2MGFXya5 0qrw== X-Gm-Message-State: AFqh2kpCEiIMvg/Ra9SsloxgO8mU/7quFA8jfu4lbq3IWGuxtkklHPMW XrWMTEZ/nUj2eVaUJrT5MGmxbM44gQg= X-Google-Smtp-Source: AMrXdXvRidE0n+fx5UihMHs6JXVaQ1NOD9OAT2M97EQQIDqkvZc+8lrQqXBtiSQKoPUyLuYe040+sQ== X-Received: by 2002:a17:903:40c8:b0:189:65e7:e16b with SMTP id t8-20020a17090340c800b0018965e7e16bmr6676545pld.66.1671721296375; Thu, 22 Dec 2022 07:01:36 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id d4-20020a170903230400b001896af10ca7sm642632plh.134.2022.12.22.07.01.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Dec 2022 07:01:35 -0800 (PST) Date: Fri, 23 Dec 2022 00:01:15 +0900 Message-ID: From: kobarity In-Reply-To: <87zgbjheqt.fsf@gmail.com> References: <83mt7lf12y.fsf@gnu.org> <87zgbjheqt.fsf@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Fri_Dec_23_00:01:13_2022-1" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Multipart_Fri_Dec_23_00:01:13_2022-1 Content-Type: text/plain; charset=US-ASCII Augusto Stoffel wrote: > On Sun, 18 Dec 2022 at 12:39, Eli Zaretskii wrote: > >> If I select the `a` or `a = "test"` it will correctly send it to the > >> console, however it won't echo the evaluation of the statement. > > I can at least explain why this happens and is expected. > > An evaluation result is printed only if you send a bunch of statements, > the last of which is an expression. OTOH, since whitespace is > significant in Python, if you evaluate anything that's not a "toplevel > form" it gets wrapper in a `if True:` statement, so the actually > evaluated code is not a simple expression anymore. > > It seems hard to work around this limitation. Sorry for the late reply. As Augusto explained, `if True:` is added to the indented region. This behavior is documented in `python-shell-buffer-substring'. Maybe it's better to add a reference to `python-shell-buffer-substring' in the docstring of `python-shell-send-region'. What I'm trying to do is to improve the behavior in some use cases. Specifically, there is no need to add `if True:` if the region consists of a single statement such as `a` or `a = "test"`. Removing leading spaces should be enough to avoid an indentation error even if the single statement spans multiple lines. The corner case is the following use case. #+begin_src python if True: s = """ a = 1 b = 2 """ #+end_src Let's assume we want to send the lines "a = 1" and "b = 1" only. Although they are part of a single statement (multiline string), `if True:` should be added to avoid an indentation error. In other words, they should not be considered as a single statement. To address such situation, the single statement check should be done after calling `narrow-to-region'. Attached is a patch to achieve this. I appreciate your comments. Thanks, --Multipart_Fri_Dec_23_00:01:13_2022-1 Content-Type: application/octet-stream; type=patch; name="0001-Fix-python-shell-buffer-substring-when-retrieving-a-.patch" Content-Disposition: attachment; filename="0001-Fix-python-shell-buffer-substring-when-retrieving-a-.patch" Content-Transfer-Encoding: 7bit >From 5512a76bf696e33003cf3c2be7de6fe7c0464b98 Mon Sep 17 00:00:00 2001 From: kobarity Date: Thu, 22 Dec 2022 23:08:40 +0900 Subject: [PATCH] Fix python-shell-buffer-substring when retrieving a single statement * lisp/progmodes/python.el (python-shell-buffer-substring): Do not add "if True:" line when retrieving a single statement. (python-shell-send-region): Add a reference to `python-shell-buffer-substring' in docstring. * test/lisp/progmodes/python-tests.el (python-shell-buffer-substring-13) (python-shell-buffer-substring-14, python-shell-buffer-substring-15) (python-shell-buffer-substring-16, python-shell-buffer-substring-17): New tests. (Bug#60142) --- lisp/progmodes/python.el | 45 +++++++++++++------- test/lisp/progmodes/python-tests.el | 64 +++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 14 deletions(-) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index bdc9e6fa78..c808f57171 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -3717,19 +3717,35 @@ python-shell-buffer-substring appending extra empty lines so tracebacks are correct. 3. When the region sent is a substring of the current buffer, a coding cookie is added. - 4. Wraps indented regions under an \"if True:\" block so the - interpreter evaluates them correctly." - (let* ((start (save-excursion - ;; If we're at the start of the expression, and - ;; there's just blank space ahead of it, then expand - ;; the region to include the start of the line. - ;; This makes things work better with the rest of - ;; the data we're sending over. + 4. When the region consists of a single statement, leading + whitespaces will be removed. Otherwise, wraps indented + regions under an \"if True:\" block so the interpreter + evaluates them correctly." + (let* ((single-p (save-restriction + (narrow-to-region start end) + (= (progn + (goto-char start) + (python-nav-beginning-of-statement)) + (progn + (goto-char end) + (python-nav-beginning-of-statement))))) + (start (save-excursion + ;; If we're at the start of the expression, and if + ;; the region consists of a single statement, then + ;; remove leading whitespaces, else if there's just + ;; blank space ahead of it, then expand the region + ;; to include the start of the line. This makes + ;; things work better with the rest of the data + ;; we're sending over. (goto-char start) - (if (string-blank-p - (buffer-substring (line-beginning-position) start)) - (line-beginning-position) - start))) + (if single-p + (progn + (skip-chars-forward "[:space:]" end) + (point)) + (if (string-blank-p + (buffer-substring (line-beginning-position) start)) + (line-beginning-position) + start)))) (substring (buffer-substring-no-properties start end)) (starts-at-point-min-p (save-restriction (widen) @@ -3753,7 +3769,7 @@ python-shell-buffer-substring (python-mode) (when fillstr (insert fillstr)) - (when (not toplevel-p) + (when (and (not single-p) (not toplevel-p)) (forward-line -1) (insert "if True:\n") (delete-region (point) (line-end-position))) @@ -3797,7 +3813,8 @@ python-shell-send-region When called interactively SEND-MAIN defaults to nil, unless it's called with prefix argument. When optional argument MSG is non-nil, forces display of a user-friendly message if there's no -process running; defaults to t when called interactively." +process running; defaults to t when called interactively. The +substring to be sent is retrieved using `python-shell-buffer-substring'." (interactive (list (region-beginning) (region-end) current-prefix-arg t)) (let* ((string (python-shell-buffer-substring start end (not send-main) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 17d6d8aa70..930234a12f 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -4456,6 +4456,70 @@ python-shell-buffer-substring-12 (point-max)) "# -*- coding: utf-8 -*-\n\nif True:\n # Whitespace\n\n print ('a')\n\n")))) +(ert-deftest python-shell-buffer-substring-13 () + "Check substring from indented single statement." + (python-tests-with-temp-buffer + " +def foo(): + a = 1 +" + (should (string= (python-shell-buffer-substring + (python-tests-look-at "a = 1") + (pos-eol)) + "# -*- coding: utf-8 -*-\n\na = 1")))) + +(ert-deftest python-shell-buffer-substring-14 () + "Check substring from indented single statement spanning multiple lines." + (python-tests-with-temp-buffer + " +def foo(): + a = \"\"\"Some + string\"\"\" +" + (should (string= (python-shell-buffer-substring + (python-tests-look-at "a = \"\"\"Some") + (pos-eol 2)) + "# -*- coding: utf-8 -*-\n\na = \"\"\"Some\n string\"\"\"")))) + +(ert-deftest python-shell-buffer-substring-15 () + "Check substring from partial statement." + (python-tests-with-temp-buffer + " +def foo(): + a = 1 +" + (should (string= (python-shell-buffer-substring + (python-tests-look-at " a = 1") + (python-tests-look-at " = 1")) + "# -*- coding: utf-8 -*-\n\na")))) + +(ert-deftest python-shell-buffer-substring-16 () + "Check substring from partial statement." + (python-tests-with-temp-buffer + " +def foo(): + a = 1 +" + (should (string= (python-shell-buffer-substring + (python-tests-look-at "1") + (1+ (point))) + "# -*- coding: utf-8 -*-\n\n1")))) + +(ert-deftest python-shell-buffer-substring-17 () + "Check substring from multiline string." + (python-tests-with-temp-buffer + " +def foo(): + s = \"\"\" + a = 1 + b = 2 +\"\"\" +" + (should (string= (python-shell-buffer-substring + (python-tests-look-at "a = 1") + (python-tests-look-at "\"\"\"")) + "# -*- coding: utf-8 -*-\n\nif True:\n a = 1\n b = 2\n\n")))) + ;;; Shell completion -- 2.34.1 --Multipart_Fri_Dec_23_00:01:13_2022-1-- From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: Pierre Mercatoris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Dec 2022 13:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: kobarity Cc: Eli Zaretskii , Augusto Stoffel , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.167240611810893 (code B ref 60142); Fri, 30 Dec 2022 13:16:02 +0000 Received: (at 60142) by debbugs.gnu.org; 30 Dec 2022 13:15:18 +0000 Received: from localhost ([127.0.0.1]:33711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBFED-0002nz-Rp for submit@debbugs.gnu.org; Fri, 30 Dec 2022 08:15:18 -0500 Received: from mail-ed1-f43.google.com ([209.85.208.43]:35486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBFEB-0002Oc-UJ for 60142@debbugs.gnu.org; Fri, 30 Dec 2022 08:15:16 -0500 Received: by mail-ed1-f43.google.com with SMTP id i15so30493201edf.2 for <60142@debbugs.gnu.org>; Fri, 30 Dec 2022 05:15:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NEMJov1wPHpI2Rs1JqiGyP3AM6B5W8GGzO1FClBf9YA=; b=InQKpGHvXn7knxkasB+/mljk3WWebAJfop8tg2bDUqx061KnxmtkfhPTXSxnB1thTU x2hik7Jhv8zwUFAeqQlH4q3j2uJh7ORU6Xfm1zyh96rLii8/roOe9YUJoRBdREItgaOO bGEXA2P1ri6lVVzD7uq3enB//B/g7+B+1iLlYIn+nVcc4FRmkY+a14F/s/K6vWe+3g8L ZyRhMHla5tf8kiSKh60b+k69Z2eOkTOAvzP//xfcXshucF6htIn41ksN0OPZ5I6IPKLc 3qAHjQmpJYKkaIghIccqAXttv/nQjxObGvaoyp0OtIG7sF6EBRo5ZfFPkU+R3AkpFkF6 HCeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NEMJov1wPHpI2Rs1JqiGyP3AM6B5W8GGzO1FClBf9YA=; b=VYHH29FN+g8cjcS9oR7FvyggK6lcd2mXeVbzRsiqJZYbMsJjLXF8/O4NkSb5M4jou8 +Q9/XmoTFjXj3xlcbalGI+4fbj5/i4XjQjBcHz9b7vSyy3sCSvZhYV5vU5uR9y8eH2uv RFSuPAUZCQvrEEgF4n28olgulz6Oin3XlzzIkqM+SkGScboMfBySe69mu5SFXJcdHK8l n61K+gU8PN2b6HgIZ1HtVi0LUsAaxzMV6O/dY9YD9ZBPyObjf1Cs0AOG4vWD6wY5OMBH uLmaN649ArD5yfFYIe9Brlp9riHsOqDmuFtkQV6kTRFyMacHVa6PxZKYjdQT+adMPQyy U1/w== X-Gm-Message-State: AFqh2krpUL+6boerKImKKo8u6LTDp9DR3aYz60i5OF+Qkwb4aAc5DuQ5 1loFK55rX2TcGwuB1D/ZYXsD6g0dRokVCRQQvA4= X-Google-Smtp-Source: AMrXdXuNJr/VBnV+GL2cymOSXug9teNSFnS7bvEKECiKDBe1hSV3E+3TgHrCq8RUGgY4+ba38112mLMF3iea3nmiGsk= X-Received: by 2002:a05:6402:3809:b0:48a:5f4c:c1a with SMTP id es9-20020a056402380900b0048a5f4c0c1amr341874edb.298.1672406109743; Fri, 30 Dec 2022 05:15:09 -0800 (PST) MIME-Version: 1.0 References: <83mt7lf12y.fsf@gnu.org> <87zgbjheqt.fsf@gmail.com> In-Reply-To: From: Pierre Mercatoris Date: Fri, 30 Dec 2022 14:14:58 +0100 Message-ID: Content-Type: multipart/alternative; boundary="000000000000176fab05f10b64e2" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000176fab05f10b64e2 Content-Type: text/plain; charset="UTF-8" Hello and sorry for the late reply.. Excuse my ignorance, but how would I need to go about to apply those changes to test them? Furthermore, I am not sure the main issue I raised has been diluted. Basically I was wondering why a region, which does not include any indentation (as it is a fragment of a line), is sent to the repl results in indentation error if the life the fragment comes from was indented. In the case Kobarty described above, he is mentioning sending the whole line to the repl, in which case it can be debated how to deal with indentation. However, my issue is that equivalent regions sent to the repl without any indentation within them results in different behaviours depending on where those regions (fragments of line) come from. I hope I could explain myself better. Thank you all for your interest in the matter. On Thu, Dec 22, 2022 at 4:01 PM kobarity wrote: > Augusto Stoffel wrote: > > On Sun, 18 Dec 2022 at 12:39, Eli Zaretskii wrote: > > >> If I select the `a` or `a = "test"` it will correctly send it to the > > >> console, however it won't echo the evaluation of the statement. > > > > I can at least explain why this happens and is expected. > > > > An evaluation result is printed only if you send a bunch of statements, > > the last of which is an expression. OTOH, since whitespace is > > significant in Python, if you evaluate anything that's not a "toplevel > > form" it gets wrapper in a `if True:` statement, so the actually > > evaluated code is not a simple expression anymore. > > > > It seems hard to work around this limitation. > > Sorry for the late reply. > > As Augusto explained, `if True:` is added to the indented region. > This behavior is documented in `python-shell-buffer-substring'. Maybe > it's better to add a reference to `python-shell-buffer-substring' in > the docstring of `python-shell-send-region'. > > What I'm trying to do is to improve the behavior in some use cases. > Specifically, there is no need to add `if True:` if the region > consists of a single statement such as `a` or `a = "test"`. Removing > leading spaces should be enough to avoid an indentation error even if > the single statement spans multiple lines. > > The corner case is the following use case. > > #+begin_src python > if True: > s = """ > a = 1 > b = 2 > """ > #+end_src > > Let's assume we want to send the lines "a = 1" and "b = 1" only. > Although they are part of a single statement (multiline string), `if > True:` should be added to avoid an indentation error. In other words, > they should not be considered as a single statement. To address such > situation, the single statement check should be done after calling > `narrow-to-region'. > > Attached is a patch to achieve this. I appreciate your comments. > > Thanks, > --000000000000176fab05f10b64e2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello and sorry for the late reply..

Excuse my ignorance, but how would I need to go about to apply tho= se changes to test them?

Furthermore, I am not sur= e the main issue I raised has been diluted. Basically I was wondering why a= region, which does not include any indentation (as it is a fragment of a l= ine), is sent to the repl results in indentation error if the life the frag= ment comes from was indented. In the case Kobarty described above, he is me= ntioning sending the whole line to the repl, in which case it can be debate= d how to deal with indentation. However, my issue is that equivalent region= s sent to the repl without any indentation within them results in different= behaviours depending on where those regions (fragments of line) come from.=

I hope I could explain myself better.
<= div>
Thank you all for your interest in the matter.

On T= hu, Dec 22, 2022 at 4:01 PM kobarity <kobarity@gmail.com> wrote:
Augusto Stoffel wrote:
> On Sun, 18 Dec 2022 at 12:39, Eli Zaretskii wrote:
> >> If I select the `a` or `a =3D "test"` it will corre= ctly send it to the
> >> console, however it won't echo the evaluation of the stat= ement.
>
> I can at least explain why this happens and is expected.
>
> An evaluation result is printed only if you send a bunch of statements= ,
> the last of which is an expression.=C2=A0 OTOH, since whitespace is > significant in Python, if you evaluate anything that's not a "= ;toplevel
> form" it gets wrapper in a `if True:` statement, so the actually<= br> > evaluated code is not a simple expression anymore.
>
> It seems hard to work around this limitation.

Sorry for the late reply.

As Augusto explained, `if True:` is added to the indented region.
This behavior is documented in `python-shell-buffer-substring'. Maybe it's better to add a reference to `python-shell-buffer-substring' i= n
the docstring of `python-shell-send-region'.

What I'm trying to do is to improve the behavior in some use cases.
Specifically, there is no need to add `if True:` if the region
consists of a single statement such as `a` or `a =3D "test"`.=C2= =A0 Removing
leading spaces should be enough to avoid an indentation error even if
the single statement spans multiple lines.

The corner case is the following use case.

#+begin_src python
if True:
=C2=A0 =C2=A0 s =3D """
=C2=A0 =C2=A0 a =3D 1
=C2=A0 =C2=A0 b =3D 2
"""
#+end_src

Let's assume we want to send the lines "a =3D 1" and "b = =3D 1" only.
Although they are part of a single statement (multiline string), `if
True:` should be added to avoid an indentation error.=C2=A0 In other words,=
they should not be considered as a single statement.=C2=A0 To address such<= br> situation, the single statement check should be done after calling
`narrow-to-region'.

Attached is a patch to achieve this.=C2=A0 I appreciate your comments.

Thanks,
--000000000000176fab05f10b64e2-- From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Dec 2022 15:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pierre Mercatoris Cc: Eli Zaretskii , Augusto Stoffel , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.167241442031777 (code B ref 60142); Fri, 30 Dec 2022 15:34:02 +0000 Received: (at 60142) by debbugs.gnu.org; 30 Dec 2022 15:33:40 +0000 Received: from localhost ([127.0.0.1]:35937 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBHO7-0008GT-QL for submit@debbugs.gnu.org; Fri, 30 Dec 2022 10:33:40 -0500 Received: from mail-pg1-f173.google.com ([209.85.215.173]:35603) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBHO6-0008GG-At for 60142@debbugs.gnu.org; Fri, 30 Dec 2022 10:33:38 -0500 Received: by mail-pg1-f173.google.com with SMTP id f3so14406507pgc.2 for <60142@debbugs.gnu.org>; Fri, 30 Dec 2022 07:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=bN0LnKf5dPmG3lJzCEKiE5uLWGSsRPy/4ekuLVB95nw=; b=kxzsCTOLEoJddLJB04Tr61TBpN1dKTSSr7Osuaw3HpYRWPjYyvkaQ4iANv9aYJltVS 5ZFjNpuyG/c2OUNFcunLT8g9gu7cEqrOIQkKFw08ZJaz+uuCpnfXj2kQDoW506s1HeHB kmw0aK6XZ7wJD3wHCDM7ISwMJYHUQLjj/PvrzbaSlbcET63ctcV6ZOi9C5jH3r6GWo9t tGG8QPZrhJEZFY10m2j70e6li9j+t36qhiAJH6jGARqFcm7xklRk4iGagSGfFvye9vFW vlGFd1RGH3+FDSUPrKhH7f4hOtrL4TEeyQBrBZG/GrwK5uu7jxEQZ043MgNMOAx10YG4 VZmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bN0LnKf5dPmG3lJzCEKiE5uLWGSsRPy/4ekuLVB95nw=; b=XvjVicNQ/EWKx5JHyqkhfIHzLgplByOU7v9g+fVREjqW6HB7ICMRIRSUbQgwCbCS9d 1AngBpTvPKdUeMY5RxtU57VrilB6UFn6MdgO1llT4pbJ10dlk5btJ8uRspR7YBU4a5Fx q97kOGafWGKTIOOrc7NcpmfSTb+Li4MHpG9z6YEPcv2Vp7SzBiBcDVVpcXpMxL9/5PhB W3deLbozUgzj7hS0pjlW7ndCoPFri2gjRG+LDbTtnsm3iWng3lvpl1LTDLTBiFTiVDB8 0ENlhXB2vT2n5YedBkQuuEpaJIaeKkRy9LD0F3YIEYHo9wAxvFamdLSzwlTiMTNWQ7Zy 5sSw== X-Gm-Message-State: AFqh2ko+lvuQAv/n8PB3Tid34pHeC/f3h7iX0LzcaWVpaK+LXSpcfMNi wtEuLo+UjgTXx5WwNZS+Pto= X-Google-Smtp-Source: AMrXdXtGUXfqxRNgiRBX8Sph+LzP7SxAjkDXIeE78Saa/7K2iJruFp5ildcOZt9qqc4J9C3vHxsqZQ== X-Received: by 2002:a05:6a00:1255:b0:576:b8e1:862b with SMTP id u21-20020a056a00125500b00576b8e1862bmr41242230pfi.14.1672414412275; Fri, 30 Dec 2022 07:33:32 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id x74-20020a62864d000000b0058217bbc6f5sm388860pfd.215.2022.12.30.07.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 07:33:31 -0800 (PST) Date: Sat, 31 Dec 2022 00:33:13 +0900 Message-ID: From: kobarity In-Reply-To: References: <83mt7lf12y.fsf@gnu.org> <87zgbjheqt.fsf@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: multipart/mixed; boundary="Multipart_Sat_Dec_31_00:33:10_2022-1" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --Multipart_Sat_Dec_31_00:33:10_2022-1 Content-Type: text/plain; charset=US-ASCII Hi, Pierre Mercatoris wrote: > Excuse my ignorance, but how would I need to go about to apply those changes > to test them? The patch in my previous mail is a diff to master branch of Emacs. I attached a patch to python.el of Emacs 28.1. It can be applied as follows: % patch python.el python.el.28.1.patch After starting Emacs, I recommend to do 'M-x load-file' and specify the patched python.el to avoid loading the old python.elc. > Furthermore, I am not sure the main issue I raised has been diluted. Basically > I was wondering why a region, which does not include any indentation (as it is > a fragment of a line), is sent to the repl results in indentation error if the > life the fragment comes from was indented. In the case Kobarty described > above, he is mentioning sending the whole line to the repl, in which case it > can be debated how to deal with indentation. However, my issue is that > equivalent regions sent to the repl without any indentation within them > results in different behaviours depending on where those regions (fragments of > line) come from. My explanation was probably misleading. I'm not saying that the whole line should be sent to the REPL. My point was that if the content sent to the REPL is one statement, there is no need to add `if True:`. Please note that a "statement" in python.el is a logical unit based on Python syntax and differs from physical lines. A statement can be part of a physical line, and it can also spans multiple physical lines. As Augusto pointed out, current Emacs python.el adds `if True:` if the lines of the region was originally indented. For example, let's consider the following code. #+begin_src python def func(): a = 1 b = 2 #+end_src If we set the region to "a = 1" and call `python-shell-send-region', the following code will be sent to the REPL. #+begin_src python if True: a = 1 #+end_src Even if the region is set to only "a", the following code will be sent. #+begin_src python if True: a #+end_src Adding `if True:` is reasonable if the indented region spans multiple lines. For example, if the region is "a = 1\n b = 2", the following code will be sent. #+begin_src python if True: a = 1 b = 2 #+end_src If the region "a = 1\n b = 2" or " a = 1\n b = 2" is sent as is, an indentation error will occur. I think current `python-shell-send-region' focuses on sending a region of multiple lines and does not take into account sending part of a line. As I mentioned above, my patch is intended to improve this behavior. If the region is "a = 1", or even " a = 1", the following code will be sent because this is a single statement. #+begin_src python a = 1 #+end_src I think this behavior is what you expected. Please note that the above explanation is a bit simplified. The actual contents `python-shell-send-region' sends includes a coding cookie and empty lines. Please see docstring of `python-shell-buffer-substring' for more details. I hope this clarifies things. Regards, --Multipart_Sat_Dec_31_00:33:10_2022-1 Content-Type: application/octet-stream; type=patch; name="python.el.28.1.patch" Content-Disposition: attachment; filename="python.el.28.1.patch" Content-Transfer-Encoding: 7bit --- python.el.orig 2022-12-30 23:17:47.490936027 +0900 +++ python.el 2022-12-30 23:19:25.555944407 +0900 @@ -3262,19 +3262,35 @@ appending extra empty lines so tracebacks are correct. 3. When the region sent is a substring of the current buffer, a coding cookie is added. - 4. Wraps indented regions under an \"if True:\" block so the - interpreter evaluates them correctly." - (let* ((start (save-excursion - ;; If we're at the start of the expression, and - ;; there's just blank space ahead of it, then expand - ;; the region to include the start of the line. - ;; This makes things work better with the rest of - ;; the data we're sending over. + 4. When the region consists of a single statement, leading + whitespaces will be removed. Otherwise, wraps indented + regions under an \"if True:\" block so the interpreter + evaluates them correctly." + (let* ((single-p (save-restriction + (narrow-to-region start end) + (= (progn + (goto-char start) + (python-nav-beginning-of-statement)) + (progn + (goto-char end) + (python-nav-beginning-of-statement))))) + (start (save-excursion + ;; If we're at the start of the expression, and if + ;; the region consists of a single statement, then + ;; remove leading whitespaces, else if there's just + ;; blank space ahead of it, then expand the region + ;; to include the start of the line. This makes + ;; things work better with the rest of the data + ;; we're sending over. (goto-char start) - (if (string-blank-p - (buffer-substring (line-beginning-position) start)) - (line-beginning-position) - start))) + (if single-p + (progn + (skip-chars-forward "[:space:]" end) + (point)) + (if (string-blank-p + (buffer-substring (line-beginning-position) start)) + (line-beginning-position) + start)))) (substring (buffer-substring-no-properties start end)) (starts-at-point-min-p (save-restriction (widen) @@ -3297,7 +3313,7 @@ (insert fillstr)) (insert substring) (goto-char (point-min)) - (when (not toplevel-p) + (when (and (not single-p) (not toplevel-p)) (insert "if True:") (delete-region (point) (line-end-position))) (when nomain @@ -3339,7 +3355,8 @@ When called interactively SEND-MAIN defaults to nil, unless it's called with prefix argument. When optional argument MSG is non-nil, forces display of a user-friendly message if there's no -process running; defaults to t when called interactively." +process running; defaults to t when called interactively. The +substring to be sent is retrieved using `python-shell-buffer-substring'." (interactive (list (region-beginning) (region-end) current-prefix-arg t)) (let* ((string (python-shell-buffer-substring start end (not send-main) --Multipart_Sat_Dec_31_00:33:10_2022-1-- From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: Pierre Mercatoris Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Dec 2022 16:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: kobarity Cc: Eli Zaretskii , Augusto Stoffel , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.16724181806216 (code B ref 60142); Fri, 30 Dec 2022 16:37:01 +0000 Received: (at 60142) by debbugs.gnu.org; 30 Dec 2022 16:36:20 +0000 Received: from localhost ([127.0.0.1]:36001 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBIMl-0001cB-SC for submit@debbugs.gnu.org; Fri, 30 Dec 2022 11:36:20 -0500 Received: from mail-ej1-f44.google.com ([209.85.218.44]:44849) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBIMk-0001bw-8E for 60142@debbugs.gnu.org; Fri, 30 Dec 2022 11:36:18 -0500 Received: by mail-ej1-f44.google.com with SMTP id x22so52299635ejs.11 for <60142@debbugs.gnu.org>; Fri, 30 Dec 2022 08:36:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UlF9I/AkiJ5EnV+My4KFUKfi3DMNOtHu+yIrDB1mIyE=; b=qi13FwGnPW1B/80tNqTcMG9O8KOuh3OpZqtIBqpBEe56jd2hmmPq99CRQYvVKwWvZm 1NGk42qteGLANtdrIlsO5Cu2whAkgCKN2dgGQTCpur7GYgh5xS5S5FDm27b24yfuydxP Aqr6p7+s0gCgiCd2D0/hyVauasRDCo9adAOApk5Xa2Ed8eVml0Yor20wuwHLJqI4RJIU TmFDcQGoxRe4OcwqufDa6beINO2Ox2gXY8z5OZurrobfzRHigpv975bNCaU9DT3L+8hK A9qhCIzXK49MbRp1kIjQ415r4KyGpbBweHQDOAJw7SacoLDm39r8ljEWOHURlhiB3Bl1 oddw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UlF9I/AkiJ5EnV+My4KFUKfi3DMNOtHu+yIrDB1mIyE=; b=CrshHpUXGhJL7lWspiHf/LIPdq0LxaRuaEcOMrWVfvZlrWqH8Rd4OvA3jcY1a/ZeCC W4i9ZDl2WTV/WdIOW739uTu6G6Q1jZtMcv5XEz29IpwnMs2F0LqN3F7/YvAThnBHoNK5 pHJ2cMT9cfRtHtR2PUpRn3V69druPkWV2h2cTDafo6nfOfqMqDUim3rXti+cPOwItZO4 +de1NwrWLFPfqYYWmpYgak3Zph6hhgggc/rNZJYEV40mYjJXov4yJmeokV9Nsz4ppPiC w9HJQqrhKbcxUeTJibrSl64+6HOp+c8Ln1QhLPEz7k1+SaFzs1rJuMo6XOOXWxeZVyon PHPQ== X-Gm-Message-State: AFqh2kqs+GxOF6ZlV/qMIg/xEVvxbio7RKu4+B6NPfZpsWCJxKtRa9x4 Oy/HvZ9w69Xh3mfvlVopwB4u0WwdyGM7JjMx70Q= X-Google-Smtp-Source: AMrXdXsP64Bre7DmFBcoSf4dw24/eNeNwu4A4H9b5L3tyAFrr8zQ70OJUfpE9ne6YyhmcNQTtM0kCHwSA8YFbBmmd0w= X-Received: by 2002:a17:906:6955:b0:7de:e268:2069 with SMTP id c21-20020a170906695500b007dee2682069mr3205381ejs.341.1672418172078; Fri, 30 Dec 2022 08:36:12 -0800 (PST) MIME-Version: 1.0 References: <83mt7lf12y.fsf@gnu.org> <87zgbjheqt.fsf@gmail.com> In-Reply-To: From: Pierre Mercatoris Date: Fri, 30 Dec 2022 17:36:00 +0100 Message-ID: Content-Type: multipart/alternative; boundary="000000000000100f0e05f10e33e3" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --000000000000100f0e05f10e33e3 Content-Type: text/plain; charset="UTF-8" Thank you so much for your detailed and simplified explanations, I highly appreciate it. I can confirm after applying the latest patch you provided that I am now getting the expected behaviour of being able to send statements regardless of their indentation. This will fundamentally improve my daily use of emacs. Thank you so much for that. Regarding the patch, is there anything that should be done in order for the patch to be applied in an incoming Emacs release? Kind regards, Pierre --000000000000100f0e05f10e33e3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you so much for your detailed and simplified ex= planations, I highly appreciate it.

I can confirm = after applying the latest patch you provided that I am now getting the expe= cted behaviour
of being able to send statements regardless of the= ir indentation. This will fundamentally improve my daily
use of e= macs. Thank you so much for that.

Regarding the pa= tch, is there anything that should be done in order for the patch to be app= lied in an incoming
Emacs release?

= Kind regards,
Pierre
<= /div> --000000000000100f0e05f10e33e3-- From unknown Sat Aug 16 18:44:01 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code Resent-From: kobarity Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 31 Dec 2022 07:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60142 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Pierre Mercatoris Cc: Eli Zaretskii , Augusto Stoffel , 60142@debbugs.gnu.org Received: via spool by 60142-submit@debbugs.gnu.org id=B60142.16724714239377 (code B ref 60142); Sat, 31 Dec 2022 07:24:01 +0000 Received: (at 60142) by debbugs.gnu.org; 31 Dec 2022 07:23:43 +0000 Received: from localhost ([127.0.0.1]:36448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBWDX-0002RB-7X for submit@debbugs.gnu.org; Sat, 31 Dec 2022 02:23:43 -0500 Received: from mail-pj1-f53.google.com ([209.85.216.53]:38459) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBWDV-0002Qu-IA for 60142@debbugs.gnu.org; Sat, 31 Dec 2022 02:23:41 -0500 Received: by mail-pj1-f53.google.com with SMTP id m7-20020a17090a730700b00225ebb9cd01so15807237pjk.3 for <60142@debbugs.gnu.org>; Fri, 30 Dec 2022 23:23:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:from:to:cc:subject:date:message-id:reply-to; bh=qPyR6k6mNQimlv0faSeWpYLw/LBIR75Nm/iK7M64r4I=; b=Q/mhRHaV8sz5ct6SKXgqznTuPWrZKm6Ug+PM6nTtYYmw023XU4wJUQy8cCk7E4YQBm difVxS0r6TzFqZhQYhEOF3auxowK9FFJcdFV4XzBtj+J3bZchiFYVgSLF0FiQkV6bbGy hFiWqVMjHWR4ORVDMH4UOCjUKszsfTIkbKCjg98Ns1r2C5bgSROPf70AtdYaKg+VndLS 9Iohk+GLNondDxQlDzuSHE3DRJrWSylYsf4k/jJHuGRqwf6j/is6h/g3fChV/BJM7LSy pmSlTL9cwKYKvzkD3fQyTXnd4l7mP2ZZzDFRe48pG7RvQanYhRaU3MjvV+BEQabgm+vg 9aSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:references:in-reply-to:subject:cc:to:from :message-id:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=qPyR6k6mNQimlv0faSeWpYLw/LBIR75Nm/iK7M64r4I=; b=nJXHNwoxCy2n0/ZxzDIL2cKZBMNxqdvxfreRg37CVTjO0xwJQkrotOdgUx3GD/jyHV TtOpU4FRB7HbSRC2+vG91LK7uQppOtHqVsTZ8TYOuOBTcypt7q4YFUWtYvb33gyipzFt LEDxjTWs721AaA1YpDcQRFt1lw26xssdOhoSRPLyQYzGsYBHi7BijMTCgqoqmqwofk04 gRmJpuQGqg9CHTHaiU4BvgBNujIDB1OOU3M/dEeeAlNnOyh53hHEAOnkrhffWG7R0Kib vQofTEdk3FK0Eofcqbv7YSAVu+EyQf+FZx0VBxqieGE/IQYMfefLBv0YdmwQ/gMkMpdP u0qA== X-Gm-Message-State: AFqh2krZptKKdf/0OpMhVgZHG8rLoht/lNMGscLcX2bTJL7Ar0AZdjR3 W7qurp8RZF2q4N3dsyneUHM= X-Google-Smtp-Source: AMrXdXvQDKtZQoGW3Sm4Nc4OxGaC9OxSB/QCm1jTKfKbiRETDsgEri2G8lU1RGoHiiO5xOjfjMDP4w== X-Received: by 2002:a17:902:ea02:b0:189:38a1:8c04 with SMTP id s2-20020a170902ea0200b0018938a18c04mr57371731plg.50.1672471415466; Fri, 30 Dec 2022 23:23:35 -0800 (PST) Received: from localhost (58x12x133x161.ap58.ftth.ucom.ne.jp. [58.12.133.161]) by smtp.gmail.com with ESMTPSA id y4-20020a655b44000000b0047899d0d62csm13705334pgr.52.2022.12.30.23.23.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Dec 2022 23:23:35 -0800 (PST) Date: Sat, 31 Dec 2022 16:23:32 +0900 Message-ID: From: kobarity In-Reply-To: References: <83mt7lf12y.fsf@gnu.org> <87zgbjheqt.fsf@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?Q?Goj=C5=8D?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.0.50 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Pierre Mercatoris wrote: > Regarding the patch, is there anything that should be done in order for the > patch to be applied in an incoming > Emacs release? Hi, Thank you for testing my patch. I think that if the committers decide that it is worth incorporating, they will commit it. Your report should have been one of the bases for the decision. From unknown Sat Aug 16 18:44:01 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: pmercatoris Subject: bug#60142: closed (Re: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code) Message-ID: References: <83zgb43s3h.fsf@gnu.org> X-Gnu-PR-Message: they-closed 60142 X-Gnu-PR-Package: emacs Reply-To: 60142@debbugs.gnu.org Date: Sat, 31 Dec 2022 08:18:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1672474682-15550-1" This is a multi-part message in MIME format... ------------=_1672474682-15550-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #60142: 28.1; python.el Incorrect region when python-shell-send-region from= indented code which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 60142@debbugs.gnu.org. --=20 60142: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D60142 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1672474682-15550-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 60142-done) by debbugs.gnu.org; 31 Dec 2022 08:17:15 +0000 Received: from localhost ([127.0.0.1]:36509 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBX3L-00041g-0H for submit@debbugs.gnu.org; Sat, 31 Dec 2022 03:17:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pBX3J-00041P-0I for 60142-done@debbugs.gnu.org; Sat, 31 Dec 2022 03:17:13 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pBX3D-00062Q-EU; Sat, 31 Dec 2022 03:17:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=s8ow3paJVKgMApjMItzl3jgNK4R4brzjHROr+TuJ1F4=; b=hoJmt6MWqt3q l5dA+b/vRAvc40VgUKaWvmHuCGPkNuiOytO7ILJm+tkFLGTqhe89XCkCOwFCkCg+LoLsmfGv74LP+ gxlu7aXJI2U3fHMfwYHBR85+m6nwPAI8EbPwl5S5T5n1ze6ho+PnDBPsubsflcxujiXs41aF+unn7 lDhzanDokGnsK5Az/Dp0oK9lPg1c5ciWfZeAtTEGfWJv/OAnZgXSBrLxmaweSL5zp+BM/INDUyrNK 1SNYCGTgPVO1IjhjmMphDM0clLe63wu8uqjvoYoRCa9OWjBHmi+YgGcpvKEzJnzNwzZv3+ZiNXy3p jJ88OURiK0JNS/zdNxi2Dg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pBX3C-0005tB-Rt; Sat, 31 Dec 2022 03:17:07 -0500 Date: Sat, 31 Dec 2022 10:17:06 +0200 Message-Id: <83zgb43s3h.fsf@gnu.org> From: Eli Zaretskii To: kobarity In-Reply-To: (message from kobarity on Sat, 31 Dec 2022 16:23:32 +0900) Subject: Re: bug#60142: 28.1; python.el Incorrect region when python-shell-send-region from indented code References: <83mt7lf12y.fsf@gnu.org> <87zgbjheqt.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60142-done Cc: arstoffel@gmail.com, mercatorispierre@gmail.com, 60142-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 31 Dec 2022 16:23:32 +0900 > From: kobarity > Cc: Augusto Stoffel , > Eli Zaretskii , > 60142@debbugs.gnu.org > > > Pierre Mercatoris wrote: > > Regarding the patch, is there anything that should be done in order for the > > patch to be applied in an incoming > > Emacs release? > > Hi, > > Thank you for testing my patch. I think that if the committers decide > that it is worth incorporating, they will commit it. Your report > should have been one of the bases for the decision. Thanks, I installed this on the emacs-29 release branch, and I'm therefore closing the bug. ------------=_1672474682-15550-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 17 Dec 2022 03:34:43 +0000 Received: from localhost ([127.0.0.1]:53349 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6NyE-00018J-2o for submit@debbugs.gnu.org; Fri, 16 Dec 2022 22:34:43 -0500 Received: from lists.gnu.org ([209.51.188.17]:53822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p6JbB-0007qn-1d for submit@debbugs.gnu.org; Fri, 16 Dec 2022 17:54:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p6JbA-00009V-QP for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 17:54:36 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6Jb7-00081j-BC for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2022 17:54:36 -0500 Received: by mail-wm1-x329.google.com with SMTP id ja17so2833906wmb.3 for ; Fri, 16 Dec 2022 14:54:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:message-id:to:subject:from:date:from:to:cc:subject :date:message-id:reply-to; bh=IckLNHgqwF6ey9NUu1zVtIw4btcmAHxqeugLpXYAMC8=; b=N/fYKfDNFBHtgmLzS7VHNYaopx8+HwYQDpvfhaUwWbw0ol45ajgGu0gI7jBfg9MSgw ckWgmL9B1vGD6s2SOONc/xEg55sUvMV5u4DkdywqONOAtu7iPQctMx4obHsLc43DnLIN 0U7KOpwTylprig6YsQ0DvAN4fwLLjWbPFDcn8wsgYBXmmVjctXGVCM4XpfhVJQPisFTf MGY8p+fcUQOQwm0VOVAz2esivth3MLZKuDx8DIAS20mzDOsns81775lBwpUoMHo7J1c2 3RBWJuVC8BYIR2nx9LbeqUstDrtlrHZqNwSg39lfyOwrvVBagXtBs2xcU2t1nsIFM0Ia 8cVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:to:subject:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=IckLNHgqwF6ey9NUu1zVtIw4btcmAHxqeugLpXYAMC8=; b=duNcG8TVXV7F1rbtLJ15HOY3+NZ7w02KkYW+hmbnW1qHs3nBjQVU530+q0QpWhPnkM y3oehxX9w1YVQao5HdynWdQFpWV6mvws7QleBmJ7U5AuO0iXMzZTAQ6kjk9542q7wwer Q/l4YiIGrlSYltKgDqf5q5wjVkGoP0MK15fwa090Q9Oe3E03bjRogyjefMrvHqeyk6Rn EU4Qhz6DqZZGeTIXiSboBwWcpc9RHgEfbjEE7Th/VupbC46XNR7JpNzwoOq0+dU4ntIV wfgk0dUQmrEdon7o5quWuY2lZxMJQI1WvoLdrFv4agnZuUbHjdlsxJ1BLiQLtl9/wJVk uQ+Q== X-Gm-Message-State: ANoB5pkI1CbnH73KeGmbciTXcsPLpJ7QOZQDCFqnH5g3obA1WdV2k2+H iVv2ZS4aGsM4s0zFS+57m/stErUXYWZL0w== X-Google-Smtp-Source: AA0mqf5Zop3fgFZMp59YWLDwaLQseEflmyzfK+WIibMlr3RptZXrauBCiO9mNuYt+paTQUqvLmXP+Q== X-Received: by 2002:a05:600c:554b:b0:3d2:1761:3742 with SMTP id iz11-20020a05600c554b00b003d217613742mr21137178wmb.15.1671231270329; Fri, 16 Dec 2022 14:54:30 -0800 (PST) Received: from [192.168.1.28] (239.47.76.188.dynamic.jazztel.es. [188.76.47.239]) by smtp.gmail.com with ESMTPSA id f24-20020a1c6a18000000b003b95ed78275sm3763680wmc.20.2022.12.16.14.54.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 14:54:29 -0800 (PST) Date: Fri, 16 Dec 2022 23:54:23 +0100 From: pmercatoris Subject: 28.1; python.el Incorrect region when python-shell-send-region from indented code To: bug-gnu-emacs@gnu.org Message-Id: X-Mailer: geary/43.0 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=-FLbspB5tltfBm87xaRfP" Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=mercatorispierre@gmail.com; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 16 Dec 2022 22:34:38 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-FLbspB5tltfBm87xaRfP Content-Type: text/plain; charset=us-ascii; format=flowed Hello, First of all, this is my first bug report, I'm not sure I am doing this correctly, so forgive my ignorance. I am unable to get correct behavious when sending a region from indented code to the python shell. Consider this python code: ```python if True: if True: a = "test" ``` If I select the first `True` and `python-shell-send-region`, it will correctly send it to the consol and print `True`. Now if I do the same thing with the second `True` it will throw an error: `IndentationError: expected an indented block after 'if' statement on line 1` Although it would also reffer to unexpected block after `if` even it it were `for`, `try`, ... If I select the `a` or `a = "test"` it will correctly send it to the console, however it won't echo the evaluation of the statement. If I select the string "test" and send, it will throw the same error as the second True. My python config is very minimal: (use-package python :ensure nil :mode ("\\.py\\'" . python-mode) :init (setq-default indent-tabs-mode nil) :config (setq python-indent-offset 4 python-indent-guess-indent-offset-verbose nil ) (setq python-shell-interpreter "jupyter" python-shell-interpreter-args "console --simple-prompt" python-shell-prompt-detect-failure-warning nil) (add-to-list 'python-shell-completion-native-disabled-interpreters "jupyter")) Kind regards, Pierre In GNU Emacs 28.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6) of 2022-07-21 built on buildvm-x86-04.iad2.fedoraproject.org Windowing system distributor 'The X.Org Foundation', version 11.0.12201005 System Description: Fedora Linux 37 (Workstation Edition) Configured using: 'configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png --with-rsvg --with-tiff --with-xpm --with-x-toolkit=gtk3 --with-gpm=no --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json --with-native-compilation build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' LDFLAGS=-Wl,-z,relro PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB Important settings: value of $LC_MONETARY: en_GB.UTF-8 value of $LC_NUMERIC: en_GB.UTF-8 value of $LC_TIME: en_GB.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Python Minor modes in effect: which-key-mode: t display-line-numbers-mode: t rainbow-delimiters-mode: t envrc-global-mode: t envrc-mode: t tree-sitter-hl-mode: t global-tree-sitter-mode: t tree-sitter-mode: t eglot--managed-mode: t flymake-mode: t marginalia-mode: t global-corfu-mode: t corfu-mode: t vertico-mode: t doom-modeline-mode: t global-undo-tree-mode: t undo-tree-mode: t global-evil-surround-mode: t evil-surround-mode: t global-evil-collection-unimpaired-mode: t evil-collection-unimpaired-mode: t shell-dirtrack-mode: t evil-mode: t evil-local-mode: t windmove-mode: t recentf-mode: t savehist-mode: t save-place-mode: t global-hl-line-mode: t electric-pair-mode: t delete-selection-mode: t override-global-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t buffer-read-only: t column-number-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: /home/pmercatoris/.config/emacs/elpa/transient-20221202.1727/transient hides /usr/share/emacs/28.1/lisp/transient Features: (shadow sort mail-extr emacsbug sendmail cua-base misearch multi-isearch avy evil-nerd-commenter evil-nerd-commenter-operator evil-nerd-commenter-sdk sgml-mode facemenu mule-util evil-collection-markdown-mode markdown-mode vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs vc evil-collection-which-key which-key face-remap display-line-numbers rainbow-delimiters envrc inheritenv tree-sitter-langs tree-sitter-langs-build evil-collection-tar-mode tar-mode evil-collection-arc-mode arc-mode archive-mode tree-sitter-hl tree-sitter tree-sitter-load tree-sitter-cli tsc tsc-dyn tsc-dyn-get dired-aux tsc-obsolete ob-python evil-collection-python python tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat ls-lisp hydra lv consult-eglot evil-collection-consult consult-vertico consult compat-28 evil-collection-bookmark bookmark evil-collection-eglot eglot array filenotify jsonrpc evil-collection-ert ert pp ewoc evil-collection-debug debug backtrace evil-collection-xref xref evil-collection-flymake flymake-proc flymake evil-collection-compile compile pcase project evil-collection-imenu imenu orderless marginalia evil-collection-corfu corfu evil-collection-vertico vertico doom-modeline doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path f f-shortdoc evil-collection-shortdoc shortdoc s all-the-icons all-the-icons-faces data-material data-weathericons data-octicons data-fileicons data-faicons data-alltheicons rainbow-mode xterm-color color ef-duo-dark-theme ef-themes undo-tree diff queue evil-surround evil-collection-unimpaired evil-collection-vc-git evil-collection-tabulated-list evil-collection-tab-bar evil-collection-speedbar evil-collection-simple evil-collection-replace evil-collection-process-menu evil-collection-package-menu evil-collection-outline evil-collection-org evil-collection-info evil-collection-indent evil-collection-image evil-collection-help evil-collection-gnus evil-collection-eww evil-collection-epa evil-collection-elisp-mode evil-collection-eldoc evil-collection-doc-view evil-collection-dired evil-collection-diff-mode evil-collection-comint evil-collection-calendar calc-ext evil-collection-calc evil-collection-buff-menu evil-collection-auto-package-update evil-collection annalist evil evil-integration evil-maps evil-commands reveal flyspell ispell evil-jumps evil-command-window evil-search evil-ex shell evil-types evil-macros evil-repeat evil-states evil-core comp comp-cstr warnings evil-common windmove calc calc-loaddefs calc-macs rect evil-digraphs evil-vars edmacro kmacro recentf tree-widget savehist saveplace hl-line elec-pair delsel no-littering compat compat-macs diary-lib diary-loaddefs auto-package-update dash use-package use-package-ensure use-package-delight use-package-diminish use-package-bind-key bind-key use-package-core finder-inf vc-git diff-mode vc-dispatcher org-element avl-tree generator ol-eww eww xdg url-queue thingatpt mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect gnus-search eieio-opt speedbar ezimage dframe gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr kinsoku svg dom gnus-group gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 netrc nnoo parse-time gnus-spec gnus-int gnus-range message rmc puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader gnus-win gnus nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search mail-utils mm-util mail-prsvr wid-edit ol-docview doc-view jka-compr image-mode exif dired dired-loaddefs ol-bibtex ol-bbdb ol-w3m ol-doi org-link-doi cl-extra help-mode org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pcomplete comint ansi-color ring org-list org-faces org-entities noutline outline easy-mmode org-version ob-emacs-lisp ob-core ob-eval org-table oc-basic bibtex iso8601 time-date ol rx org-keys oc org-compat advice org-macs org-loaddefs format-spec find-func cal-menu calendar cal-loaddefs info package browse-url url url-proxy url-privacy url-expand url-methods url-history url-cookie url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv bytecomp byte-compile cconv 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 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 simple abbrev obarray cl-preloaded nadvice button loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote threads xwidget-internal dbusbind inotify dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 773438 128306) (symbols 48 46851 49) (strings 32 207758 12187) (string-bytes 1 6926856) (vectors 16 89108) (vector-slots 8 2338965 214323) (floats 8 1053 928) (intervals 56 7474 3578) (buffers 992 27)) --=-FLbspB5tltfBm87xaRfP Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable
Hello,

First of all, this is my first bug report, I'm not sure I am doing this<= /div>
correctly, so forgive my ignorance.

I am= unable to get correct behavious when sending a region from indented code
to the python shell. Consider this python code:

```python
if True:
    if True:
<= div>        a =3D "test"
```

If I select the first `True` and `python-shell-send-region`, it wi= ll
correctly send it to the consol and print `True`.
Now if I do the same thing with the second `True` it will thro= w an
error: `IndentationError: expected an indented block after '= if'
statement on line 1` Although it would also reffer to unexpec= ted block
after `if` even it it were `for`, `try`, ...
=
If I select the `a` or `a =3D "test"` it will correctly send= it to the
console, however it won't echo the evaluation of the s= tatement.

If I select the string "test" and send, = it will throw the same error as
the second True.

My python config is very minimal:

  = (use-package python
    :ensure nil
  &n= bsp; :mode
    ("\\.py\\'" . python-mode)
    :init
    (setq-default inden= t-tabs-mode nil)

    :config
&= nbsp;   (setq python-indent-offset 4
      &n= bsp;   python-indent-guess-indent-offset-verbose nil
  =         )

    (setq = python-shell-interpreter "jupyter"
        &n= bsp; python-shell-interpreter-args "console --simple-prompt"
&nbs= p;         python-shell-prompt-detect-failure-warning n= il)

    (add-to-list 'python-shell-compl= etion-native-disabled-interpreters
        &n= bsp;        "jupyter"))

Kind r= egards,
Pierre

In GNU Emacs 28.1 (build = 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.34, cairo version 1.17.6)
 of 2022-07-21 built on buildvm-x86-04.iad2.fedoraproject.org
Windowing system distributor 'The X.Org Foundation', version 11.0.= 12201005
System Description: Fedora Linux 37 (Workstation Edition= )

Configured using:
 'configure --b= uild=3Dx86_64-redhat-linux-gnu
 --host=3Dx86_64-redhat-linux= -gnu --program-prefix=3D
 --disable-dependency-tracking --pr= efix=3D/usr --exec-prefix=3D/usr
 --bindir=3D/usr/bin --sbin= dir=3D/usr/sbin --sysconfdir=3D/etc
 --datadir=3D/usr/share = --includedir=3D/usr/include --libdir=3D/usr/lib64
 --libexec= dir=3D/usr/libexec --localstatedir=3D/var
 --sharedstatedir= =3D/var/lib --mandir=3D/usr/share/man
 --infodir=3D/usr/shar= e/info --with-dbus --with-gif --with-jpeg --with-png
 --with= -rsvg --with-tiff --with-xpm --with-x-toolkit=3Dgtk3 --with-gpm=3Dno
<= div> --with-xwidgets --with-modules --with-harfbuzz --with-cairo --wit= h-json
 --with-native-compilation build_alias=3Dx86_64-redha= t-linux-gnu
 host_alias=3Dx86_64-redhat-linux-gnu CC=3Dgcc '= CFLAGS=3D-DMAIL_USE_LOCKF -O2
 -flto=3Dauto -ffat-lto-object= s -fexceptions -g -grecord-gcc-switches
 -pipe -Wall -Werror= =3Dformat-security -Wp,-D_FORTIFY_SOURCE=3D2
 -Wp,-D_GLIBCXX= _ASSERTIONS
 -specs=3D/usr/lib/rpm/redhat/redhat-hardened-cc= 1 -fstack-protector-strong
 -specs=3D/usr/lib/rpm/redhat/red= hat-annobin-cc1 -m64 -mtune=3Dgeneric
 -fasynchronous-unwind= -tables -fstack-clash-protection -fcf-protection'
 LDFLAGS= =3D-Wl,-z,relro
 PKG_CONFIG_PATH=3D:/usr/lib64/pkgconfig:/us= r/share/pkgconfig'

Configured features:
= ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP N= OTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT= _SCROLL_BARS
X11 XDBE XIM XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: en_GB.= UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  v= alue of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_US.UTF-8<= /div>
  value of $XMODIFIERS: @im=3Dibus
  locale-c= oding-system: utf-8-unix

Major mode: Python
<= div>
Minor modes in effect:
  which-key-mode: = t
  display-line-numbers-mode: t
  rainbow-de= limiters-mode: t
  envrc-global-mode: t
  env= rc-mode: t
  tree-sitter-hl-mode: t
  global-= tree-sitter-mode: t
  tree-sitter-mode: t
  e= glot--managed-mode: t
  flymake-mode: t
  mar= ginalia-mode: t
  global-corfu-mode: t
  corf= u-mode: t
  vertico-mode: t
  doom-modeline-m= ode: t
  global-undo-tree-mode: t
  undo-tree= -mode: t
  global-evil-surround-mode: t
  evi= l-surround-mode: t
  global-evil-collection-unimpaired-mode:= t
  evil-collection-unimpaired-mode: t
  she= ll-dirtrack-mode: t
  evil-mode: t
  evil-loc= al-mode: t
  windmove-mode: t
  recentf-mode:= t
  savehist-mode: t
  save-place-mode: t
  global-hl-line-mode: t
  electric-pair-mode: = t
  delete-selection-mode: t
  override-globa= l-mode: t
  global-eldoc-mode: t
  eldoc-mode= : t
  show-paren-mode: t
  electric-indent-mo= de: t
  mouse-wheel-mode: t
  file-name-shado= w-mode: t
  global-font-lock-mode: t
  font-l= ock-mode: t
  auto-composition-mode: t
  auto= -encryption-mode: t
  auto-compression-mode: t
&nb= sp; buffer-read-only: t
  column-number-mode: t
&n= bsp; line-number-mode: t
  transient-mark-mode: t
=
Load-path shadows:
/home/pmercatoris/.config/emacs= /elpa/transient-20221202.1727/transient hides /usr/share/emacs/28.1/lisp/tr= ansient

Features:
(shadow sort mail-extr= emacsbug sendmail cua-base misearch multi-isearch
avy evil-nerd-= commenter evil-nerd-commenter-operator
evil-nerd-commenter-sdk sg= ml-mode facemenu mule-util
evil-collection-markdown-mode markdown= -mode vc-mtn vc-hg vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs vc = evil-collection-which-key which-key
face-remap display-line-numbe= rs rainbow-delimiters envrc inheritenv
tree-sitter-langs tree-sit= ter-langs-build evil-collection-tar-mode
tar-mode evil-collection= -arc-mode arc-mode archive-mode tree-sitter-hl
tree-sitter tree-s= itter-load tree-sitter-cli tsc tsc-dyn tsc-dyn-get
dired-aux tsc-= obsolete ob-python evil-collection-python python tramp-sh
tramp t= ramp-loaddefs trampver tramp-integration files-x tramp-compat
ls-= lisp hydra lv consult-eglot evil-collection-consult consult-vertico
consult compat-28 evil-collection-bookmark bookmark
evil-colle= ction-eglot eglot array filenotify jsonrpc evil-collection-ert
er= t pp ewoc evil-collection-debug debug backtrace evil-collection-xref
<= div>xref evil-collection-flymake flymake-proc flymake
evil-collec= tion-compile compile pcase project evil-collection-imenu
imenu or= derless marginalia evil-collection-corfu corfu
evil-collection-ve= rtico vertico doom-modeline doom-modeline-segments
doom-modeline-= env doom-modeline-core shrink-path f f-shortdoc
evil-collection-s= hortdoc shortdoc s all-the-icons all-the-icons-faces
data-materia= l data-weathericons data-octicons data-fileicons
data-faicons dat= a-alltheicons rainbow-mode xterm-color color
ef-duo-dark-theme ef= -themes undo-tree diff queue evil-surround
evil-collection-unimpa= ired evil-collection-vc-git
evil-collection-tabulated-list evil-c= ollection-tab-bar
evil-collection-speedbar evil-collection-simple= evil-collection-replace
evil-collection-process-menu evil-collec= tion-package-menu
evil-collection-outline evil-collection-org evi= l-collection-info
evil-collection-indent evil-collection-image ev= il-collection-help
evil-collection-gnus evil-collection-eww evil-= collection-epa
evil-collection-elisp-mode evil-collection-eldoc
evil-collection-doc-view evil-collection-dired evil-collection-dif= f-mode
evil-collection-comint evil-collection-calendar calc-ext
evil-collection-calc evil-collection-buff-menu
evil-coll= ection-auto-package-update evil-collection annalist evil
evil-int= egration evil-maps evil-commands reveal flyspell ispell
evil-jump= s evil-command-window evil-search evil-ex shell evil-types
evil-m= acros evil-repeat evil-states evil-core comp comp-cstr warnings
e= vil-common windmove calc calc-loaddefs calc-macs rect evil-digraphs
evil-vars edmacro kmacro recentf tree-widget savehist saveplace hl-line<= /div>
elec-pair delsel no-littering compat compat-macs diary-lib
<= div>diary-loaddefs auto-package-update dash use-package use-package-ensure<= /div>
use-package-delight use-package-diminish use-package-bind-key bin= d-key
use-package-core finder-inf vc-git diff-mode vc-dispatcher = org-element
avl-tree generator ol-eww eww xdg url-queue thingatpt= mm-url ol-rmail
ol-mhe ol-irc ol-info ol-gnus nnselect gnus-sear= ch eieio-opt speedbar
ezimage dframe gnus-art mm-uu mml2015 mm-vi= ew mml-smime smime dig
gnus-sum shr kinsoku svg dom gnus-group gn= us-undo gnus-start gnus-dbus
dbus xml gnus-cloud nnimap nnmail ma= il-source utf7 netrc nnoo parse-time
gnus-spec gnus-int gnus-rang= e message rmc puny rfc822 mml mml-sec epa
derived epg rfc6068 epg= -config mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbr= ev gmm-utils mailheader gnus-win gnus nnheader gnus-util
rmail rm= ail-loaddefs rfc2047 rfc2045 ietf-drums text-property-search
mail= -utils mm-util mail-prsvr wid-edit ol-docview doc-view jka-compr
= image-mode exif dired dired-loaddefs ol-bibtex ol-bbdb ol-w3m ol-doi
<= div>org-link-doi cl-extra help-mode org ob ob-tangle ob-ref ob-lob ob-table=
ob-exp org-macro org-footnote org-src ob-comint org-pcomplete pc= omplete
comint ansi-color ring org-list org-faces org-entities no= utline outline
easy-mmode org-version ob-emacs-lisp ob-core ob-ev= al org-table oc-basic
bibtex iso8601 time-date ol rx org-keys oc = org-compat advice org-macs
org-loaddefs format-spec find-func cal= -menu calendar cal-loaddefs info
package browse-url url url-proxy= url-privacy url-expand url-methods
url-history url-cookie url-do= msuf url-util mailcap url-handlers
url-parse auth-source cl-seq e= ieio eieio-core cl-macs eieio-loaddefs
password-cache json subr-x= map url-vars seq byte-opt gv bytecomp
byte-compile cconv cl-load= defs cl-lib iso-transl tooltip eldoc paren
electric uniquify edif= f-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-wi= n term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fri= nge tabulated-list replace newcomment text-mode lisp-mode
prog-mo= de register page tab-bar menu-bar rfn-eshadow isearch easymenu
ti= mer select scroll-bar mouse jit-lock font-lock syntax font-core
t= erm/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms<= /div>
cp51932 hebrew greek romanian slovak czech european ethiopic indi= an
cyrillic chinese composite emoji-zwj charscript charprop case-= table
epa-hook jka-cmpr-hook help simple abbrev obarray cl-preloa= ded nadvice
button loaddefs faces cus-face macroexp files window = text-properties
overlay sha1 md5 base64 format env code-pages mul= e custom widget
hashtable-print-readable backquote threads xwidge= t-internal dbusbind
inotify dynamic-setting system-font-setting f= ont-render-setting cairo
move-toolbar gtk x-toolkit x multi-tty m= ake-network-process
native-compile emacs)

Memory information:
((conses 16 773438 128306)
 = (symbols 48 46851 49)
 (strings 32 207758 12187)
&= nbsp;(string-bytes 1 6926856)
 (vectors 16 89108)
=  (vector-slots 8 2338965 214323)
 (floats 8 1053 928)
 (intervals 56 7474 3578)
 (buffers 992 27))

--=-FLbspB5tltfBm87xaRfP-- ------------=_1672474682-15550-1--