unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs
@ 2014-07-25 21:34 Dima Kogan
  2014-07-26  3:12 ` bug#18110: clarification Dima Kogan
  2016-02-23 12:30 ` bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs Lars Ingebrigtsen
  0 siblings, 2 replies; 6+ messages in thread
From: Dima Kogan @ 2014-07-25 21:34 UTC (permalink / raw)
  To: 18110

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

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. This
was done by an (indent-region) call. This patch fixes this issue by removing
this call. It might be good to remove a constant amount of whitespace from the
beginning of each log line, but it's not obvious that matters, and it seems more
trouble than it's worth.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-vc-git-expanded-log-entry-no-longer-strips-leading-w.patch --]
[-- Type: text/x-diff, Size: 1277 bytes --]

From 0b5ac295402eb99034602df352533f3b1d21fe24 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Fri, 25 Jul 2014 14:33:10 -0700
Subject: [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace
 from git logs

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. This
was done by an (indent-region) call. This patch fixes this issue by removing
this call. It might be good to remove a constant amount of whitespace from the
beginning of each log line, but it's not obvious that matters, and it seems more
trouble than it's worth.
---
 lisp/vc/vc-git.el | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 9c8ab3b..a03ef0c 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -894,10 +894,7 @@ or BRANCH^ (where \"^\" can be repeated)."
   (with-temp-buffer
     (apply 'vc-git-command t nil nil (list "log" revision "-1"))
     (goto-char (point-min))
-    (unless (eobp)
-      ;; Indent the expanded log entry.
-      (indent-region (point-min) (point-max) 2)
-      (buffer-string))))
+    (unless (eobp) (buffer-string))))
 
 (autoload 'vc-switches "vc")
 
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#18110: clarification
  2014-07-25 21:34 bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs Dima Kogan
@ 2014-07-26  3:12 ` Dima Kogan
  2016-02-23 12:30 ` bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs Lars Ingebrigtsen
  1 sibling, 0 replies; 6+ messages in thread
From: Dima Kogan @ 2014-07-26  3:12 UTC (permalink / raw)
  To: 18110

To clarify, the issue being fixed is not that some leading whitespace is
removed, but rather that a different amount of whitespace can be removed
from each line, and this destroys any alignment that may have been
present in the log message.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs
  2014-07-25 21:34 bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs Dima Kogan
  2014-07-26  3:12 ` bug#18110: clarification Dima Kogan
@ 2016-02-23 12:30 ` Lars Ingebrigtsen
  2016-02-24  0:25   ` Dmitry Gutov
  1 sibling, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-23 12:30 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 18110

Dima Kogan <dima@secretsauce.net> writes:

> 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. This was done by an (indent-region)
> call. This patch fixes this issue by removing this call. It might be
> good to remove a constant amount of whitespace from the beginning of
> each log line, but it's not obvious that matters, and it seems more
> trouble than it's worth.

[...]

> -    (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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs
  2016-02-23 12:30 ` bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs Lars Ingebrigtsen
@ 2016-02-24  0:25   ` Dmitry Gutov
  2016-02-28  3:13     ` Dima Kogan
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Gutov @ 2016-02-24  0:25 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Dima Kogan; +Cc: 18110

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.







^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs
  2016-02-24  0:25   ` Dmitry Gutov
@ 2016-02-28  3:13     ` Dima Kogan
  2016-02-28  4:48       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 6+ messages in thread
From: Dima Kogan @ 2016-02-28  3:13 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Lars Ingebrigtsen, 18110

[-- Attachment #1: Type: text/plain, Size: 703 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-vc-git-expanded-log-entry-strips-constant-leading-wh.patch --]
[-- Type: text/x-diff, Size: 1130 bytes --]

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs
  2016-02-28  3:13     ` Dima Kogan
@ 2016-02-28  4:48       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-28  4:48 UTC (permalink / raw)
  To: Dima Kogan; +Cc: 18110, Dmitry Gutov

Dima Kogan <dima@secretsauce.net> writes:

> 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)

Thanks; applied.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-28  4:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-25 21:34 bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs Dima Kogan
2014-07-26  3:12 ` bug#18110: clarification Dima Kogan
2016-02-23 12:30 ` bug#18110: 24.4.50; [PATCH] vc-git-expanded-log-entry no longer strips leading whitespace from git logs Lars Ingebrigtsen
2016-02-24  0:25   ` Dmitry Gutov
2016-02-28  3:13     ` Dima Kogan
2016-02-28  4:48       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).