emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

python-try-complete


From: Julian Scheid
Subject: python-try-complete
Date: Sat, 05 Apr 2008 00:28:04 +1100
User-agent: Thunderbird 2.0.0.12 (Macintosh/20080213)

Hi,

first of all I am writing a lot of Python code these days and python-mode is indispensable. Thanks for this great tool.

I take issue with one of its design decisions however: sneaking in python-try-complete into hippie-expand-try-functions-list. From python.el (found in both my 22.1.2 and in HEAD):

  (if (featurep 'hippie-exp)
      (set (make-local-variable 'hippie-expand-try-functions-list)
           (cons 'python-try-complete hippie-expand-try-functions-list)))

The main reason why I use hippie-expand (and similar completion facilities in Emacs) is simply raw speed. I'll take lightweight, context-insensitive completion over heavyweight, database-querying or external-process-launching context-sensitive completion any day.

I am defining hippie-expand-try-functions-list explicitly in my .emacs and until recently I was under the impression that this way I get to choose which route hippie-expand takes to try and complete. But the other day I learned that python-try-complete gets inserted into that list without my consent, a function that launches an external process and which I would thus consider quite heavyweight.

I understand that this has been done with only the best intentions but I would like to kindly ask the maintainers of python-mode to remove this and instead advertise the existence of python-try-complete and leave it up to hippie-expand users to insert or not insert it into their list of functions to try.

Alternatively, there could be a customization setting for this which defaults to off (no automatic registration of python-try-complete). I think that the lo-fi approach of having people add it to their list explicitly would be superior, though, because this way users get more control over the order in which the functions are invoked.

FWIW my current unsophisticated workaround looks like this:

  (require 'python)
  (defun python-try-complete (old) nil)


The second problem I noticed with python-try-complete, and this is what made me aware of it being used in the first place, is that it will apparently launch the Python interpreter on a remote host if the file in question is remote, opened using Tramp in my case. This remote invocation often (always?) fails, apparently due to shell quoting issues.

That wouldn't be a big problem if the completion attempt would simply be ignored in case of failure; however it seems as if python-try-complete would get stuck this way (I think it's waiting indefinitely for a reply from the remote Python script), forcing me to C-g out of it which is quite a nuisance in interactive usage when all you wanted is get an expansion of the word at point.

I got the following information from Michael, the tramp maintainer, about this situation - and I'm not quoting directly here, any errors in the following are mine and not his:

Either python-try-complete should refrain from launching the process remotely by looking at (file-remote-p default-directory), or the scripts it launches need to be prepared (e.g. in terms of quoting) for being run remotely via ssh.

If you need backtraces or similar for tracking this down I'm happy to provide them the next time I'm in a situation to reproduce the issue.

Let me know in case my explanation of these problems was insufficient.

I'm using Emacs 22.1.2, hippie-expand 1.6, tramp 2.1.13, and python.el that ships with my Emacs.

-Julian





reply via email to

[Prev in Thread] Current Thread [Next in Thread]