aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorStefan Monnier2014-10-03 22:35:28 -0400
committerStefan Monnier2014-10-03 22:35:28 -0400
commitcb325041b054c0409bff6dd11e4812b87e628f18 (patch)
tree89f01d5e70c2bc66ce46ff0fbc5ba95951c823e2 /lisp/progmodes/python.el
parent259a0b6d3bc6ffe0d5d24368e415fa46f439a844 (diff)
downloademacs-cb325041b054c0409bff6dd11e4812b87e628f18.tar.gz
emacs-cb325041b054c0409bff6dd11e4812b87e628f18.zip
* lisp/progmodes/python.el: Avoid building unneeded markers.
(python-font-lock-keywords, python-indent-dedent-line) (python-fill-paren, python-shell-completion-complete-or-indent): Prefer point over point-marker. (inferior-python-mode): Remove redundant completion settings.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el24
1 files changed, 10 insertions, 14 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index f6e1021c86a..dfefe837569 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -545,7 +545,7 @@ The type returned can be `comment', `string' or `paren'."
545 (res nil)) 545 (res nil))
546 (while (and (setq res (re-search-forward re limit t)) 546 (while (and (setq res (re-search-forward re limit t))
547 (or (python-syntax-context 'paren) 547 (or (python-syntax-context 'paren)
548 (equal (char-after (point-marker)) ?=)))) 548 (equal (char-after (point)) ?=))))
549 res)) 549 res))
550 (1 font-lock-variable-name-face nil nil)) 550 (1 font-lock-variable-name-face nil nil))
551 ;; support for a, b, c = (1, 2, 3) 551 ;; support for a, b, c = (1, 2, 3)
@@ -1042,9 +1042,9 @@ See `python-indent-line' for details."
1042 "De-indent current line." 1042 "De-indent current line."
1043 (interactive "*") 1043 (interactive "*")
1044 (when (and (not (python-syntax-comment-or-string-p)) 1044 (when (and (not (python-syntax-comment-or-string-p))
1045 (<= (point-marker) (save-excursion 1045 (<= (point) (save-excursion
1046 (back-to-indentation) 1046 (back-to-indentation)
1047 (point-marker))) 1047 (point)))
1048 (> (current-column) 0)) 1048 (> (current-column) 0))
1049 (python-indent-line t) 1049 (python-indent-line t)
1050 t)) 1050 t))
@@ -2399,12 +2399,8 @@ variable.
2399 python-comint-postoutput-scroll-to-bottom)) 2399 python-comint-postoutput-scroll-to-bottom))
2400 (set (make-local-variable 'compilation-error-regexp-alist) 2400 (set (make-local-variable 'compilation-error-regexp-alist)
2401 python-shell-compilation-regexp-alist) 2401 python-shell-compilation-regexp-alist)
2402 (define-key inferior-python-mode-map [remap complete-symbol]
2403 'completion-at-point)
2404 (add-hook 'completion-at-point-functions 2402 (add-hook 'completion-at-point-functions
2405 'python-shell-completion-at-point nil 'local) 2403 #'python-shell-completion-at-point nil 'local)
2406 (add-to-list (make-local-variable 'comint-dynamic-complete-functions)
2407 'python-shell-completion-at-point)
2408 (define-key inferior-python-mode-map "\t" 2404 (define-key inferior-python-mode-map "\t"
2409 'python-shell-completion-complete-or-indent) 2405 'python-shell-completion-complete-or-indent)
2410 (make-local-variable 'python-pdbtrack-buffers-to-kill) 2406 (make-local-variable 'python-pdbtrack-buffers-to-kill)
@@ -2960,7 +2956,7 @@ If not try to complete."
2960 (interactive) 2956 (interactive)
2961 (if (string-match "^[[:space:]]*$" 2957 (if (string-match "^[[:space:]]*$"
2962 (buffer-substring (comint-line-beginning-position) 2958 (buffer-substring (comint-line-beginning-position)
2963 (point-marker))) 2959 (point)))
2964 (indent-for-tab-command) 2960 (indent-for-tab-command)
2965 (completion-at-point))) 2961 (completion-at-point)))
2966 2962
@@ -3291,8 +3287,7 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'."
3291 (save-restriction 3287 (save-restriction
3292 (narrow-to-region (progn 3288 (narrow-to-region (progn
3293 (while (python-syntax-context 'paren) 3289 (while (python-syntax-context 'paren)
3294 (goto-char (1- (point-marker)))) 3290 (goto-char (1- (point))))
3295 (point-marker)
3296 (line-beginning-position)) 3291 (line-beginning-position))
3297 (progn 3292 (progn
3298 (when (not (python-syntax-context 'paren)) 3293 (when (not (python-syntax-context 'paren))
@@ -3301,8 +3296,8 @@ JUSTIFY should be used (if applicable) as in `fill-paragraph'."
3301 (skip-syntax-backward "^)"))) 3296 (skip-syntax-backward "^)")))
3302 (while (and (python-syntax-context 'paren) 3297 (while (and (python-syntax-context 'paren)
3303 (not (eobp))) 3298 (not (eobp)))
3304 (goto-char (1+ (point-marker)))) 3299 (goto-char (1+ (point))))
3305 (point-marker))) 3300 (point)))
3306 (let ((paragraph-start "\f\\|[ \t]*$") 3301 (let ((paragraph-start "\f\\|[ \t]*$")
3307 (paragraph-separate ",") 3302 (paragraph-separate ",")
3308 (fill-paragraph-function)) 3303 (fill-paragraph-function))
@@ -4323,7 +4318,8 @@ Arguments START and END narrow the buffer region to work on."
4323 (add-to-list 'hs-special-modes-alist 4318 (add-to-list 'hs-special-modes-alist
4324 `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" 4319 `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
4325 ,(lambda (_arg) 4320 ,(lambda (_arg)
4326 (python-nav-end-of-defun)) nil)) 4321 (python-nav-end-of-defun))
4322 nil))
4327 4323
4328 (set (make-local-variable 'outline-regexp) 4324 (set (make-local-variable 'outline-regexp)
4329 (python-rx (* space) block-start)) 4325 (python-rx (* space) block-start))