GNU bug report logs - #18175
files.el: use mapc in (mapcar 'switch-to-buffer ...)

Previous Next

Package: emacs;

Reported by: Ivan Shmakov <ivan <at> siamics.net>

Date: Sat, 2 Aug 2014 21:56:02 UTC

Severity: wishlist

Tags: patch

Fixed in version 25.1

Done: Ivan Shmakov <ivan <at> siamics.net>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 18175 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Ivan Shmakov <ivan <at> siamics.net>
Cc: 18175 <at> debbugs.gnu.org
Subject: Re: bug#18175: files.el: use mapc in (mapcar 'switch-to-buffer ...)
Date: Wed, 06 Aug 2014 13:26:22 -0400
> 	Given that switch-to-buffer returns its argument, /and/ given
> 	that mapc returns the sequence it’s given, I suggest that the
> 	(mapcar 'switch-to-buffer LIST) forms in lisp/files.el be
> 	replaced with (mapc 'switch-to-buffer LIST), – if only to avoid
> 	the unnecessary consing when the list is effectively copied in
> 	the mapcar case.

Thanks, I think it's indeed a valid/correct optimization, but I really
dislike relying on mapc's return value (it really should not return any
value at all).

In this case, the optimization doesn't seem worth the inconvenient of
having a very unusual code (relying on mapc's return value), since
those few cons cells we save are drowned in the noise of all the
code run by switch-to-buffer.


        Stefan




This bug report was last modified 10 years and 179 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.