bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18582: 24.4.50; [python.el] completion error


From: Rasmus
Subject: bug#18582: 24.4.50; [python.el] completion error
Date: Wed, 01 Oct 2014 16:56:56 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux)

Hi,

Stefan Monnier <monnier@iro.umontreal.ca> 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(#<process Python>)
>
> 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(#<process Python>)
  (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





reply via email to

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