From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Zolt=C3=A1n?= Vandrus Newsgroups: gmane.emacs.bugs Subject: bug#45938: 28.0.50; python native completion fails with fancier readline settings Date: Sun, 17 Jan 2021 17:20:04 +0100 Message-ID: <87v9bvwn63.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1954"; mail-complaints-to="usenet@ciao.gmane.io" To: 45938@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 17 17:21:15 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1Anj-0000Mg-56 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Jan 2021 17:21:15 +0100 Original-Received: from localhost ([::1]:39300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1Anh-0006g8-Ju for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 17 Jan 2021 11:21:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57592) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1AnX-0006fm-0Y for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2021 11:21:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33993) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1AnW-0000P5-P4 for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2021 11:21:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1l1AnW-0006m1-Jo for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2021 11:21:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Zolt=C3=A1n?= Vandrus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Jan 2021 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45938 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.161090041825964 (code B ref -1); Sun, 17 Jan 2021 16:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Jan 2021 16:20:18 +0000 Original-Received: from localhost ([127.0.0.1]:45539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l1Amn-0006kg-FZ for submit@debbugs.gnu.org; Sun, 17 Jan 2021 11:20:18 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:33392) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l1Ami-0006kU-Oz for submit@debbugs.gnu.org; Sun, 17 Jan 2021 11:20:15 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1Amh-0006Y5-Ib for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2021 11:20:12 -0500 Original-Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:46504) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1Ame-0008Re-J5 for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2021 11:20:11 -0500 Original-Received: by mail-ed1-x536.google.com with SMTP id dj23so12311459edb.13 for ; Sun, 17 Jan 2021 08:20:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=MmPZIRSx1JZYmZ6sta3PkWYFGE//Q3Iin7uiWzo/KHY=; b=Ok7t4tQI3IBxNu6a2i31G/pTluOf7hFF2hVwCaoptYbXU2GkgURiJHX3BAzdhQnmGI XRHRJQkJyWeihYI6IVkqW2BWOgglI4VwnyvC9byEJN6DYjai/ZY+6i774pqSsenZs5Ws 41Yr+LMegH5dgHjgbG1JmM8RuVHlsWG9Kw9QxcfKgG2Z46KZkwstlS6AQU3O4MNKmOUI SCBtFw/rU+vogTmkaYZSsGE9hiKioJfCqhux6OrcUylUgUt3glgox4OiBuQ40FOyLMG9 64c+2+SEeORsz+nenOzYx8UPir+f1OXTq+MC9Cj8UYcpXVrQ6Nsr7GCbnsUjb2xa0Lfi excg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=MmPZIRSx1JZYmZ6sta3PkWYFGE//Q3Iin7uiWzo/KHY=; b=nv0iXb8IQ77eqE841tlM/4JOED66dASzWTObnjoGDZNeEwg+NZUNtxtgckk0Lq9AOf snJUBErCey+6zDnD7eq+r8zDD0J5x29GiBviywGIOREHRtvnJSF1RMPs+yPZB7lt23Ue xK/XqQ1oGLG/XYrnoTy2DAJwLp2Kg+OSVzzMv63ZUc6471f8q1BWrTQxaZ2RMBdWMdkn Fdf4NxqRbzpSrYTdQzGmIE9ZRH/mLJXxHBlD7FAgWN4RDQp7o2bNrPz/x7fo2lEtEAKG g3MODLVM8CaS9dsblWWt4ZrGR1+dlbnzjIo3GZ8vYFJfYC38qGYwiV76t0FE/iuqXzeI Jmcw== X-Gm-Message-State: AOAM530+RO4lw16BX2rCOMUN95JgVrwaaGt5j4Layw8vrhpz1DOHRnfW mReq2F0MRixuSBBNy6zsJmhksX2k1AA= X-Google-Smtp-Source: ABdhPJyY0Q0ycFCIKq0tCLjoc3UB2tPcTs8Ck7ZkrvFp/WE8DJYRafvG3UT1qsUkQUnm4lgGTuyvFg== X-Received: by 2002:aa7:c3cf:: with SMTP id l15mr17122173edr.282.1610900406556; Sun, 17 Jan 2021 08:20:06 -0800 (PST) Original-Received: from zoli-laptop (fibhost-66-212-245.fibernet.hu. [85.66.212.245]) by smtp.gmail.com with ESMTPSA id b101sm1300889edf.49.2021.01.17.08.20.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Jan 2021 08:20:05 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=vandrus.zoltan@gmail.com; helo=mail-ed1-x536.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, 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:198057 Archived-At: Three problematic options I found are: set colored-stats on set colored-completion-prefix on set enable-bracketed-paste on With any of these M-x run-python warns: Warning (python): Your =E2=80=98python-shell-interpreter=E2=80=99 doesn= =E2=80=99t seem to support readline, yet =E2=80=98python-shell-completion-native-enable=E2= =80=99 was t and "python3" is not part of the =E2=80=98python-shell-completion-native-disabled-interpreters=E2=80=99 l= ist. Native completions have been disabled locally. =20=20=20 set colored-stats on set colored-completion-prefix on =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D Any of these on and *Python completions redirect* buffer ends with: 0__dummy_completion__^[[0m^[[K 1__dummy_completion__^[[0m^[[K ^[[0m and ^[[K are escape sequences not understood by comint mode I think Related bug: #24401 recommends setting colored-stats conditionally only for bash, because filename coloring is not that useful for the python shell. Even then colored-completion-prefix is useful everywhere, emacs does it by default too. set enable-bracketed-paste on =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D Fails like half of the times for me. For a different reason. First record output: (defun keep-output (output) (setq kept (cons output kept))) (add-hook 'inferior-python-mode-hook (lambda () (setq kept nil) (add-hook 'comint-output-filter-functions #'keep-output))) M-x run-python kept=E2=80=99s value is ("python.el: native completion setup loaded ^[[?2004h>>> " "^[[?2004l^M" "Python 3.9.0 (default, Oct 7 2020, 23:09:01)= =20 [GCC 10.2.0] on linux Type \"help\", \"copyright\", \"credits\" or \"license\" for more informati= on. ^[[?2004h>>> ") ----------------------- python-shell-completin-native-setup assumes that after running the python script that sets up completion the first output will be from the scr= ipt: (when (and (python-shell-accept-process-output process python-shell-completion-native-try-output-timeout) (save-excursion (re-search-backward (regexp-quote "python.el: native completion setup loaded") = nil t 1))) (python-shell-completion-native-try))))) What can happen sometimes is that, after the first initial prompt: "Python 3.9.0 (default, Oct 7 2020, 23:09:01)=20 [GCC 10.2.0] on linux Type \"help\", \"copyright\", \"credits\" or \"license\" for more inform= ation. ^[[?2004h>>> " The python script is injected. python-shell-accept-process-output waits for next prompt Bracketed mode is disabled instead with clearing the line: "^[[?2004l^M" Empty line is a valid python prompt, so it's accepted, and the regexp test fails. #41959 is another problem with trying to parse the readline output. -------------------------------------------------- Readline version 8.1.0 In GNU Emacs 28.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, c= airo version 1.17.4) of 2021-01-17 built on zoli-laptop Repository revision: 1773679af3241919a85d6174b1554070a63cca79 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12010000 System Description: Arch Linux Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB Important settings: value of $LC_TIME: C value of $LANG: hu_HU.utf8 locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: shell-dirtrack-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils warnings compile text-property-search cl-extra help-mode python easymenu tramp-sh tramp tramp-loaddefs trampver tramp-integration files-x tramp-compat shell pcomplete parse-time iso8601 time-date ls-lisp format-spec auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map seq byte-opt gv bytecomp byte-compile cconv comint ring cl-loaddefs cl-lib ansi-color iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type 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 elisp-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock syntax facemenu 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 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 dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 74431 8365) (symbols 48 9112 1) (strings 32 27268 1190) (string-bytes 1 989045) (vectors 16 15840) (vector-slots 8 208279 9279) (floats 8 47 29) (intervals 56 226 0) (buffers 984 14))