diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 77e10cf06e0..ce54d2a0873 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2654,8 +2654,7 @@ problem." | |||
| 2654 | ;; Add in number of lines for leading '##' comments: | 2654 | ;; Add in number of lines for leading '##' comments: |
| 2655 | (setq lineno | 2655 | (setq lineno |
| 2656 | (+ lineno | 2656 | (+ lineno |
| 2657 | (save-excursion | 2657 | (with-current-buffer funcbuffer |
| 2658 | (set-buffer funcbuffer) | ||
| 2659 | (if (equal (point-min)(point-max)) | 2658 | (if (equal (point-min)(point-max)) |
| 2660 | 0 | 2659 | 0 |
| 2661 | (count-lines | 2660 | (count-lines |
| @@ -2683,13 +2682,12 @@ problem." | |||
| 2683 | (while (and buffers (not got)) | 2682 | (while (and buffers (not got)) |
| 2684 | (setq buf (car buffers) | 2683 | (setq buf (car buffers) |
| 2685 | buffers (cdr buffers)) | 2684 | buffers (cdr buffers)) |
| 2686 | (if (and (save-excursion (set-buffer buf) | 2685 | (if (and (with-current-buffer buf |
| 2687 | (string= major-mode "python-mode")) | 2686 | (string= major-mode "python-mode")) |
| 2688 | (or (string-match funcname (buffer-name buf)) | 2687 | (or (string-match funcname (buffer-name buf)) |
| 2689 | (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+" | 2688 | (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+" |
| 2690 | funcname "\\s-*(") | 2689 | funcname "\\s-*(") |
| 2691 | (save-excursion | 2690 | (with-current-buffer buf |
| 2692 | (set-buffer buf) | ||
| 2693 | (buffer-substring (point-min) | 2691 | (buffer-substring (point-min) |
| 2694 | (point-max)))))) | 2692 | (point-max)))))) |
| 2695 | (setq got buf))) | 2693 | (setq got buf))) |
| @@ -2747,8 +2745,7 @@ comint believe the user typed this string so that | |||
| 2747 | ;; add some comment, so that we can filter it out of history | 2745 | ;; add some comment, so that we can filter it out of history |
| 2748 | (cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename))) | 2746 | (cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename))) |
| 2749 | (unwind-protect | 2747 | (unwind-protect |
| 2750 | (save-excursion | 2748 | (with-current-buffer procbuf |
| 2751 | (set-buffer procbuf) | ||
| 2752 | (goto-char (point-max)) | 2749 | (goto-char (point-max)) |
| 2753 | (move-marker (process-mark proc) (point)) | 2750 | (move-marker (process-mark proc) (point)) |
| 2754 | (funcall (process-filter proc) proc msg)) | 2751 | (funcall (process-filter proc) proc msg)) |