Subject: Re:

From: Carlos Pita <[email-masked]>
Date: Thu, 3 Jan 2019 01:40:00 -0300

Well, I think I was right both times but because the problem is more
complex than I thought at first.

When I was editing the font lock buffer itself, it was eldoc that was
adding an extra line.

But when I was editing the shell buffer line, it was company that was
adding those lines to the font lock buffer (probably because of a
weird effect of an empty menu or something invisibly opening and
adding content to the shell buffer). Btw, company is disabled in the
font lock buffer since the globalized mode is off for buffers whose
name starts with a whitespace:

(defun company-mode-on ()
  (when (and (not (or noninteractive (eq (aref (buffer-name) 0) ?\s)))
  ....

The first effect (eldoc) is simple to fix by just disabling eldoc in
the font lock buffer, but this is not even necessary since it requires
the user to directly edit the font lock buffer in order to trigger it,
and this is not a relevant use case.

For the second effect (company) I propose to delete from the beginning
of buffer each time instead of from the beginning of line, since the
font lock buffer won't contain multiline input in any case. Currently
after each change in the current line this is being done:

     (delete-region (line-beginning-position) (point-max))

but I see no reason to not call (erase-buffer) altogether.

Do you?