From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#18175: files.el: use mapc in (mapcar 'switch-to-buffer ...) Date: Sun, 3 Aug 2014 09:32:29 -0700 (PDT) Message-ID: <77fd6f4e-8cfd-49d1-884e-c61ce7a075a3@default> References: <87r40yftes.fsf@violet.siamics.net> <3d8bb179-4e59-4d81-9ee1-54ff0da430b0@default> <87mwbmeyva.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1407083612 2987 80.91.229.3 (3 Aug 2014 16:33:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Aug 2014 16:33:32 +0000 (UTC) To: Ivan Shmakov , 18175@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 03 18:33:25 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XDyir-0002cI-3n for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Aug 2014 18:33:25 +0200 Original-Received: from localhost ([::1]:48588 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDyiq-0002sI-OJ for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Aug 2014 12:33:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDyid-0002rL-B6 for bug-gnu-emacs@gnu.org; Sun, 03 Aug 2014 12:33:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XDyiU-00034s-KP for bug-gnu-emacs@gnu.org; Sun, 03 Aug 2014 12:33:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XDyiU-00034o-HZ for bug-gnu-emacs@gnu.org; Sun, 03 Aug 2014 12:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XDyiU-0001Fd-3U for bug-gnu-emacs@gnu.org; Sun, 03 Aug 2014 12:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Aug 2014 16:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18175 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18175-submit@debbugs.gnu.org id=B18175.14070835644785 (code B ref 18175); Sun, 03 Aug 2014 16:33:02 +0000 Original-Received: (at 18175) by debbugs.gnu.org; 3 Aug 2014 16:32:44 +0000 Original-Received: from localhost ([127.0.0.1]:56147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XDyiB-0001F5-Hj for submit@debbugs.gnu.org; Sun, 03 Aug 2014 12:32:43 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:39366) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XDyiA-0001Es-EJ for 18175@debbugs.gnu.org; Sun, 03 Aug 2014 12:32:42 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s73GWXcP026868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 3 Aug 2014 16:32:36 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s73GWSKB003747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sun, 3 Aug 2014 16:32:29 GMT Original-Received: from abhmp0008.oracle.com (abhmp0008.oracle.com [141.146.116.14]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s73GWRqc024032; Sun, 3 Aug 2014 16:32:28 GMT In-Reply-To: <87mwbmeyva.fsf@violet.siamics.net> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6691.5000 (x86)] X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92081 Archived-At: > > By using `mapcar' you are signaling that you are interested in the > > return values of the argument function (and of course the resulting > > list of them). >=20 > > By using `mapc' you are signaling that the values returned by the > > argument function are unimportant (only its side effects are > > significant). >=20 > =09How do you signal that the values returned by the argument > =09function are unimportant, /and/ that you=E2=80=99re interested in the > =09/original/ list instead? By doing what you've done now. Neither `mapc' nor `mapcar' says that, on its own. If return values are not important in some code then `mapc`, `dolist`, `while`, or any number of other imperative/procedural approaches are fine to use, and are often preferable. Looking briefly at the original code and your patches now, I am reminded that `find-file*' needs to return the list of buffers (or the single buffer, for that case). (As one user, for example, I have code that expects the list of buffers to be returned.) Your new patch does that, and it looks OK to me. I did not spend much time looking things over, so I might be missing something, but it looks like you are not changing the external behavior (good). It is fine to optimize things, but function interfaces (signatures and behavior as viewed by calling functions or by users) should not be altered. You might want to make sure that the list of buffers returned is the same in all cases as what is returned today. The doc string of `switch-to-buffer', for instance, seems to make a point of saying that it returns the buffer switched to. It does not say that it returns the buffer indicated by argument BUFFER-OR-NAME. Dunno why, but it does. I'm guessing that that can make a difference only if the intended buffer cannot be switched to (an error is raised). And in that case I'm guessing that the error raised would be handled correctly by `find-file*'. (I have not checked.) You might also want to check to be sure that the effect on what `buffer-list' returns (after the calls to `switch-buffer*') remains the same. The calls to `switch-to-buffer*' here do not use non-nil NORECORD, so that at least can be ignored. But maybe take a look, to make sure. Some commands and other functions depend on the buffer order in `buffer-list', so this too should not be altered by your proposed change.