diff options
| author | memeplex | 2019-10-14 21:37:20 -0300 |
|---|---|---|
| committer | Noam Postavsky | 2019-10-22 20:11:49 -0400 |
| commit | ab6728787245e0d46bd8a8919e30c882f6011182 (patch) | |
| tree | 80c34bbc33f4393133974cfc769f078440c48be6 | |
| parent | 5f67809a8f34be99d2d1cb081c071b72655a59f1 (diff) | |
| download | emacs-ab6728787245e0d46bd8a8919e30c882f6011182.tar.gz emacs-ab6728787245e0d46bd8a8919e30c882f6011182.zip | |
Avoid extra lines in python-shell font lock buffer (Bug#33959)
* lisp/progmodes/python.el
(python-shell-font-lock-comint-output-filter-function): Avoid writing
a newline to the font lock buffer when receiving an empty string.
| -rw-r--r-- | lisp/progmodes/python.el | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index b168b62c291..634c297957d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -2600,18 +2600,19 @@ goes wrong and syntax highlighting in the shell gets messed up." | |||
| 2600 | 2600 | ||
| 2601 | (defun python-shell-font-lock-comint-output-filter-function (output) | 2601 | (defun python-shell-font-lock-comint-output-filter-function (output) |
| 2602 | "Clean up the font-lock buffer after any OUTPUT." | 2602 | "Clean up the font-lock buffer after any OUTPUT." |
| 2603 | (if (let ((output (ansi-color-filter-apply output))) | 2603 | (unless (string= output "") ;; See Bug#33959. |
| 2604 | (and (python-shell-comint-end-of-output-p output) | 2604 | (if (let ((output (ansi-color-filter-apply output))) |
| 2605 | ;; Assume "..." represents a continuation prompt. | 2605 | (and (python-shell-comint-end-of-output-p output) |
| 2606 | (not (string-match "\\.\\.\\." output)))) | 2606 | ;; Assume "..." represents a continuation prompt. |
| 2607 | ;; If output ends with an initial (not continuation) input prompt | 2607 | (not (string-match "\\.\\.\\." output)))) |
| 2608 | ;; then the font-lock buffer must be cleaned up. | 2608 | ;; If output ends with an initial (not continuation) input prompt |
| 2609 | (python-shell-font-lock-cleanup-buffer) | 2609 | ;; then the font-lock buffer must be cleaned up. |
| 2610 | ;; Otherwise just add a newline. | 2610 | (python-shell-font-lock-cleanup-buffer) |
| 2611 | (python-shell-font-lock-with-font-lock-buffer | 2611 | ;; Otherwise just add a newline. |
| 2612 | (goto-char (point-max)) | 2612 | (python-shell-font-lock-with-font-lock-buffer |
| 2613 | (newline))) | 2613 | (goto-char (point-max)) |
| 2614 | output) | 2614 | (newline))) |
| 2615 | output)) | ||
| 2615 | 2616 | ||
| 2616 | (defun python-shell-font-lock-post-command-hook () | 2617 | (defun python-shell-font-lock-post-command-hook () |
| 2617 | "Fontifies current line in shell buffer." | 2618 | "Fontifies current line in shell buffer." |