From: Xavier Maillard <zedek@gnu.org>
To: "David Kågedal" <davidk@lysator.liu.se>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] git-blame.el: pick a set of random colors when blaming
Date: Tue, 27 Mar 2007 17:31:58 +0200 [thread overview]
Message-ID: <200703271531.l2RFVwOM008315@localhost.localdomain> (raw)
In-Reply-To: <87bqifrs7r.fsf@morpheus.local> (davidk@lysator.liu.se)
Hi,
> I thought it would be cooler to have different set of colors each time
> I blame.
But the code for it looks weird:
Why ? It looks good to me except the "small" quircks :)
> @@ -302,9 +320,8 @@ See also function `git-blame-mode'."
> (inhibit-point-motion-hooks t)
> (inhibit-modification-hooks t))
> (when (not info)
> - (let ((color (pop git-blame-colors)))
> - (unless color
> - (setq color git-blame-ancient-color))
> + (let ((color (or (elt git-blame-colors (random (length git-blame-colors)))
> + git-blame-ancient-color)))
> (setq info (list hash src-line res-line num-lines
> (git-describe-commit hash)
> (cons 'color color))))
Instead of using the colors one at a time, you randomly select one of
them. This means that you might select the same color twice or more,
and even twice in a row. And you will never run out of colors, so
git-blame-ancient-color will never be used.
I partly agree with you.
Random is not enough and we need to delete the color we just
set. This is what I am currently doing in the next patch. There
is still an interrogation: what is the problem if we never fail
and thus, never use git-blame-ancient-color ?
> * Prevent (future possible) namespace clash by renaming `color-scale'
> into `git-blame-color-scale'. Definition has been changed to be more
> in the "lisp" way (thanks for help goes to #emacs). Also added a small
> description of what it does.
Ok, but the heavier cl dependency is noted below.
I kept cl but I surrounded it into an eval-when-compile form as
requested by elisp standards.
> * Do not require 'cl at startup.
You removed the pop calls, but added a couple of dolist calls. So you
still need to require cl.
Yep. See below.
Thank you for your review !
Xavier
next prev parent reply other threads:[~2007-03-27 16:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-26 21:01 [PATCH 2/2] git-blame.el: pick a set of random colors when blaming Xavier Maillard
2007-03-27 8:44 ` David Kågedal
2007-03-27 15:31 ` Xavier Maillard [this message]
2007-03-28 8:49 ` David Kågedal
2007-03-27 21:51 ` [PATCH] git-blame.el: pick a set of random colors for each git-blame turn Xavier Maillard
2007-03-28 9:15 ` David Kågedal
2007-03-28 10:29 ` Xavier Maillard
2007-03-28 10:31 ` Xavier Maillard
2007-03-28 12:02 ` David Kågedal
2007-03-28 16:44 ` Xavier Maillard
2007-03-29 9:26 ` David Kågedal
2007-03-29 9:59 ` Xavier Maillard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200703271531.l2RFVwOM008315@localhost.localdomain \
--to=zedek@gnu.org \
--cc=davidk@lysator.liu.se \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).