It is quite simple to display the line end at the left boundary of the buffer with the help of line-prefix
text properties.
I hope that is acceptable for displaying the status of your tests.
The following elisp code defines the minor mode pfx-mode
(meaning: line prefix mode).
You can define the string to be displayed as line-prefix for each line by setting the option pfx-function
to an appropriate function (see the doc for that option). The default for that option is the function pfx-eol
which shows a substring taken from the line-end. You can easily define and install your own function instead. Just take a look at pfx-eol
as an example for writing your own function.
(defgroup pfx nil
"Generation of line prefix string by jit-lock."
:group 'emacs)
(defcustom pfx-function #'pfx-eol
"Function called with a position POS as argument that should return
the prefix string for the line including POS."
:group 'pfx
:type 'function)
(defcustom pfx-eol-length 3
"Length of the string at end of line that should be shown in the line prefix."
:group 'pfx
:type 'number)
(defface pfx-face
'((t :foreground "red" :background "grey50"))
"Face for displaying line prefixes."
:group 'pfx)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun pfx-eol (pos)
"Return substring of maximal length `pfx-eol-length'
at end of the line containing character position POS."
(save-excursion
(goto-char pos)
(let ((eol (line-end-position))
(bol (line-beginning-position)))
(buffer-substring-no-properties (max bol (- eol pfx-eol-length)) eol))))
(defun pfx-update-prefix-at (pos)
"Update prefix at the line containing POS"
(let* ((str (propertize (funcall pfx-function pos) 'face 'pfx-face))
(bol (line-beginning-position))
(bol1 (1+ bol)))
(when (> (point-max) bol1)
(put-text-property bol bol1 'line-prefix str))))
(defun pfx-update-prefix (start end)
"Update prefix text property of the lines
for region from START to END."
(pfx-update-prefix-at start)
(save-excursion
(goto-char start)
(while (search-forward "\n" end t)
(pfx-update-prefix-at (point)))))
(define-minor-mode pfx-mode
"Show string produced by `pfx-function' as line prefix."
nil
" EolP"
nil
(if pfx-mode
(jit-lock-register #'pfx-update-prefix)
(jit-lock-unregister #'pfx-update-prefix)
(with-silent-modifications (remove-text-properties 1 (buffer-size) '(line-prefix nil))))
(jit-lock-refontify))
I've used the following line in a *shell*
buffer as test case:
emacs --batch --eval '(send-string-to-terminal (mapconcat (lambda (i) (concat "begin" (make-string i ?.) "end\n")) (number-sequence 40 200) ""))'
The following picture shows a screenshot of emacs after switching on pfx-mode
in a shell
window and running above test case:
