bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#35624: log-view-diff regression


From: Juri Linkov
Subject: bug#35624: log-view-diff regression
Date: Thu, 16 May 2019 00:12:54 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> I don't remember what VC backend produced such header, maybe
>> vc-bzr or vc-svn.  Or probably vc-cvs because CVS has the same
>> header as RCS, and I can easily check what headers RCS produces
>> because it doesn't require any configuration.  For brevity
>> only essential part of RCS log is left here for demonstration:
>
> Thank you.
>
>> Working file:
>
> I guess RCS at least outputs some pertinent information here, not just that
> text, so it's less puzzling. I don't know how useful it is, though.

Yes, RCS displays a multi-line header.

>> ----------------------------
>> revision 1.4
>> ----------------------------
>> revision 1.3
>> ----------------------------
>> revision 1.2
>> ----------------------------
>> revision 1.1
>>
>> When the beginning of the region is on the "Working file" line
>> in the header, and the end of the region is on a revision line,
>> e.g. "revision 1.4", then typing `=' displays:
>>
>>    No changes between 1.4 and workfile
>
> You can also type 'C-u C-x v =', then '1.4', RET and C-j to omit the end
> version. That would also show the diff against the workfile.

10 keys more to type.

>>>> +      (with-current-buffer buffer
>>>> +  (insert "Working\n")
>>>
>>> How does the result look? Just the word "Working" at the beginning of
>>> the buffer?
>>
>> If the word "Working" is too ambiguous, then at least an empty line
>> at the beginning of the buffer will enable this feature for Git.
>
> Should we really make the log look weirder for the sake of a feature one
> would use at most, I don't know... once a month?

When this feature was enabled, I used it every day.  Currently I'm forced
to type 10 more keys every time.  I agree the log not to look weirder,
so better to not display Working.

>> and if the current workfile has some changes, then differences
>> between 1.4 and workfile are displayed.
>>
>> This means that RCS supports this nice feature, but Git doesn't.
>
> Just how nice is it, really? It seems pretty niche to me, and I don't
> remember the last time I needed something like this exactly.

Or course, you didn't think about it, because you didn't know it exists.
I didn't know too until discovered it accidentally.  After that it hard
to lose this ability.  The problem is that this useful feature is
undocumented.  Here is the patch that documents it:

diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 4986c11103..12cee5d922 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1033,6 +1033,7 @@ VC Change Log
 Visit the revision indicated at the current line.
 
 @item d
+@itemx =
 Display a diff between the revision at point and the next earlier
 revision, for the specific file.
 
@@ -1047,6 +1048,16 @@ VC Change Log
 revision at point.
 @end table
 
+To compare two arbitrary revisions, activate the region: set the
+beginning of the region to the line with the first revision and the
+end of the region to the line with the second revision to compare,
+then type @kbd{d} or @kbd{=}.  When the beginning of the region is on
+the top line that has no revision, it uses the current work file as
+the first revision to compare.  When the end of the region is on the
+bottom non-revision line after the last revision line, then it uses
+the next earlier revision after the last displayed revision as the
+second revision to compare.
+
 @vindex vc-log-show-limit
 Because fetching many log entries can be slow, the
 @file{*vc-change-log*} buffer displays no more than 2000 revisions by
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 61c13026cc..b6feb3b8d1 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1017,8 +1017,8 @@ vc-git-print-log
     ;; If the buffer exists from a previous invocation it might be
     ;; read-only.
     (let ((inhibit-read-only t))
-      (with-current-buffer
-          buffer
+      (with-current-buffer buffer
+       (insert "\n")
        (apply 'vc-git-command buffer
               'async files
               (append





reply via email to

[Prev in Thread] Current Thread [Next in Thread]