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

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

bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips l


From: Dima Kogan
Subject: bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs
Date: Sat, 27 Feb 2016 19:13:46 -0800
User-agent: mu4e 0.9.11; emacs 25.0.90.1

Dmitry Gutov <dgutov@yandex.ru> writes:

> On 02/23/2016 02:30 PM, Lars Ingebrigtsen wrote:
>
>>> -    (unless (eobp)
>>> -      ;; Indent the expanded log entry.
>>> -      (indent-region (point-min) (point-max) 2)
>>> -      (buffer-string))))
>>> +    (unless (eobp) (buffer-string))))
>>
>> It seems like a deliberate design choice...  I have no idea whether it's
>> a good one, though.  Anybody?
>
> Not wasting extra horizontal space seems like a good choice. It might be 
> implemented in a smarter way, though, like chopping off first two 
> characters from each non-empty line, instead of reindenting them all.
>
> I'd be happy to see a patch along these lines.

Here's a patch that does this

>From c206f68987cdb639b4311ce62e4b17c994aa6502 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Sat, 27 Feb 2016 19:12:56 -0800
Subject: [PATCH] `vc-git-expanded-log-entry' strips constant leading
 whitespace from git logs

lisp/vc/vc-git.el (vc-git-expanded-log-entry): When looking at expanded git
logs with `vc-print-root-log' (C-x v L, then <enter> by default), emacs was
stripping out all leading whitespace from git logs.  I now strip exactly 2
leading spaces, which retains the indentation in the logs. (bug#18110)
---
 lisp/vc/vc-git.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 1c43e3e..8498cc8 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -970,7 +970,9 @@ vc-git-expanded-log-entry
     (goto-char (point-min))
     (unless (eobp)
       ;; Indent the expanded log entry.
-      (indent-region (point-min) (point-max) 2)
+      (while (re-search-forward "^  " nil t)
+        (replace-match "")
+        (forward-line))
       (buffer-string))))
 
 (defun vc-git-region-history (file buffer lfrom lto)
-- 
2.1.4


reply via email to

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