all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Julian Scheid <julians37@googlemail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: python-try-complete
Date: Mon, 14 Apr 2008 23:05:59 +1200	[thread overview]
Message-ID: <48033A97.8050208@gmail.com> (raw)
In-Reply-To: <4800885A.1090402@gmail.com>

> Did you have any thoughts about the second problem I described in the 
> same mail - python-try-complete locking up when used in a remote buffer? 
> To quote from my previous mail,
> 
>   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.

I had a chance to narrow it down a bit more. Here is the stack trace I 
get when I quit while python-try-complete blocks:

Debugger entered--Lisp error: (quit)
   accept-process-output(#<process Python> 5)
   python-send-receive("import emacs; print '_emacs_out ()'")
   run-python(nil t)
   python-proc()
   python-send-string("emacs.complete(\"exitCode\",\"import os\\nimport 
logging\\nimport Queue\\nimport threading\\n\")")
   python-send-receive("emacs.complete(\"exitCode\",\"import os\\nimport 
logging\\nimport Queue\\nimport threading\\n\")")
   byte-code("..." [symbol python-imports read-from-string 
python-send-receive format "emacs.complete(%S,%s)"] 6)
   python-symbol-completions("exitCode")
   (and symbol (python-symbol-completions symbol))
   (setq he-expand-list (and symbol (python-symbol-completions symbol)))
   (let ((symbol ...)) (he-init-string (- ... ...) (point)) (if (not 
...) (push he-search-string he-tried-table)) (setq he-expand-list (and 
symbol ...)))
   (if old nil (let (...) (he-init-string ... ...) (if ... ...) (setq 
he-expand-list ...)))
   (unless old (let (...) (he-init-string ... ...) (if ... ...) (setq 
he-expand-list ...)))
   (progn (unless old (let ... ... ... ...)) (while (and he-expand-list 
...) (pop he-expand-list)) (if he-expand-list (progn ... t) (if old ...) 
nil))
   (if (derived-mode-p (quote python-mode)) (progn (unless old ...) 
(while ... ...) (if he-expand-list ... ... nil)))
   (when (derived-mode-p (quote python-mode)) (unless old (let ... ... 
... ...)) (while (and he-expand-list ...) (pop he-expand-list)) (if 
he-expand-list (progn ... t) (if old ...) nil))
   python-try-complete(nil)
   apply(python-try-complete nil)
   hippie-expand(nil)
   call-interactively(hippie-expand)

And in *Python* I have:

Python 2.3.4 (#1, Feb  2 2005, 12:11:53)
[GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> Traceback (most recent call last):
   File "<stdin>", line 1, in ?
ImportError: No module named emacs
 >>>

Now the interesting thing with the second line of this output is that my 
Emacs is running on top of OS X; Linux is running on the box on which 
the Python file lives that I've opened using Tramp (that was visited 
when I ran hippie-expand.)

So apparently Python gets run remotely (by the magic of Tramp?) but the 
"emacs" package which I suspect python-mode uses for helping with 
completion isn't available on the remote host; thus the whole completion 
attempt fails, but instead of gracefully failing python-try-complete 
sits there indefinitely.

There seem to be two problems here:

1) Proper exception and/or exit code handling is missing which would 
allow the Python script to exit with an error without locking up Emacs.

2) Either the external Python process should be forced to run locally 
even if the file is remote; or python-try-complete should refrain from 
launching a Python process at all if the file is remote; or 
python-try-complete should be prepared for its external process to run 
remotely and set up its environment properly (by uploading the emacs 
module and setting PYTHONPATH accordingly.)

As I said earlier I don't use python-try-complete anymore but FWIW 
simply not running Python when file-remote-p looks to me to be the best 
option.

I'm using Emacs 22.1.2 and tramp 2.1.13.

Hope this helps,

Julian




  reply	other threads:[~2008-04-14 11:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-04 13:28 python-try-complete Julian Scheid
2008-04-11 17:52 ` python-try-complete Stefan Monnier
2008-04-12 10:00   ` python-try-complete Julian Scheid
2008-04-14 11:05     ` Julian Scheid [this message]
2012-11-25  5:45     ` bug#140: python-try-complete Chong Yidong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48033A97.8050208@gmail.com \
    --to=julians37@googlemail.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.