Subject: Re: bug#35624: log-view-diff regression

From: Juri Linkov <[email-masked]>
Date: Wed, 22 May 2019 00:32:01 +0300

> Not to mention that most users would not simply think to create an active
> region before pressing 'd'.

This feature is documented.

> It's better, but a) it shifts the buffer text by 1 pixel, which I actually
> find annoying now that I look at the bottom entry that fits in that window,

My bottom line is partially visible in all buffers anyway.

> b) from your side, it should look suboptimal as well, because the cursor is
> basically invisible when it's on the top line (speaking of WYSIWYG).

Maybe just set window-start to the first non-empty line initially,
thus moving the empty line out of screen?

> If you really must have it this way, do we have an example of invisible
> text expanding when cursor moves inside, and then contracting when it's out
> again? Meaning if would look like an empty line you wanted after you press
> 'C-p', but not visible at all otherwise.

Yes, this is possible:

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index b6feb3b8d1..29acb047c6 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1018,7 +1018,11 @@ vc-git-print-log
     ;; read-only.
     (let ((inhibit-read-only t))
       (with-current-buffer buffer
-	(insert "\n")
+	(insert (propertize "\n"
+                            'invisible t
+                            'cursor-sensor-functions
+                            (list #'(lambda (_w _p dir)
+                                      (visible-mode (if (eq dir 'entered) 1 0))))))
 	(apply 'vc-git-command buffer
 	       'async files
 	       (append
@@ -1122,7 +1126,8 @@ vc-git-log-view-mode
 	     (1 'change-log-acknowledgment)
 	     (2 'change-log-acknowledgment))
 	    ("^Date:   \\(.+\\)" (1 'change-log-date))
-	    ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
+	    ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
+  (cursor-sensor-mode 1))

 (defun vc-git-show-log-entry (revision)