diff options
| author | Joakim Verona | 2012-05-21 00:37:29 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-05-21 00:37:29 +0200 |
| commit | 74f082445c1dd0c92d5bb187db0d50287e3a7bae (patch) | |
| tree | 48e3d8fd9df3876665654eab9bcf96ec492a31e9 /lisp/progmodes/python.el | |
| parent | 52862ad482e030e4d54cd7d6e250d76e59ee0554 (diff) | |
| parent | 1b170bc63c2f3a3fbe6ba6996d5a015e82634909 (diff) | |
| download | emacs-74f082445c1dd0c92d5bb187db0d50287e3a7bae.tar.gz emacs-74f082445c1dd0c92d5bb187db0d50287e3a7bae.zip | |
upstream, fix conflicts
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 09b89993626..620ea8cd519 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -69,11 +69,7 @@ | |||
| 69 | (require 'comint) | 69 | (require 'comint) |
| 70 | (require 'ansi-color) | 70 | (require 'ansi-color) |
| 71 | 71 | ||
| 72 | (eval-when-compile | 72 | (eval-when-compile (require 'compile)) |
| 73 | (require 'compile) | ||
| 74 | (require 'hippie-exp)) | ||
| 75 | |||
| 76 | (autoload 'comint-mode "comint") | ||
| 77 | 73 | ||
| 78 | (defgroup python nil | 74 | (defgroup python nil |
| 79 | "Silly walks in the Python language." | 75 | "Silly walks in the Python language." |
| @@ -1488,8 +1484,6 @@ Don't save anything for STR matching `inferior-python-filter-regexp'." | |||
| 1488 | res) | 1484 | res) |
| 1489 | (t (concat res s))))) | 1485 | (t (concat res s))))) |
| 1490 | 1486 | ||
| 1491 | (autoload 'comint-check-proc "comint") | ||
| 1492 | |||
| 1493 | (defvar python-version-checked nil) | 1487 | (defvar python-version-checked nil) |
| 1494 | (defun python-check-version (cmd) | 1488 | (defun python-check-version (cmd) |
| 1495 | "Check that CMD runs a suitable version of Python." | 1489 | "Check that CMD runs a suitable version of Python." |
| @@ -1607,7 +1601,7 @@ behavior, change `python-remove-cwd-from-path' to nil." | |||
| 1607 | ;; Fixme: Write a `coding' header to the temp file if the region is | 1601 | ;; Fixme: Write a `coding' header to the temp file if the region is |
| 1608 | ;; non-ASCII. | 1602 | ;; non-ASCII. |
| 1609 | (interactive "r") | 1603 | (interactive "r") |
| 1610 | (let* ((f (make-temp-file "py")) | 1604 | (let* ((f (make-temp-file "py" nil ".py")) |
| 1611 | (command | 1605 | (command |
| 1612 | ;; IPython puts the FakeModule module into __main__ so | 1606 | ;; IPython puts the FakeModule module into __main__ so |
| 1613 | ;; emacs.eexecfile becomes useless. | 1607 | ;; emacs.eexecfile becomes useless. |
| @@ -1684,8 +1678,6 @@ value to determine defaults." | |||
| 1684 | "Caches (directory . file) pair used in the last `python-load-file' command. | 1678 | "Caches (directory . file) pair used in the last `python-load-file' command. |
| 1685 | Used for determining the default in the next one.") | 1679 | Used for determining the default in the next one.") |
| 1686 | 1680 | ||
| 1687 | (autoload 'comint-get-source "comint") | ||
| 1688 | |||
| 1689 | (defun python-load-file (file-name) | 1681 | (defun python-load-file (file-name) |
| 1690 | "Load a Python file FILE-NAME into the inferior Python process. | 1682 | "Load a Python file FILE-NAME into the inferior Python process. |
| 1691 | If the file has extension `.py' import or reload it as a module. | 1683 | If the file has extension `.py' import or reload it as a module. |
| @@ -1776,7 +1768,7 @@ will." | |||
| 1776 | ;; allow C-c C-f in help buffer. | 1768 | ;; allow C-c C-f in help buffer. |
| 1777 | (let ((temp-buffer-show-hook ; avoid xref stuff | 1769 | (let ((temp-buffer-show-hook ; avoid xref stuff |
| 1778 | (lambda () | 1770 | (lambda () |
| 1779 | (toggle-read-only 1) | 1771 | (setq buffer-read-only t) |
| 1780 | (setq view-return-to-alist | 1772 | (setq view-return-to-alist |
| 1781 | (list (cons (selected-window) help-return-method)))))) | 1773 | (list (cons (selected-window) help-return-method)))))) |
| 1782 | (with-output-to-temp-buffer (help-buffer) | 1774 | (with-output-to-temp-buffer (help-buffer) |
| @@ -2476,15 +2468,6 @@ with skeleton expansions for compound statement templates. | |||
| 2476 | nil t) | 2468 | nil t) |
| 2477 | (add-hook 'completion-at-point-functions | 2469 | (add-hook 'completion-at-point-functions |
| 2478 | 'python-completion-at-point nil 'local) | 2470 | 'python-completion-at-point nil 'local) |
| 2479 | ;; Fixme: should be in hideshow. This seems to be of limited use | ||
| 2480 | ;; since it isn't (can't be) indentation-based. Also hide-level | ||
| 2481 | ;; doesn't seem to work properly. | ||
| 2482 | (add-to-list 'hs-special-modes-alist | ||
| 2483 | `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" | ||
| 2484 | ,(lambda (_arg) | ||
| 2485 | (python-end-of-defun) | ||
| 2486 | (skip-chars-backward " \t\n")) | ||
| 2487 | nil)) | ||
| 2488 | (set (make-local-variable 'skeleton-further-elements) | 2471 | (set (make-local-variable 'skeleton-further-elements) |
| 2489 | '((< '(backward-delete-char-untabify (min python-indent | 2472 | '((< '(backward-delete-char-untabify (min python-indent |
| 2490 | (current-column)))) | 2473 | (current-column)))) |
| @@ -2623,9 +2606,17 @@ problem." | |||
| 2623 | (let* ((filename (match-string 1 block)) | 2606 | (let* ((filename (match-string 1 block)) |
| 2624 | (lineno (string-to-number (match-string 2 block))) | 2607 | (lineno (string-to-number (match-string 2 block))) |
| 2625 | (funcname (match-string 3 block)) | 2608 | (funcname (match-string 3 block)) |
| 2609 | (msg (get-text-property 0 'compilation-message filename)) | ||
| 2610 | (loc (and msg (compilation--message->loc msg))) | ||
| 2626 | funcbuffer) | 2611 | funcbuffer) |
| 2627 | 2612 | ||
| 2628 | (cond ((file-exists-p filename) | 2613 | (cond ((and loc (markerp (compilation--loc->marker loc))) |
| 2614 | (setq funcbuffer (marker-buffer (compilation--loc->marker loc))) | ||
| 2615 | (list (with-current-buffer funcbuffer | ||
| 2616 | (line-number-at-pos (compilation--loc->marker loc))) | ||
| 2617 | funcbuffer)) | ||
| 2618 | |||
| 2619 | ((file-exists-p filename) | ||
| 2629 | (list lineno (find-file-noselect filename))) | 2620 | (list lineno (find-file-noselect filename))) |
| 2630 | 2621 | ||
| 2631 | ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname lineno)) | 2622 | ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname lineno)) |
| @@ -2643,15 +2634,12 @@ problem." | |||
| 2643 | (buffer-substring | 2634 | (buffer-substring |
| 2644 | (point-min) (point-max))) | 2635 | (point-min) (point-max))) |
| 2645 | ))))))) | 2636 | ))))))) |
| 2646 | (list lineno funcbuffer)) | 2637 | (list lineno funcbuffer)) |
| 2647 | 2638 | ||
| 2648 | ((= (elt filename 0) ?\<) | 2639 | ((= (elt filename 0) ?\<) |
| 2649 | (format "(Non-file source: '%s')" filename)) | 2640 | (format "(Non-file source: '%s')" filename)) |
| 2650 | 2641 | ||
| 2651 | (t (format "Not found: %s(), %s" funcname filename))) | 2642 | (t (format "Not found: %s(), %s" funcname filename)))))) |
| 2652 | ) | ||
| 2653 | ) | ||
| 2654 | ) | ||
| 2655 | 2643 | ||
| 2656 | (defun python-pdbtrack-grub-for-buffer (funcname _lineno) | 2644 | (defun python-pdbtrack-grub-for-buffer (funcname _lineno) |
| 2657 | "Find recent Python mode buffer named, or having function named FUNCNAME." | 2645 | "Find recent Python mode buffer named, or having function named FUNCNAME." |
| @@ -2725,6 +2713,17 @@ comint believe the user typed this string so that | |||
| 2725 | ;; continue standard unloading | 2713 | ;; continue standard unloading |
| 2726 | nil) | 2714 | nil) |
| 2727 | 2715 | ||
| 2716 | ;;;; Finish up | ||
| 2717 | ;; Fixme: should be in hideshow. This seems to be of limited use | ||
| 2718 | ;; since it isn't (can't be) indentation-based. Also hide-level | ||
| 2719 | ;; doesn't seem to work properly. | ||
| 2720 | (add-to-list 'hs-special-modes-alist | ||
| 2721 | `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#" | ||
| 2722 | ,(lambda (_arg) | ||
| 2723 | (python-end-of-defun) | ||
| 2724 | (skip-chars-backward " \t\n")) | ||
| 2725 | nil)) | ||
| 2726 | |||
| 2728 | (provide 'python) | 2727 | (provide 'python) |
| 2729 | (provide 'python-21) | 2728 | (provide 'python-21) |
| 2730 | 2729 | ||