GNU bug report logs - #51218
28.0.60; python.el: Native completion strikes again

Previous Next

Package: emacs;

Reported by: Carlos Pita <carlosjosepita2 <at> gmail.com>

Date: Fri, 15 Oct 2021 00:28:01 UTC

Severity: normal

Tags: patch

Found in version 28.0.60

Fixed in version 28.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Kangas <stefan <at> marxist.se>
To: Carlos Pita <carlosjosepita2 <at> gmail.com>
Cc: 51218 <at> debbugs.gnu.org
Subject: bug#51218: 28.0.60; python.el: Native completion strikes again
Date: Sat, 30 Oct 2021 08:53:46 -0700
close 51218 28.1
thanks

Carlos Pita <carlosjosepita2 <at> gmail.com> writes:

> here's another problem with native completion. If in ~/.inputrc you
> customize completion-prefix-display-length to, say, 5, then this won't
> work:
>
>     import numpy
>     numpy.<complete>
>
> while this still works:
>
>     import numpy as np
>     np.<complete>
>
> The reason is that readline will truncate a prefix of the dummy
> completions, throwing something like:
>
> ...my_completion__[0m[K  ...my_completion__[0m[K
>
> instead of:
>
> 0__dummy_completion__[0m[K  1__dummy_completion__[0m[K
>
> I can write a patch passing a different value to
> completion-prefix-display-length but this is getting tiresome and I
> reiterate my plea for removal of at least the native completion backend.
> I argued elsewhere for removal of all automagical stuff that depends on
> stdin/out manipulation (i.e. c-a-p and eldoc) but we can start small
> removing just the native part for now.

Yes, this makes sense, so I have now pushed your below patch to emacs-28
(commit 4a96f32def).

Carlos Pita <carlosjosepita2 <at> gmail.com> writes:

> In any case, here is the patch to toggle that option off.
>
>>From a8caf24c7af05d9d1f92f52632cfe7ccefd3f2dd Mon Sep 17 00:00:00 2001
> From: Carlos Pita <carlosjosepita <at> gmail.com>
> Date: Thu, 14 Oct 2021 21:48:43 -0300
> Subject: [PATCH] Avoid replacing common prefix with ellipsis
>
> * lisp/progmodes/python.el
> (python-shell-completion-native-setup): Configure readline not to
> suppress common prefixes.
> ---
>  lisp/progmodes/python.el | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
> index 54e3789c66..1da7e18635 100644
> --- a/lisp/progmodes/python.el
> +++ b/lisp/progmodes/python.el
> @@ -3711,6 +3711,8 @@ python-shell-completion-native-setup
>              readline.parse_and_bind('tab: complete')
>              # Require just one tab to send output.
>              readline.parse_and_bind('set show-all-if-ambiguous on')
> +            # Avoid replacing common prefix with ellipsis.
> +            readline.parse_and_bind('set completion-prefix-display-length 0')
>
>          print ('python.el: native completion setup loaded')
>      except:




This bug report was last modified 3 years and 205 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.