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#7131: 24.0.50; `dired' with cons arg should not ignore arg if buffer exists Date: Wed, 29 Sep 2010 08:34:17 -0700 Message-ID: <9165B8BF5E624AAA8F9551E7A82022AF@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1285774894 12019 80.91.229.12 (29 Sep 2010 15:41:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 29 Sep 2010 15:41:34 +0000 (UTC) To: 7131@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Sep 29 17:41:33 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1P0ymg-0001Kv-NQ for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Sep 2010 17:41:31 +0200 Original-Received: from localhost ([127.0.0.1]:56383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0ymf-0003oZ-V2 for geb-bug-gnu-emacs@m.gmane.org; Wed, 29 Sep 2010 11:41:29 -0400 Original-Received: from [140.186.70.92] (port=59804 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0yma-0003nN-Se for bug-gnu-emacs@gnu.org; Wed, 29 Sep 2010 11:41:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0ymZ-00072V-Cs for bug-gnu-emacs@gnu.org; Wed, 29 Sep 2010 11:41:24 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51052) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0ymZ-00072O-9H for bug-gnu-emacs@gnu.org; Wed, 29 Sep 2010 11:41:23 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P0ydW-0005dP-6x; Wed, 29 Sep 2010 11:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Sep 2010 15:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 7131 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.128577430121651 (code B ref -1); Wed, 29 Sep 2010 15:32:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Sep 2010 15:31:41 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0ydA-0005dA-DF for submit@debbugs.gnu.org; Wed, 29 Sep 2010 11:31:40 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0yd7-0005d3-Oc for submit@debbugs.gnu.org; Wed, 29 Sep 2010 11:31:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0yfu-0005ks-1Z for submit@debbugs.gnu.org; Wed, 29 Sep 2010 11:34:31 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:40378) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0yft-0005ko-TR for submit@debbugs.gnu.org; Wed, 29 Sep 2010 11:34:30 -0400 Original-Received: from [140.186.70.92] (port=41661 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0yfs-0001bj-OV for bug-gnu-emacs@gnu.org; Wed, 29 Sep 2010 11:34:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0yfr-0005kQ-9A for bug-gnu-emacs@gnu.org; Wed, 29 Sep 2010 11:34:28 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:45692) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0yfr-0005kH-26 for bug-gnu-emacs@gnu.org; Wed, 29 Sep 2010 11:34:27 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o8TFYO5p003193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 29 Sep 2010 15:34:25 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o8TBPp2o006956 for ; Wed, 29 Sep 2010 15:34:24 GMT Original-Received: from abhmt003.oracle.com by acsmt354.oracle.com with ESMTP id 641193851285774458; Wed, 29 Sep 2010 08:34:18 -0700 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 29 Sep 2010 08:34:17 -0700 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Actf68cKnNMtyb09T/eNiFgFGZoP/A== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 29 Sep 2010 11:32:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:40544 Archived-At: (dired '("foo" "file1.c" "file2.c")) opens a Dired buffer named `foo' with only files file1.c and file2.c. This is a useful feature. The doc says only that if the arg is a cons then its first element is taken as the directory name and the rest are the files to list. But if "foo" is already the name of an existing Dired buffer then that existing buffer `foo' is simply displayed as it was. The explicit file-list argument is completely ignored. Buffer `foo' should instead be updated (its contents replaced) to list only the files to be included (files in the file-list arg). That is more useful, and it is anyway easy to recuperate the original Dired buffer if for some reason the buffer name were a mistake. The code in question is `dired-internal-noselect'. This code comment gives the behavior rationale for the case where the Dired buffer already exists: ;; If there is an existing dired buffer for DIRNAME, just leave ;; buffer as it is (don't even call dired-revert). ;; This saves time especially for deep trees or with ange-ftp. ;; The user can type `g' easily, and it is more consistent with find-file. ;; But if SWITCHES are given they are probably different from the ;; buffer's old value, so call dired-sort-other, which does ;; revert the buffer. A pity we can't possibly do "Directory has ;; changed - refresh? " like find-file does. (DIRNAME is a typo here BTW - the argument is actually called DIR-OR-LIST, and if it is a cons then the name is just its car.) Note the rationale: If SWITCHES are not given, that is, if there was no expressed intention to change the content of the listing, then just reuse an existing buffer. But if such an intention was expressed, then respect it. Following that rationale, the behavior for a cons arg should be to respect the explicit file list passed, not to simply ignore it and reuse an existing buffer. And since it would be problematic to test the file list for differences from the existing listing (whether or not it came from a cons arg previously), we should always just update the buffer to reflect the file-list that is passed. IOW, with an explicit file list, never reuse an existing Dired buffer of the same name. Note that use of a cons as arg is not the typical use, and this use case has sometimes been forgotten/overlooked when coding, so that there have been several (recently fixed) bugs because of oversights. I mention this because I imagine that is the case here: it is not that we intentionally reuse the existing buffer and ignore the file list. We do that probably only because the coder wasn't thinking about the cons case. (The DIRNAME typo supports this supposition.) In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2010-09-20 on 3249CTO Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (4.4) --no-opt --cflags -Ic:/imagesupport/include'