git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "Rüdiger Sonderfeld" <ruediger@c-plusplus.de>
Cc: git@vger.kernel.org, davidk@lysator.liu.se,
	Sergei Organov <osv@javad.com>, Kevin Ryde <user42@zip.com.au>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] git-blame.el: use mapc instead of mapcar
Date: Sun, 10 Jun 2012 02:38:03 -0500	[thread overview]
Message-ID: <20120610073803.GA29461@burratino> (raw)
In-Reply-To: <2608010.fNV39qBMLu@descartes>

From: Rüdiger Sonderfeld <ruediger@c-plusplus.de>

Using mapcar here is a waste of memory because the mapped result
is not used.

Noticed by emacs ("Warning: `mapcar' called for effect").

[jn: split from a larger patch, with new description]

Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
In January, Rüdiger Sonderfeld wrote:

> Replace mapcar with mapc because accumulation of the results was not
> needed. (git-blame-cleanup)
>
> Replace two occurrences of (save-excursion (set-buffer buf) ...)
> with (with-current-buffer buf ...). (git-blame-filter and
> git-blame-create-overlay)
>
> Replace goto-line with (goto-char (point-min)) (forward-line (1-
> start-line)). According to the documentation of goto-line it should
> not be called from elisp code. (git-blame-create-overlay)
>
> Signed-off-by: Rüdiger Sonderfeld <ruediger@c-plusplus.de>
> ---
>  contrib/emacs/git-blame.el |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)

Thanks again, and sorry for the long silence.

I'd prefer to see someone more knowledgeable than I am about elisp
submit the other two fixes.  This one is simple enough that I can
vouch for it, though.  One out of three is not that bad, I guess. :)

Thoughts?
Jonathan

 contrib/emacs/git-blame.el |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index d351cfb6..37d797e1 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -304,7 +304,7 @@ See also function `git-blame-mode'."
 
 (defun git-blame-cleanup ()
   "Remove all blame properties"
-    (mapcar 'delete-overlay git-blame-overlays)
+    (mapc 'delete-overlay git-blame-overlays)
     (setq git-blame-overlays nil)
     (remove-git-blame-text-properties (point-min) (point-max)))
 
-- 
1.7.10

  parent reply	other threads:[~2012-06-10  7:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-12 15:44 [PATCH] git-blame.el: Fix compilation warnings Rüdiger Sonderfeld
2012-01-12 16:26 ` Jonathan Nieder
2012-01-12 17:08   ` Rüdiger Sonderfeld
2012-01-13 23:31     ` Sending patches with KMail (Re: [PATCH] git-blame.el: Fix compilation warnings.) Jonathan Nieder
2012-01-14  0:59       ` Junio C Hamano
2012-01-14 18:31         ` Sending patches with KMail Jonathan Nieder
2012-01-14 18:34           ` Jonathan Nieder
2012-01-15  2:14           ` Junio C Hamano
2012-01-14 19:18         ` Sending patches with KMail (Re: [PATCH] git-blame.el: Fix compilation warnings.) Rüdiger Sonderfeld
2012-06-10  7:38 ` Jonathan Nieder [this message]
2012-06-10 11:58   ` [PATCH 1/3] git-blame.el: Do not use goto-line in lisp code Lawrence Mitchell
2012-06-10 11:58     ` [PATCH 2/3] git-blame.el: Use with-current-buffer where appropriate Lawrence Mitchell
2012-06-10 11:58       ` [PATCH 3/3] git-blame.el: Do not use bare 0 to mean (point-min) Lawrence Mitchell
2012-06-14  5:08     ` [PATCH 1/3] git-blame.el: Do not use goto-line in lisp code Jonathan Nieder
2012-06-14  9:14       ` Lawrence Mitchell
2012-06-14  9:37         ` [PATCH v2 " Lawrence Mitchell
2012-06-14  9:37           ` [PATCH v2 2/3] git-blame.el: Use with-current-buffer where appropriate Lawrence Mitchell
2012-06-14  9:38             ` [PATCH v2 3/3] git-blame.el: Do not use bare 0 to mean (point-min) Lawrence Mitchell

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120610073803.GA29461@burratino \
    --to=jrnieder@gmail.com \
    --cc=davidk@lysator.liu.se \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=osv@javad.com \
    --cc=ruediger@c-plusplus.de \
    --cc=user42@zip.com.au \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.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).