From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rasmus Newsgroups: gmane.emacs.bugs Subject: bug#18582: 24.4.50; [python.el] completion error Date: Wed, 01 Oct 2014 16:56:56 +0200 Message-ID: <87y4szx2h3.fsf@gmx.us> References: <87lhp27gt2.fsf@gmx.us> <87iok4xcgf.fsf@gmx.us> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1412175512 32623 80.91.229.3 (1 Oct 2014 14:58:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 1 Oct 2014 14:58:32 +0000 (UTC) Cc: 18582@debbugs.gnu.org, fabian@anue.biz To: monnier@iro.umontreal.ca Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Oct 01 16:58:22 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XZLMC-000434-Cp for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Oct 2014 16:58:20 +0200 Original-Received: from localhost ([::1]:55896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZLMC-0001eO-1y for geb-bug-gnu-emacs@m.gmane.org; Wed, 01 Oct 2014 10:58:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33587) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZLM2-0001dS-T1 for bug-gnu-emacs@gnu.org; Wed, 01 Oct 2014 10:58:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XZLLv-0004md-4p for bug-gnu-emacs@gnu.org; Wed, 01 Oct 2014 10:58:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XZLLv-0004mY-0t for bug-gnu-emacs@gnu.org; Wed, 01 Oct 2014 10:58:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XZLLu-0000Tq-Hj for bug-gnu-emacs@gnu.org; Wed, 01 Oct 2014 10:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Rasmus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 01 Oct 2014 14:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18582 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18582-submit@debbugs.gnu.org id=B18582.14121754291766 (code B ref 18582); Wed, 01 Oct 2014 14:58:02 +0000 Original-Received: (at 18582) by debbugs.gnu.org; 1 Oct 2014 14:57:09 +0000 Original-Received: from localhost ([127.0.0.1]:57543 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XZLL2-0000SP-Li for submit@debbugs.gnu.org; Wed, 01 Oct 2014 10:57:09 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:57915) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XZLKz-0000SG-C2 for 18582@debbugs.gnu.org; Wed, 01 Oct 2014 10:57:06 -0400 Original-Received: from x200s ([193.145.48.46]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0M7TQZ-1YURtV2rjj-00xJ6G; Wed, 01 Oct 2014 16:56:58 +0200 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAAAAAByaaZbAAAAAmJLR0QA/4ePzL8AAAAJcEhZ cwAAAEgAAABIAEbJaz4AAAHPSURBVEjHjZbJlQMxCAU7AKKsuCo3UpkDaOnNPX2wn22VPqAP8hH/ flDh+FgUAUSAmqn+BgBVVDO/ACIQ1FDT1C8FQCiZVAU/cyBCKigiPpOu6sD6dDzvewb2D8fTMk4E yfrB43nfDcF0g08hAaP0a9cw3YI61v59pIyKTGAUCJgATVAmqN9mTPWFmjmThiDGOdFiG2GbKadC CVBFH8HVRrQrdACsR6VcJC0MZmZmmmaXtQUcGh3VeBtONfOq4J4GVLb09gvoBETXKzjg3J6R9La/ ZWTKpESFpDegDc9Yv86jiBMQM+YuYEcz7TSJCTijGc3FNIR5B9p0Q0DQPuN5CneABYjEUHyo0shi CTAzxlegQqJz3tz6CMSmsNwNgfITyL0d0Ew2lfPUmMe19Vtm+bZrdQWmvzfZ8lod3nWQ4d7wc5gs Q3FXYDmlR2X1kGbeZ+tsnJFK93+f9MMwno3qqdCt4MP0rkWnL2YyGnkHyndjYKyCmQB3YJbQ66mD j0BEQJrpYgpM8Q3oqWXuxlPe7ri+1NLcjeqrQqzG2BSquC933Bo2aypVmG+XoosY66t4b0CbYwup Z+z7tTvH60kgv/5r9HqJDu7rn0ARgt1zfwjk8VmXGaNCAAAAAElFTkSuQmCC In-Reply-To: (Stefan Monnier's message of "Wed, 01 Oct 2014 10:26:47 -0400") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux) X-Provags-ID: V03:K0:6SBjyGD4cwmTc2omJY5obOr0SZIWZqRU+8i2unh2x7xcTIkmhjE BkGM6ESNKr2F6OqaNHagJaziTej4uGvtsjGKmqe1qVGSEMy347H835qvA8T24MOfZyLYXT4 8Cx6eo7rfBB52+cMtvdeeMBGIIUm8c5wHURS6iYCxNBr0Hfq2KIb+NHurwhhAWKDpl9Uap8 36T2pEL8woCkfZeTqTtiQ== X-UI-Out-Filterresults: notjunk:1; X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:93963 Archived-At: Hi, Stefan Monnier writes: >> Backtrace: >> Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil) >> buffer-substring-no-properties(nil 5) >> python-shell-completion-at-point(#) > > Right, that looks like the same bug you were hitting with `trunk' (and > hence a different bug from the one I fixed). But it makes no sense. > The only call to buffer-substring-no-properties in > python-shell-completion-at-point (in emacs-24) is of the form: > > (buffer-substring-no-properties > (line-beginning-position) end) > > and I can't imagine how line-beginning-position could return nil. > Are you sure you don't have another python.el or python.elc that gets in > the way? I get the error as well when I load Emacs with -Q. I get the error when I do find-library python eval-buffer before loading any .py files. Find library points to python.el.gz in /usr/share/emacs/24.4.50/lisp/progmodes/. When I do M-: (md5 (current-buffer)) in python.el.gz I get ce0db2157b281b8ac7cb8461da88caa7. There's no age difference: -rw-r--r-- 1 root root 134983 Sep 29 14:10 python.elc -rw-r--r-- 1 root root 41279 Sep 29 14:00 python.el.gz Note that for the error to come, I must start the python-shell first (C-c C-z). > Or maybe your python.el was not properly recompiled so you > still use the python.elc from the trunk? I had to rename my bzr folder to get the other branch so I doubt it. > What if you M-x load-library RET python.el RET (to load the non-compiled > version)? See above. I get this backtrace now which have new stuff (below). The error occurs here: (let* ((last-prompt-end (cdr (python-util-comint-last-prompt))) (import-statement (when (string-match-p (rx (* space) word-start (or "from" "import") word-end space) (buffer-substring-no-properties last-prompt-end (point))) Last-prompt-end (and thus (python-util-comint-last-prompt)) is nil but should be a character position according to the docstring. But last-prompt-end is just comint-last-prompt is emacs24. And it's nil. I'm guessing it shouldn't be. Why? No clue. . . Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil) buffer-substring-no-properties(nil 4) (string-match-p "[[:space:]]*\\<\\(?:from\\|import\\)\\>[[:space:]]" (buffer-substring-no-properties last-prompt-end (point))) (if (string-match-p "[[:space:]]*\\<\\(?:from\\|import\\)\\>[[:space:]]" (buffer-substring-no-properties last-prompt-end (point))) (progn (buffer-substring-no-properties last-prompt-end (point)))) (let* ((last-prompt-end (cdr (python-util-comint-last-prompt))) (import-statement (if (string-match-p "[[:space:]]*\\<\\(?:from\\|import\\)\\>[[:space:]]" (buffer-substring-no-properties last-prompt-end (point))) (progn (buffer-substring-no-properties last-prompt-end (point))))) (start (save-excursion (if (not (re-search-backward "[[:space:]]\\|[([{]\\|[])}]\\|\\(?:[^\"'\\]\\|\\=\\|\\(?:[^\\]\\|\\=\\)\\\\\\(?:\\\\\\\\\\)*[\"']\\)\\(?:\\\\\\\\\\)*\\(\\(?:\"\"\"\\|'''\\|[\"']\\)\\)" last-prompt-end t 1)) last-prompt-end (forward-char (length (match-string-no-properties 0))) (point)))) (end (point))) (list start end (completion-table-dynamic (apply-partially (function python-shell-completion-get-completions) process import-statement)))) python-shell-completion-at-point(#) (progn (python-shell-completion-at-point process)) (if process (progn (python-shell-completion-at-point process))) (let ((process (python-shell-get-process))) (if process (progn (python-shell-completion-at-point process)))) python-completion-at-point() completion--capf-wrapper(python-completion-at-point all) run-hook-wrapped(completion--capf-wrapper python-completion-at-point all) completion-at-point() funcall-interactively(completion-at-point) call-interactively(completion-at-point nil nil) command-execute(completion-at-point) Thanks, Rasmus -- C is for Cookie