From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#976: 23.0.60; incorrect code for filesets-get-filelist Date: Tue, 16 Sep 2008 14:28:35 -0700 Message-ID: <003701c91843$2db4aa20$0200a8c0@us.oracle.com> References: <002901c915bf$811df210$0200a8c0@us.oracle.com> <002c01c9183c$fc7e2680$0200a8c0@us.oracle.com> Reply-To: Drew Adams , 976@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0038_01C91808.8155D220" X-Trace: ger.gmane.org 1221601710 19084 80.91.229.12 (16 Sep 2008 21:48:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Sep 2008 21:48:30 +0000 (UTC) To: <976@emacsbugs.donarmstrong.com>, Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 16 23:49:25 2008 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.50) id 1KfiPl-00014t-02 for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Sep 2008 23:48:54 +0200 Original-Received: from localhost ([127.0.0.1]:40694 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KfiOi-0003ry-G1 for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Sep 2008 17:47:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KfiOe-0003rT-Ig for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 17:47:44 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KfiOd-0003rA-1N for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 17:47:44 -0400 Original-Received: from [199.232.76.173] (port=56391 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KfiOc-0003r6-UH for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 17:47:42 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:41725) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KfiOb-0001U6-5O for bug-gnu-emacs@gnu.org; Tue, 16 Sep 2008 17:47:42 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8GLlYYQ018898; Tue, 16 Sep 2008 14:47:34 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m8GLZ4O7014116; Tue, 16 Sep 2008 14:35:04 -0700 X-Loop: don@donarmstrong.com Resent-From: "Drew Adams" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 16 Sep 2008 21:35:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 976 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 976-submit@emacsbugs.donarmstrong.com id=B976.122160049011929 (code B ref 976); Tue, 16 Sep 2008 21:35:04 +0000 Original-Received: (at 976) by emacsbugs.donarmstrong.com; 16 Sep 2008 21:28:10 +0000 Original-Received: from rgminet01.oracle.com (rgminet01.oracle.com [148.87.113.118]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m8GLS6af011923 for <976@emacsbugs.donarmstrong.com>; Tue, 16 Sep 2008 14:28:07 -0700 Original-Received: from rgmgw1.us.oracle.com (rgmgw1.us.oracle.com [138.1.186.110]) by rgminet01.oracle.com (Switch-3.2.4/Switch-3.1.6) with ESMTP id m8GLRwU9020354; Tue, 16 Sep 2008 15:27:58 -0600 Original-Received: from acsmt706.oracle.com (acsmt706.oracle.com [141.146.40.84]) by rgmgw1.us.oracle.com (Switch-3.2.4/Switch-3.2.4) with ESMTP id m8GLRvIq021506; Tue, 16 Sep 2008 15:27:58 -0600 Original-Received: from dradamslap1 (/141.144.58.96) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 16 Sep 2008 21:27:57 +0000 X-Mailer: Microsoft Office Outlook 11 In-reply-to: <002c01c9183c$fc7e2680$0200a8c0@us.oracle.com> Thread-Index: AckVv4Ci1hEH5okgSQ2EUXtBuurWggCetBEgAAIp8qA= X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Brightmail-Tracker: AAAAAQAAAAI= X-Brightmail-Tracker: AAAAAQAAAAI= X-Whitelist: TRUE X-Whitelist: TRUE X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Tue, 16 Sep 2008 17:47:44 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list 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:20574 gmane.emacs.pretest.bugs:23056 Archived-At: This is a multi-part message in MIME format. ------=_NextPart_000_0038_01C91808.8155D220 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sorry for the added noise, but it's probably better for the default behavior to use absolute filenames. The attached code does that. > From: Drew Adams Sent: Tuesday, September 16, 2008 1:44 PM > The attached code might help you in fixing this - if not, > ignore it. I haven't > tested all of the code that calls `filesets-get-filelist', > but the version of > `filesets-get-filelist' attached seems to DTRT, AFAICT. > > The problem with the original code, and with the suggestion I > sent earlier, is > that `filesets-get-filelist' does not DTRT for type :tree. > The original code is > completely broken - does nothing here. In my previously > suggested code, > `filesets-get-filelist' does the same thing for type :tree as > for type :pattern > - it returns only the files in the directory, not also the > files in its > subdirectories. > > See attached file for proposed new definition (with new function > filesets-files-under). > > HTH > > > > From: Drew Adams Sent: Saturday, September 13, 2008 9:41 AM > > The part that treats a :tree of the code defining > > `filesets-get-filelist' is not correct and never could have been > > correct. And it does not correspond to the (correct) code from the > > filesets author. One wonders if the GNU Emacs code was ever tested. > > > > This is the `case' clause that treats :tree in the definition > > of `filesets-get-filelist': > > > > ((:tree) > > (let ((dir (nth 0 entry)) > > (patt (nth 1 entry))) > > (filesets-directory-files dir patt ':files t))) > > > > But `entry' here is a complete fileset, which is of the form > > ("my-fs" (:tree "/some/directory" "^.+\.suffix$")) > > > > The above code thus tries to use "my-fs" as the directory, > whereas it > > should use "/some/directory". > > > > This is the (correct) code in the latest version from the author > > (http://members.a1.net/t.link/CompEmacsFilesets.html). (The > comment is > > from the author.) > > > > ((:tree) > > ;;well, the way trees are handled is a mess +++ > > (let* ((dirpatt (if (consp (nth 1 entry)) > > (filesets-entry-get-tree entry) > > entry)) > > (dir (nth 0 dirpatt)) > > (patt (nth 1 dirpatt))) > > (filesets-list-dir dir patt ':files t))) > > > > However, I think the following would be sufficient: > > > > ((:tree) > > (let* ((dirpatt (filesets-entry-get-tree entry)) > > (dir (nth 0 dirpatt)) > > (patt (nth 1 dirpatt))) > > (filesets-directory-files dir patt ':files t))) > > > > I don't see why the author's more complex treatment would ever be > > needed, since in order for the :tree clause of the `case' to be > > reached (consp (nth 1 entry)) must be a cons, AFAICT. > > > > At any rate, either the author's code or what I suggest immediately > > above is needed. There is no way that the current GNU Emacs code can > > work with a :tree fileset. > > > > > > In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600) > > of 2008-09-03 on LENNART-69DE564 > > Windowing system distributor `Microsoft Corp.', version 5.1.2600 > > configured using `configure --with-gcc (3.4) --no-opt > > --cflags -Ic:/g/include > > -fno-crossjumping' > > > > > > > > > > > > > > > ------=_NextPart_000_0038_01C91808.8155D220 Content-Type: application/octet-stream; name="throw.el" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="throw.el" ;;; filesets+.el --- Extensions to `filesets.el'. ;; ;; Filename: filesets+.el ;; Description: Extensions to `filesets.el'. ;; Author: Drew Adams ;; Maintainer: Drew Adams ;; Copyright (C) 2008, Drew Adams, all rights reserved. ;; Created: Tue Sep 16 14:11:36 2008 (-0700) ;; Version: 22.0 ;; Last-Updated: Tue Sep 16 14:27:01 2008 (-0700) ;; By: dradams ;; Update #: 13 ;; URL: http://www.emacswiki.org/cgi-bin/wiki/filesets+.el ;; Keywords: ;; Compatibility: GNU Emacs 22.x ;; ;; Features that might be required by this library: ;; ;; Required feature throw was not provided. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Commentary: ;; ;; This library provides some fixes to standard library ;; `filesets.el'. The reference version of that library is 1.8.4, ;; but I believe the same fixes are appropriate for other versions ;; (e.g. 2.2, named `filesets2.el', which is the latest version by ;; the original author, at ;; http://members.a1.net/t.link/CompEmacsFilesets.html). ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Change log: ;; ;; ;; 2008/09/16 dadams ;; Created. ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 3, or ;; (at your option) any later version. ;; ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA.;;; Code: ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;;; Code: (require 'filesets) ;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defcustom filesets-menu-path '("file") ; Original was nil. "The menu under which the filesets menu should be inserted. See `add-submenu' for documentation." :set (function filesets-set-default) :type 'sexp :group 'filesets) (defcustom filesets-menu-before "Open File..." ; Original was "File". "The name of a menu before which this menu should be added. See `add-submenu' for documentation." :set (function filesets-set-default) :type 'sexp :group 'filesets) (defun filesets-get-filelist (entry &optional mode event) "Get all files for fileset ENTRY. Assume MODE (see `filesets-entry-mode'), if provided." (let* ((mode (or mode (filesets-entry-mode entry))) (fl (case mode ((:files) (filesets-entry-get-files entry)) ((:file) (list (filesets-entry-get-file entry))) ((:ingroup) (let ((entry (expand-file-name (if (stringp entry) entry (filesets-entry-get-master entry))))) (cons entry (filesets-ingroup-cache-get entry)))) ((:tree) (let* ((dirpatt (filesets-entry-get-tree entry)) (dir (nth 0 dirpatt)) (patt (nth 1 dirpatt)) (depth (or (filesets-entry-get-tree-max-level entry) filesets-tree-max-level))) (filesets-files-under 0 depth entry dir patt))) ((:pattern) (let ((dirpatt (filesets-entry-get-pattern entry))) (if dirpatt (let ((dir (filesets-entry-get-pattern--dir dirpatt)) (patt (filesets-entry-get-pattern--pattern dirpatt))) (filesets-directory-files dir patt ':files t)) (filesets-error 'error "Filesets: malformed entry: " entry))))))) (filesets-filter-list fl (lambda (file) (not (filesets-filetype-property file event)))))) (defun filesets-files-under (level depth entry dir patt &optional relativep) "Files under DIR that match PATT. LEVEL is the current level under DIR. DEPTH is the maximal tree scanning depth for ENTRY. ENTRY is a fileset. DIR is a directory. PATT is a regexp that included file names must match. RELATIVEP non-nil means use relative file names." (and (or (= depth 0) (< level depth)) (let* ((dir (file-name-as-directory dir)) (files-here (filesets-directory-files dir patt nil (not relativep) (filesets-entry-get-filter-dirs-flag entry))) (subdirs (filesets-filter-dir-names files-here)) (files (filesets-filter-dir-names (apply #'append files-here (mapcar (lambda (subdir) (let* ((subdir (file-name-as-directory subdir)) (full-subdir (concat dir subdir))) (filesets-files-under (+ level 1) depth entry full-subdir patt))) subdirs)) t))) files))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;; (provide 'filesets+) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; filesets+.el ends here ------=_NextPart_000_0038_01C91808.8155D220--