unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Carlos Pita <carlosjosepita@gmail.com>
To: Noam Postavsky <npostavs@gmail.com>
Cc: 33959@debbugs.gnu.org
Subject: bug#33959: 26.1.90; python.el font-lock buffer wreaks havoc when company is enabled
Date: Mon, 14 Oct 2019 21:58:06 -0300	[thread overview]
Message-ID: <CAELgYhfYeMnnmse8rwAEtr3t1UqnOdDrhwHk4KJGJp7+ny3Tqg@mail.gmail.com> (raw)
In-Reply-To: <CAELgYhd49=-7Vae9jbULvcQNCxWmvQye4HbbYRFQHD3-C7swFQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 65 bytes --]

This should cleanly apply on top of the one you recently merged.

[-- Attachment #2: 0001-Avoid-spurious-empty-lines-in-font-lock-buffer-fixes.patch --]
[-- Type: text/x-patch, Size: 2113 bytes --]

From 5d313b0bb11ec7ace8ab6b3cee7aac3345aa4692 Mon Sep 17 00:00:00 2001
From: memeplex <carlosjosepita@gmail.com>
Date: Mon, 14 Oct 2019 21:37:20 -0300
Subject: [PATCH] Avoid spurious empty lines in font lock buffer, fixes #33959

* lisp/progmodes/python.el: add clause to avoid writing a newline to the
  font lock buffer when an empty string is received as output.
---
 lisp/progmodes/python.el | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index b168b62..86a809b 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2600,18 +2600,19 @@ python-shell-font-lock-cleanup-buffer
 
 (defun python-shell-font-lock-comint-output-filter-function (output)
   "Clean up the font-lock buffer after any OUTPUT."
-  (if (let ((output (ansi-color-filter-apply output)))
-        (and (python-shell-comint-end-of-output-p output)
-             ;; Assume "..." represents a continuation prompt.
-             (not (string-match "\\.\\.\\." output))))
-      ;; If output ends with an initial (not continuation) input prompt
-      ;; then the font-lock buffer must be cleaned up.
-      (python-shell-font-lock-cleanup-buffer)
-    ;; Otherwise just add a newline.
-    (python-shell-font-lock-with-font-lock-buffer
-      (goto-char (point-max))
-      (newline)))
-  output)
+   (unless (string= output "")
+    (if (let ((output (ansi-color-filter-apply output)))
+          (and (python-shell-comint-end-of-output-p output)
+               ;; Assume "..." represents a continuation prompt.
+               (not (string-match "\\.\\.\\." output))))
+        ;; If output ends with an initial (not continuation) input prompt
+        ;; then the font-lock buffer must be cleaned up.
+        (python-shell-font-lock-cleanup-buffer)
+      ;; Otherwise just add a newline.
+      (python-shell-font-lock-with-font-lock-buffer
+        (goto-char (point-max))
+        (newline)))
+    output))
 
 (defun python-shell-font-lock-post-command-hook ()
   "Fontifies current line in shell buffer."
-- 
2.20.1


  reply	other threads:[~2019-10-15  0:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03  2:08 bug#33959: 26.1.90; python.el font-lock buffer wreaks havoc when eldoc is enabled Carlos Pita
2019-01-03  2:34 ` bug#33959: Carlos Pita
2019-01-03  4:40   ` bug#33959: Carlos Pita
2019-01-03  5:38     ` bug#33959: Carlos Pita
2019-04-05  2:36       ` bug#33959: 26.1.90; python.el font-lock buffer wreaks havoc when company is enabled Noam Postavsky
2019-04-16 21:47         ` Carlos Pita
2019-04-16 22:04           ` Noam Postavsky
2019-04-16 22:08             ` Carlos Pita
2019-04-16 22:14               ` Carlos Pita
2019-04-16 23:01                 ` Noam Postavsky
2019-04-16 23:51                   ` Noam Postavsky
2019-05-11  3:51                     ` Noam Postavsky
2019-04-05  2:55 ` bug#33959: 26.1.90; python.el font-lock buffer wreaks havoc when eldoc " Noam Postavsky
2019-04-16 20:42   ` Carlos Pita
2019-10-13 19:39 ` bug#33959: Carlos Pita
2019-10-13 19:44   ` bug#33959: Lars Ingebrigtsen
2019-10-13 19:51     ` bug#33959: Carlos Pita
2019-10-15  0:34   ` bug#33959: 26.1.90; python.el font-lock buffer wreaks havoc when company is enabled Noam Postavsky
2019-10-15  0:52     ` Carlos Pita
2019-10-15  0:58       ` Carlos Pita [this message]
2019-10-16 20:35         ` Carlos Pita
2019-10-21 20:56           ` Carlos Pita
2019-10-23  0:18           ` Noam Postavsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAELgYhfYeMnnmse8rwAEtr3t1UqnOdDrhwHk4KJGJp7+ny3Tqg@mail.gmail.com \
    --to=carlosjosepita@gmail.com \
    --cc=33959@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).