[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r117595: Parse completion input in a iPython friendl
From: |
Fabián Ezequiel Gallina |
Subject: |
[Emacs-diffs] trunk r117595: Parse completion input in a iPython friendly way. |
Date: |
Mon, 28 Jul 2014 04:32:42 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 117595
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/18084
committer: Fabián Ezequiel Gallina <address@hidden>
branch nick: trunk
timestamp: Mon 2014-07-28 01:32:28 -0300
message:
Parse completion input in a iPython friendly way.
* lisp/progmodes/python.el
(python-shell-completion-at-point): Rename from
python-shell-completion-complete-at-point.
(inferior-python-mode): Use it.
(python-completion-at-point): Rename from
python-completion-complete-at-point. Parse input up to first
backward occurrence of whitespace, open-paren, close-paren or
string delimiter.
(python-mode): Use it.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/progmodes/python.el python.el-20091113204419-o5vbwnq5f7feedwu-3008
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2014-07-28 03:58:06 +0000
+++ b/lisp/ChangeLog 2014-07-28 04:32:28 +0000
@@ -1,5 +1,18 @@
2014-07-28 Fabián Ezequiel Gallina <address@hidden>
+ Parse completion input in a iPython friendly way. (Bug#18084)
+ * progmodes/python.el
+ (python-shell-completion-at-point): Rename from
+ python-shell-completion-complete-at-point.
+ (inferior-python-mode): Use it.
+ (python-completion-at-point): Rename from
+ python-completion-complete-at-point. Parse input up to first
+ backward occurrence of whitespace, open-paren, close-paren or
+ string delimiter.
+ (python-mode): Use it.
+
+2014-07-28 Fabián Ezequiel Gallina <address@hidden>
+
Prevent Python process shell buffer to pop twice.
* progmodes/python.el (python-shell-switch-to-shell): Do not call
pop-to-buffer.
=== modified file 'lisp/progmodes/python.el'
--- a/lisp/progmodes/python.el 2014-07-28 03:58:06 +0000
+++ b/lisp/progmodes/python.el 2014-07-28 04:32:28 +0000
@@ -2369,9 +2369,9 @@
(define-key inferior-python-mode-map [remap complete-symbol]
'completion-at-point)
(add-hook 'completion-at-point-functions
- 'python-shell-completion-complete-at-point nil 'local)
+ 'python-shell-completion-at-point nil 'local)
(add-to-list (make-local-variable 'comint-dynamic-complete-functions)
- 'python-shell-completion-complete-at-point)
+ 'python-shell-completion-at-point)
(define-key inferior-python-mode-map "\t"
'python-shell-completion-complete-or-indent)
(make-local-variable 'python-pdbtrack-buffers-to-kill)
@@ -2896,32 +2896,21 @@
(split-string completions
"^'\\|^\"\\|;\\|'$\\|\"$" t)))))))
-(defun python-shell-completion-complete-at-point (&optional process)
- "Perform completion at point in inferior Python.
+(defun python-shell-completion-at-point (&optional process)
+ "Function for `completion-at-point-functions' in `inferior-python-mode'.
Optional argument PROCESS forces completions to be retrieved
using that one instead of current buffer's process."
(setq process (or process (get-buffer-process (current-buffer))))
(let* ((start
(save-excursion
- (with-syntax-table python-dotty-syntax-table
- (let* ((paren-depth (car (syntax-ppss)))
- (syntax-string "w_")
- (syntax-list (string-to-syntax syntax-string)))
- ;; Stop scanning for the beginning of the completion
- ;; subject after the char before point matches a
- ;; delimiter
- (while (member
- (car (syntax-after (1- (point)))) syntax-list)
- (skip-syntax-backward syntax-string)
- (when (or (equal (char-before) ?\))
- (equal (char-before) ?\"))
- (forward-char -1))
- (while (or
- ;; honor initial paren depth
- (> (car (syntax-ppss)) paren-depth)
- (python-syntax-context 'string))
- (forward-char -1)))
- (point)))))
+ (if (not (re-search-backward
+ (python-rx
+ (or whitespace open-paren close-paren string-delimiter))
+ (cdr (python-util-comint-last-prompt))
+ t 1))
+ (cdr (python-util-comint-last-prompt))
+ (forward-char (length (match-string-no-properties 0)))
+ (point))))
(end (point)))
(list start end
(completion-table-dynamic
@@ -2930,6 +2919,11 @@
process (buffer-substring-no-properties
(line-beginning-position) end))))))
+(define-obsolete-function-alias
+ 'python-shell-completion-complete-at-point
+ 'python-shell-completion-at-point
+ "24.5")
+
(defun python-shell-completion-complete-or-indent ()
"Complete or indent depending on the context.
If content before pointer is all whitespace, indent.
@@ -3036,14 +3030,19 @@
;;; Symbol completion
-(defun python-completion-complete-at-point ()
- "Complete current symbol at point.
+(defun python-completion-at-point ()
+ "Function for `completion-at-point-functions' in `python-mode'.
For this to work as best as possible you should call
`python-shell-send-buffer' from time to time so context in
inferior Python process is updated properly."
(let ((process (python-shell-get-process)))
(when process
- (python-shell-completion-complete-at-point process))))
+ (python-shell-completion-at-point process))))
+
+(define-obsolete-function-alias
+ 'python-completion-complete-at-point
+ 'python-completion-at-point
+ "24.5")
;;; Fill paragraph
@@ -4268,7 +4267,7 @@
#'python-nav-end-of-defun)
(add-hook 'completion-at-point-functions
- #'python-completion-complete-at-point nil 'local)
+ #'python-completion-at-point nil 'local)
(add-hook 'post-self-insert-hook
#'python-indent-post-self-insert-function 'append 'local)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r117595: Parse completion input in a iPython friendly way.,
Fabián Ezequiel Gallina <=