all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] emacs-25 6e788ef: ; etc/PROBLEMS: Explain about the python+libedit problem (Bug#25753).
       [not found] ` <20170301225512.1A71E262AE@vcs0.savannah.gnu.org>
@ 2017-03-02  2:20   ` Stefan Monnier
  2017-03-02  3:57     ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2017-03-02  2:20 UTC (permalink / raw)
  To: emacs-devel; +Cc: Fabián E. Gallina, Noam Postavsky

> +*** In Inferior Python mode, input is echoed and native completion doesn't work.
> +<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25753>
> +
> +This happens when python uses a libedit based readline module, which
> +is the default on macOS.  This can be worked around by installing a
> +GNU readline based module instead, for example, using setuptools

Is there a way we could guess/detect the situation automatically (and
emit a corresponding message)?


        Stefan



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

* Re: [Emacs-diffs] emacs-25 6e788ef: ; etc/PROBLEMS: Explain about the python+libedit problem (Bug#25753).
  2017-03-02  2:20   ` [Emacs-diffs] emacs-25 6e788ef: ; etc/PROBLEMS: Explain about the python+libedit problem (Bug#25753) Stefan Monnier
@ 2017-03-02  3:57     ` Noam Postavsky
  2017-03-02  5:39       ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Noam Postavsky @ 2017-03-02  3:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Fabián E. Gallina, Emacs developers

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

On Wed, Mar 1, 2017 at 9:20 PM, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>> +*** In Inferior Python mode, input is echoed and native completion doesn't work.
>> +<https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25753>
>> +
>> +This happens when python uses a libedit based readline module, which
>> +is the default on macOS.  This can be worked around by installing a
>> +GNU readline based module instead, for example, using setuptools
>
> Is there a way we could guess/detect the situation automatically (and
> emit a corresponding message)?
>

I think the attached could work.

[-- Attachment #2: python-libedit-warn.diff --]
[-- Type: text/plain, Size: 1913 bytes --]

--- i/lisp/progmodes/python.el
+++ w/lisp/progmodes/python.el
@@ -3399,24 +3399,30 @@ python-shell-completion-native-setup
                 instance.rlcomplete = new_completer
 
         if readline.__doc__ and 'libedit' in readline.__doc__:
-            readline.parse_and_bind('bind ^I rl_complete')
+            # readline.parse_and_bind('bind ^I rl_complete')
+            print ('libedit not supported')
         else:
             readline.parse_and_bind('tab: complete')
             # Require just one tab to send output.
             readline.parse_and_bind('set show-all-if-ambiguous on')
+            print ('python.el: native completion setup loaded')
 
-        print ('python.el: native completion setup loaded')
     except:
         print ('python.el: native completion setup failed')
 
 __PYTHON_EL_native_completion_setup()" process)
-      (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)))))
+      (when (python-shell-accept-process-output
+             process python-shell-completion-native-try-output-timeout)
+        (cond ((save-excursion
+                 (re-search-backward
+                  (regexp-quote "python.el: native completion setup loaded") nil t 1))
+               (python-shell-completion-native-try))
+              ((save-excursion (search-backward "libedit" nil t 1))
+               (lwarn '(python libedit)
+                      :error "\
+Your `python-shell-interpreter' uses a libedit based readline
+module which is currently not supported.")
+               nil))))))
 
 (defun python-shell-completion-native-turn-off (&optional msg)
   "Turn off shell native completions.


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

* Re: [Emacs-diffs] emacs-25 6e788ef: ; etc/PROBLEMS: Explain about the python+libedit problem (Bug#25753).
  2017-03-02  3:57     ` Noam Postavsky
@ 2017-03-02  5:39       ` Stefan Monnier
  2017-03-03  2:22         ` Noam Postavsky
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2017-03-02  5:39 UTC (permalink / raw)
  To: emacs-devel

>> Is there a way we could guess/detect the situation automatically (and
>> emit a corresponding message)?
> I think the attached could work.

That would be sweet.

> +               (lwarn '(python libedit)
> +                      :error "\
> +Your `python-shell-interpreter' uses a libedit based readline
> +module which is currently not supported.")

Could the message explain how to fix the problem, or include some
link/reference to a description about how to fix the problem
(e.g. a pointer to C-h C-p?).


        Stefan




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

* Re: [Emacs-diffs] emacs-25 6e788ef: ; etc/PROBLEMS: Explain about the python+libedit problem (Bug#25753).
  2017-03-02  5:39       ` Stefan Monnier
@ 2017-03-03  2:22         ` Noam Postavsky
  0 siblings, 0 replies; 4+ messages in thread
From: Noam Postavsky @ 2017-03-03  2:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Emacs developers

On Thu, Mar 2, 2017 at 12:39 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>
> Could the message explain how to fix the problem, or include some
> link/reference to a description about how to fix the problem
> (e.g. a pointer to C-h C-p?).

Sure, something like this?

(lwarn '(python libedit)
                      :error "\
Your `python-shell-interpreter' uses a libedit based readline
module which is currently not supported, see 'Inferior Python' in
etc/PROBLEMS.")



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

end of thread, other threads:[~2017-03-03  2:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20170301225511.25578.47307@vcs0.savannah.gnu.org>
     [not found] ` <20170301225512.1A71E262AE@vcs0.savannah.gnu.org>
2017-03-02  2:20   ` [Emacs-diffs] emacs-25 6e788ef: ; etc/PROBLEMS: Explain about the python+libedit problem (Bug#25753) Stefan Monnier
2017-03-02  3:57     ` Noam Postavsky
2017-03-02  5:39       ` Stefan Monnier
2017-03-03  2:22         ` Noam Postavsky

Code repositories for project(s) associated with this external index

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

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