Commits

Anonymous committed 52c6d54

Dired 7.11.

  • Participants
  • Parent commits 737e9c5

Comments (0)

Files changed (21)

-2003-03-31  Steve Youngs  <youngs@xemacs.org>
+2003-08-30  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
 
-	* Makefile: Don't rely on Makefile.dired to build.
+	* Dired 7.11.
 
-2003-03-09  Ben Wing  <ben@xemacs.org>
+2003-08-30  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
 
-	* Makefile:
-	Delete explicit compile:: rules.
+	* dired.el (dired-noselect): 
+	(dired-find-buffer-nocreate): Only access
+	`find-file-compare-truenames' if it's bound.
 
-2003-01-03  Rendhalver [Peter Brown]  <rendhalver@xemacs.org>
+2003-08-19  René Kyllingstad <kyllingstad@users.sourceforge.net>
 
-	* Makefile (VERSION): XEmacs package 1.13 released.
+	* dired.el (dired-noselect): 
+	(dired-find-file-compare-truenames):
+	(dired-find-buffer-nocreate): Opening a dired buffer with
+	find-file-compare-truenames non-nil is very slow on win32, yet it
+	is especially helpful to have it non-nil on win32 since it detects
+	when one opens the same file with different case in the
+	filename/path (not so important for dired buffers).
 
-2002-12-17  Jerry James  <james@xemacs.org>
+2003-08-11  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
 
-	* dired-oas.el: Load the definition of dired-parse-ls when compiling.
+	* dired.el (dired-re-month-and-time): Change `setq' to a
+	`defconst'.  Add comment.
 
-2002-11-29  Ben Wing  <ben@xemacs.org>
+2003-08-05  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
 
-	* .cvsignore: Remove files now handled automatically by CVS.
-	* Makefile: Use `compile' instead of hard-coded `all'.
+	* dired-xemacs.el (dired-move-to-permissions): Remove copy;
+	somehow, there were two of them.
 
-2002-10-15  Ville Skyttä  <scop@xemacs.org>
+2003-08-03  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
 
-	* Makefile (srckit): Remove.
+	* dired.el (dired-use-ls-dired): Add.
+	(dired-insert-directory):
+	(dired-indent-listing):
+	(dired-insert-subdir-doinsert):
+	(dired-add-entry):
+	(dired-add-entry-do-indentation): Respect `dired-use-ls-dired'.
+	(dired-manual-move-to-filename): Use `dired-maybe-filename-start'.
+	(dired-manual-move-to-end-of-filename): Use
+	`dired-maybe-filename-end'.
 
-2002-04-24  Steve Youngs  <youngs@xemacs.org>
+	* dired-xemacs.el (dired-maybe-filename-start): 
+	(dired-maybe-filename-end): Added.
+	(dired-set-text-properties): Don't create new extent if there's
+	one already there.
 
-	* Makefile (VERSION): XEmacs package 1.12 released.
+	* dired-fsf.el (dired-maybe-filename-start): 
+	(dired-maybe-filename-end): Added.  (Completely untested.)
+
+2003-08-02  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
+
+	* dired-sex.el (dired-parse-ls): Convert from macro to a
+	function.  Set `name' correctly.
+
+2003-07-24  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
+
+	* dired.el (dired-copy-file-recursive): Implemented recursive
+	copy.
+	(dired-copy-confirmer): Added.
+	(dired-no-confirm): Added (const recursive-copy) type.
+
+2003-01-28  James LewisMoss  <dres@lewismoss.org>
+
+	* dired.el (dired-re-month-and-time): add iso-date format to
+	possible month-day formats.
+
+2002-08-27  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* dired.el (dired-find-buffer-nocreate): Cater to GNU Emacs which
+	doesn't have `find-file-compare-truenames' (but which seems to
+	always compare by truename.)
+
+	* Makefile.dired (install_elc): Rename from install_obj.
+	(install_elc): Ignore errors from installing non-existent .info file.
+	(install_src): Ignore errors from installing non-existent .texi file.
 
 2002-04-12  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
 
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
+include Makefile.dired
+
 VERSION = 1.13
-AUTHOR_VERSION = 7.10
+AUTHOR_VERSION = 7.11
 MAINTAINER = Mike Sperber <sperber@informatik.uni-tuebingen.de>
 PACKAGE = dired
 PKG_TYPE = regular
-REQUIRES = xemacs-base prog-modes ediff vm rmail
+REQUIRES = xemacs-base prog-modes
 CATEGORY = standard
 
-ELS = $(wildcard *.el)
-ELCS = $(ELS:.el=.elc)
+ELCS = $(DOBJS) $(XEOBJS_DIRED) $(MULEOBJS_DIRED)
 
 include ../../XEmacs.rules

File Makefile.dired

 ###############################################################################
 #
 # File:         Makefile
-# Release:      $EFS release: 1.16 $
-# Release:      $dired release: 7.10 $
+# Release:      $EFS release: 1.21 $
+# Release:      $dired release: 7.11 $
 # Version:      $Revision$
 # RCS:
 # Description:  Makefile for byte-compiling dired (primarily) and EFS.
 dired-x20: dired $(XEOBJS_DIRED) $(MULEOBJS_DIRED)
 
 # Installation
-install_obj:
+install_elc:
 	@echo "Installing in $(LISPDIR) and $(INFODIR)..."
 	cp *.elc $(LISPDIR)
-	cp *.info $(INFODIR)
+	-cp *.info $(INFODIR)
 install_src:
 	@echo "Installing in $(LISPDIR)..."
 	cp `ls *.el | grep -v "fixup"` $(LISPDIR)
-	cp *texi $(TEXIDIR)
+	-cp *texi $(TEXIDIR)
 
 efs_package_dist:
 	@echo "Installing in $(STAGING)..."
-This is Dired 7.10
+This is Dired 7.11
 ==================
 
 Dired is a special mode for editing directory trees, both local and
 description of mailing lists relevant to Dired.  We encourage users to
 join these lists.
 
-This is a beta release.
+NOTE: If you're using Dired 7.11 in conjunction with EFS, you are
+      advised to use EFS 1.21 or higher.
+
 
 ;;; Copyright (C) 1990 Free Software Foundation, Inc.
 ;;; Copyright (C) 1994 Sandy Rutherford
+;;; Copyright (C) 2001 Mike Sperber
 
 ;;; This file is based on diff.el by sunpitt!wpmstr!fbresz@Sun.COM 1/27/89.
 ;;; It has been completely rewritten in July 1994 by

File dired-cmpr.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-cmpr.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   Commands for compressing marked files.
 ;;

File dired-diff.el

 ;;
 ;; File:           dired-diff.el
 ;; RCS:
-;; Dired Version:  #Revision: 7.10 $
+;; Dired Version:  #Revision: 7.11 $
 ;; Description:    Support for diff and related commands.
 ;; Author:         Sandy Rutherford <sandy@ibm550.sissa.it>
 ;; Created:        Fri Jun 24 08:50:20 1994 by sandy on ibm550

File dired-faces.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-faces.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   rudimentary face customization support for dired
 ;; Author:        Mike Sperber <sperber@informatik.uni-tuebingen.de>

File dired-grep.el

 ;;
 ;; File:           dired-grep.el
 ;; RCS:
-;; Dired Version:  #Revision: 7.10 $
+;; Dired Version:  #Revision: 7.11 $
 ;; Description:    Support for running grep on marked files in a dired buffer.
 ;; Author:         Sandy Rutherford <sandy@ibm550.sissa.it>
 ;; Created:        Tue Jul 13 22:59:37 1993 by sandy on ibm550

File dired-help.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-help.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   Obtaining help for dired
 ;; Modified:      Sun Nov 20 21:10:47 1994 by sandy on gandalf

File dired-mob.el

 ;;
 ;; File:           dired-mob.el
 ;; RCS:
-;; Dired Version:  #Revision: 7.10 $
+;; Dired Version:  #Revision: 7.11 $
 ;; Description:    Commands for marking files from another buffer.
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

File dired-mule.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-mule.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   MULE support for dired.
 ;; Created:       Sun Jul 17 14:45:12 1994 by sandy on ibm550

File dired-oas.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-oas.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   dired odds and sods. Dired functions not usually needed.
 ;;                This file is not a reference to the Organization of
 
 ;;; Don't require or provide anything, as this file is just an archive.
 
-;;; jwj -- On the other hand, dired-parse-ls is a macro, so we had better
-;;; load its definition when compiling
-(eval-when-compile (require 'dired-sex))
-
 (defun dired-sort-on-size ()
   "Sorts a dired listing on file size.
 If your ls cannot sort on size, this is useful as `dired-after-readin-hook':

File dired-rgxp.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:           dired-rgxp.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   Commands for running commands on files whose names
 ;;                match a regular expression.

File dired-sex.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-sex.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   Marking files according to sexpressions.  Sorry.
 ;; Created:       Wed Sep 14 01:30:43 1994 by sandy on ibm550
 
 ;;; Marking files according to sexpr's
 
-(defmacro dired-parse-ls ()
+(defun dired-parse-ls ()
   ;; Sets vars
   ;;                inode s mode nlink uid gid size time name sym
   ;; (probably let-bound in caller) according to current file line.
-  ;; Returns t for succes, nil if this is no file line.
+  ;; Returns t for success, nil if this is no file line.
   ;; Upon success, all variables are set, either to nil or the
   ;; appropriate value, so they need not be initialized.
   ;; Moves point within the current line to the end of the file name.
-  '(let ((bol (progn (beginning-of-line) (point)))
-	 (eol (save-excursion (skip-chars-forward "^\n\r") (point))))
-     (if (re-search-forward dired-re-month-and-time eol t)
-	 (let ((mode-len 10)		; length of mode string
-	       (tstart (progn (goto-char (match-beginning 0))
-			      (skip-chars-forward " ")
-			      (point)))
-	       (fstart (match-end 0))
-	       pos)
-	   (goto-char (1+ bol))
-	   (skip-chars-forward " \t")
-	   ;; This subdir had better have been created with the current
-	   ;; setting of actual switches. Otherwise, we can't parse.
-	   (cond
-	    ((and (or (memq ?k dired-internal-switches)
-		      (memq ?s dired-internal-switches))
-		  (memq ?i dired-internal-switches))
-	     (setq pos (point))
-	     (skip-chars-forward "0-9")
-	     (if (setq inode (and (/= pos (point)) (string-to-int
-						    (buffer-substring
-						     pos (point)))))
-		 (progn
-		   (skip-chars-forward " ")
-		   (setq pos (point))
-		   (skip-chars-forward "0-9")
-		   (setq s (and (/= pos (point)) (string-to-int
-						  (buffer-substring
-						   pos (point))))))
-	       (setq s nil)))
-	    ((or (memq ?s dired-internal-switches)
-		 (memq ?k dired-internal-switches))
-	     (setq pos (point))
-	     (skip-chars-forward "0-9")
-	     (setq s (and (/= pos (point)) (string-to-int
+  (let ((bol (progn (beginning-of-line) (point)))
+	(eol (save-excursion (skip-chars-forward "^\n\r") (point))))
+    (if (re-search-forward dired-re-month-and-time eol t)
+	(let ((mode-len 10)		; length of mode string
+	      (tstart (progn (goto-char (match-beginning 0))
+			     (skip-chars-forward " ")
+			     (point)))
+	      (fstart (match-end 0))
+	      pos)
+	  (goto-char (1+ bol))
+	  (skip-chars-forward " \t")
+	  ;; This subdir had better have been created with the current
+	  ;; setting of actual switches. Otherwise, we can't parse.
+	  (cond
+	   ((and (or (memq ?k dired-internal-switches)
+		     (memq ?s dired-internal-switches))
+		 (memq ?i dired-internal-switches))
+	    (setq pos (point))
+	    (skip-chars-forward "0-9")
+	    (if (setq inode (and (/= pos (point)) (string-to-int
+						   (buffer-substring
+						    pos (point)))))
+		(progn
+		  (skip-chars-forward " ")
+		  (setq pos (point))
+		  (skip-chars-forward "0-9")
+		  (setq s (and (/= pos (point)) (string-to-int
+						 (buffer-substring
+						  pos (point))))))
+	      (setq s nil)))
+	   ((or (memq ?s dired-internal-switches)
+		(memq ?k dired-internal-switches))
+	    (setq pos (point))
+	    (skip-chars-forward "0-9")
+	    (setq s (and (/= pos (point)) (string-to-int
+					   (buffer-substring
+					    pos (point))))
+		  inode nil))
+	   ((memq ?i dired-internal-switches)
+	    (setq pos (point))
+	    (skip-chars-forward "0-9")
+	    (setq inode (and (/= pos (point)) (string-to-int
 					       (buffer-substring
 						pos (point))))
-		   inode nil))
-	    ((memq ?i dired-internal-switches)
-	     (setq pos (point))
-	     (skip-chars-forward "0-9")
-	     (setq inode (and (/= pos (point)) (string-to-int
-						(buffer-substring
-						 pos (point))))
-		   s nil))
-	    (t
-	     (setq s nil
-		   inode nil)))
-	   (skip-chars-forward " 0-9") ; in case of junk
-	   (setq mode (buffer-substring (point) (+ mode-len (point))))
-	   (forward-char mode-len)
-	   (setq nlink (read (current-buffer)))
-	   (or (integerp nlink) (setq nlink nil))
-	   (skip-chars-forward " ")
-	   (setq uid (buffer-substring (point) (progn
-						 (skip-chars-forward "^ ")
-						 (point))))
-	   (goto-char tstart)
-	   (skip-chars-backward " ")
-	   (setq pos (point))
-	   (skip-chars-backward "0-9")
-	   (if (= pos (point))
-	       (setq size nil)
-	     (setq size (string-to-int (buffer-substring (point) pos))))
-	   (skip-chars-backward " ")
-	   ;; if no gid is displayed, gid will be set to uid
-	   ;; but user will then not reference it anyway in PREDICATE.
-	   (setq gid (buffer-substring (point) (progn
-						 (skip-chars-backward "^ ")
-						 (point)))
-		 time (buffer-substring tstart
-					(progn
-					  (goto-char fstart)
-					  (skip-chars-backward " ")
-					  (point)))
-		 name (buffer-substring
-		       fstart
-		       (or (dired-move-to-end-of-filename t)
-			   (point)))
-		 sym  (and (looking-at "[/*@#=|]? -> ")
-			   (buffer-substring (match-end 0)
-					     eol)))
-	   t)))) ; return t if parsing was a success
+		  s nil))
+	   (t
+	    (setq s nil
+		  inode nil)))
+	  (skip-chars-forward " 0-9")	; in case of junk
+	  (setq mode (buffer-substring (point) (+ mode-len (point))))
+	  (forward-char mode-len)
+	  (setq nlink (read (current-buffer)))
+	  (or (integerp nlink) (setq nlink nil))
+	  (skip-chars-forward " ")
+	  (setq uid (buffer-substring (point) (progn
+						(skip-chars-forward "^ ")
+						(point))))
+	  (goto-char tstart)
+	  (skip-chars-backward " ")
+	  (setq pos (point))
+	  (skip-chars-backward "0-9")
+	  (if (= pos (point))
+	      (setq size nil)
+	    (setq size (string-to-int (buffer-substring (point) pos))))
+	  (skip-chars-backward " ")
+	  ;; if no gid is displayed, gid will be set to uid
+	  ;; but user will then not reference it anyway in PREDICATE.
+	  (setq gid (buffer-substring (point) (progn
+						(skip-chars-backward "^ ")
+						(point)))
+		time (buffer-substring tstart
+				       (progn
+					 (goto-char fstart)
+					 (skip-chars-backward " ")
+					 (point)))
+		name (buffer-substring
+		      (dired-move-to-filename nil bol eol)
+		      (or (dired-move-to-end-of-filename t bol eol)
+			  (point)))
+		sym  (and (looking-at "[/*@#=|]? -> ")
+			  (buffer-substring (match-end 0)
+					    eol)))
+	  t))))			   ; return t if parsing was a success
 
 
 ;;;###autoload

File dired-shell.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-shell.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   Commands for running shell commands on marked files.
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-uu.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   Commands for uuencoding/uudecoding marked files.
 ;; Author:        Sandy Rutherford <sandy@math.ubc.ca>

File dired-vir.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-vir.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   Virtual dired mode for browsing ls -lR listings.
 ;; Author:        Sebastian Kremer <sk@thp.uni-koeln.de>

File dired-xemacs.el

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-xemacs.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   dired functions for XEmacs
 ;; Author:        Mike Sperber <sperber@informatik.uni-tuebingen.de>
 
 ;;; Extent managment
 
+(defun dired-maybe-filename-start (start end)
+  "Return start of filename if indicated by 'dired-file-name extent.
+Presumably, this extent was inserted by `insert-directory'."
+  (let ((extents (extent-list nil start end nil 'dired-file-name)))
+    (and extents
+	 (extent-start-position (car extents)))))
+
+(defun dired-maybe-filename-end (start end)
+  "Return end of filename if indicated by 'dired-file-name extent.
+Presumably, this extent was inserted by `insert-directory'."
+  (let ((extents (extent-list nil start end nil 'dired-file-name)))
+    (and extents
+	 (extent-end-position (car extents)))))
+
+(defun dired-set-extent-text-properties (extent face)
+  (set-extent-face extent face)
+  (set-extent-property extent 'keymap dired-filename-local-map)
+  (set-extent-property extent 'highlight t)
+  (set-extent-property
+   extent 'help-echo
+   (concat
+    "button2 finds, button3 visits, "
+    "C-button2 file ops, [C-]shift-button1 marks/flags.")))
+
 (defun dired-set-text-properties (start end &optional face)
-  (let ((filename-extent (make-extent start end)))
-    (set-extent-face filename-extent (or face 'default))
-    (set-extent-property filename-extent 'dired-file-name t)
-    (set-extent-property filename-extent 'start-open t)
-    (set-extent-property filename-extent 'end-open t)
-    (set-extent-property filename-extent 'keymap dired-filename-local-map)
-    (set-extent-property filename-extent 'highlight t)
-    (set-extent-property
-     filename-extent 'help-echo
-     (concat
-      "button2 finds, button3 visits, "
-      "C-button2 file ops, [C-]shift-button1 marks/flags."))
-    filename-extent))
+  (let ((extent
+	 (let ((extents (extent-list nil start end nil 'dired-file-name)))
+	   (if extents
+	       (car extents)
+	     (let ((extent (make-extent start end)))
+	       (set-extent-property extent 'dired-file-name t)
+	       (set-extent-property extent 'start-open t)
+	       (set-extent-property extent 'end-open t)
+	       extent)))))
+    (dired-set-extent-text-properties extent (or face 'default))
+    extent))
 
 (defun dired-insert-set-properties (beg end)
   ;; Sets the extents for the file names and their properties
   (map-extents
    (function
     (lambda (extent maparg)
-      (if (extent-property extent 'dired-file-name)
-	  (delete-extent extent))
+      (delete-extent extent)
       nil))
-   nil start end))
+   nil start end nil nil 'dired-file-name))
 
 (defun dired-highlight-filename-mark (extent)
   (let ((mark
       (forward-line direction))
     (goto-char (extent-start-position extent))))
 
-(defun dired-move-to-permissions (domain direction)
-  (skip-chars-backward "^\r\n")
-  (let (extent)
-    (while (not (setq extent (map-extents (function
-					   (lambda (e p)
-					    (and
-					     (char-equal domain (extent-property e p))
-					     e)))
-					  (current-buffer)
-					  (point)
-					  (save-excursion
-					    (skip-chars-forward "^\r\n")
-					    (point))
-					  'dired-permissions)))
-      (forward-line direction))
-    (goto-char (extent-start-position extent))))
-
 ;;; Interactive chmod
 ;;; (based on ideas from Russell Ritchie's dired-chmod.el)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-xy.el
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; RCS:
 ;; Description:   Commands for reading mail from dired.
 ;;
 ;;
 ;; File:          dired.el
 ;; RCS:           
-;; Dired Version: #Revision: 7.10 $
+;; Dired Version: #Revision: 7.11 $
 ;; Description:   The DIRectory EDitor is for manipulating, and running
 ;;                commands on files in a directory.
 ;; Authors:       FSF,
 ;;                Sebastian Kremer <sk@thp.uni-koeln.de>,
-;;                Sandy Rutherford <sandy@ibm550.sissa.it>
+;;                Sandy Rutherford <sandy@ibm550.sissa.it>,
+;;                Mike Sperber <sperber@informatik.uni-tuebingen.de>
 ;;                Cast of thousands...
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;;; Dired Version
 
-(defconst dired-version (substring "#Revision: 7.10 $" 11 -2)
+(defconst dired-version (substring "#Revision: 7.11 $" 11 -2)
   "The revision number of Tree Dired (as a string).
 
 Don't forget to mention this when reporting bugs to:
 		 (repeat string))
   :group 'dired-programs)
 
+;;;###autoload
+(defcustom dired-use-ls-dired
+  (and (string-match "gnu" system-configuration)
+       ;; Only supported for XEmacs >= 21.5 and GNU Emacs >= 21.4 (I think)
+       (or (and (featurep 'xemacs)
+		(fboundp 'emacs-version>=)
+		(emacs-version>= 21 5))
+	   (and (boundp 'emacs-major-version)
+		(boundp 'emacs-minor-version)
+		(or (> emacs-major-version 21)
+		    (and (= emacs-major-version 21)
+			 (>= emacs-minor-version 4))))))
+  "Non-nil means Dired should use `ls --dired'."
+  :type 'boolean
+  :group 'dired-programs)
+
 (defcustom dired-ls-F-marks-symlinks
   (memq system-type '(aix-v3 hpux silicon-graphics-unix))
   ;; Both SunOS and Ultrix have system-type berkeley-unix. But
 	      (const delete) (const hardlink) (const load)
 	      (const move) (const print) (const shell)
 	      (const symlink) (const uncompress)
-	      (const recursive-delete) (const kill-file-buffer)
-	      (const kill-dired-buffer) (const patch)
+	      (const recursive-delete) (const recursive-copy)
+	      (const kill-file-buffer) (const kill-dired-buffer)
+	      (const patch)
 	      (const create-top-dir) (const revert-subdirs))
 :group 'dired-behavior)
 		      
   :type 'boolean
   :group 'dired-behavior)
 
+;;;###autoload
+(defcustom dired-find-file-compare-truenames t
+  "If nil, set find-file-compare-truenames to nil while opening dired buffer"
+  :type 'boolean
+  :group 'dired-behavior)
+
 ;;; File name regular expressions and extensions.
 
 (defgroup dired-file-names nil
 
 (defvar dired-deletion-confirmer 'yes-or-no-p) ; or y-or-n-p?
 
+(defvar dired-copy-confirmer 'yes-or-no-p) ; or y-or-n-p?
+
 (defvar dired-log-buffer "*Dired log*")
 ;; Name of buffer used to log dired messages and errors.
 
 (defvar dired-re-dot "^.* \\.\\.?/?$")	; with -F, might end in `/'
 ;; . and .. files
 
-(setq dired-re-month-and-time
-      (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
-	     ;; In some locales, month abbreviations are as short as 2 letters,
-	     ;; and they can be padded on the right with spaces.
-	     ;; weiand: changed: month ends potentially with . or , or .,
-	     ;;old	 (month (concat l l "+ *"))
-	     (month (concat l l "+[.]?,? *"))
-	     (date "[ 0-3][0-9]")
-	     (time "[ 012][0-9]:[0-6][0-9]")
-	     (year (concat
-		    "\\("
-		    ;; year on IRIX, NeXT, SunOS, ULTRIX, Apollo, HP-UX, A/UX
-		    " ?[12][90][0-9][0-9] ?"
-		    "\\|"
-		    ;; year on AIX
-		    "[12][90][0-9][0-9]  "
-		    "\\)"))
-	     (month-date (concat "\\(" month " " date "\\)"))
-	     (date-month (concat "\\(" date " " month "\\)")))
-	(concat " "
-		"\\("  date-month "\\|" month-date "\\)"
-		" "
-		"\\(" time "\\|" year "\\)"
-		" ")))
-
-;; This regexp MUST match all the way to first character of the filename.
-;; You can loosen it to taste, but then you might bomb on filenames starting
-;; with a space. This will have to be modified for non-english month names.
+(defconst dired-re-month-and-time
+  (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
+	 ;; In some locales, month abbreviations are as short as 2 letters,
+	 ;; and they can be padded on the right with spaces.
+	 ;; weiand: changed: month ends potentially with . or , or .,
+	 ;;old	 (month (concat l l "+ *"))
+	 (month (concat l l "+[.]?,? *"))
+	 (date "[ 0-3][0-9]")
+	 (time "[ 012][0-9]:[0-6][0-9]")
+	 (year (concat
+		"\\("
+		;; year on IRIX, NeXT, SunOS, ULTRIX, Apollo, HP-UX, A/UX
+		" ?[12][90][0-9][0-9] ?"
+		"\\|"
+		;; year on AIX
+		"[12][90][0-9][0-9]  "
+		"\\)"))
+	 (month-date (concat "\\(" month " " date "\\)"))
+	 (date-month (concat "\\(" date " " month "\\)"))
+	 (iso-date "\\([0-9]+-[0-9]+-[0-9]+\\)"))
+    (concat " "
+	    "\\("  date-month "\\|" month-date "\\|" iso-date "\\)"
+	    " "
+	    "\\(" time "\\|" year "\\)"
+	    " "))
+  "Regular expression matching from the date to the filename.
+This regexp MUST match all the way to first character of the filename.")
 
 (defvar dired-subdir-regexp
   "\\([\n\r]\n\\|\\`\\). \\([^\n\r]+\\)\\(:\\)\\(\\.\\.\\.\r\\|[\n\r]\\)")
 ;;;###autoload
 (defun dired-noselect (dir-or-list &optional switches)
   "Like `dired' but returns the dired buffer as value, does not select it."
-  (or dir-or-list (setq dir-or-list (expand-file-name default-directory)))
-  ;; This loses the distinction between "/foo/*/" and "/foo/*" that
-  ;; some shells make:
-  (let (dirname)
-    (if (consp dir-or-list)
-	(setq dirname (car dir-or-list))
-      (setq dirname dir-or-list))
-    (setq dirname (expand-file-name (directory-file-name dirname)))
-    (if (file-directory-p dirname)
-	(setq dirname (file-name-as-directory dirname)))
-    (if (consp dir-or-list)
-	(setq dir-or-list (cons dirname (cdr dir-or-list)))
-      (setq dir-or-list dirname))
-    (dired-internal-noselect dir-or-list switches)))
+  (let ((find-file-compare-truenames (and (boundp 'find-file-compare-truenames)
+					  find-file-compare-truenames
+					  dired-find-file-compare-truenames)))
+    (or dir-or-list (setq dir-or-list (expand-file-name default-directory)))
+    ;; This loses the distinction between "/foo/*/" and "/foo/*" that
+    ;; some shells make:
+    (let (dirname)
+      (if (consp dir-or-list)
+	  (setq dirname (car dir-or-list))
+	(setq dirname dir-or-list))
+      (setq dirname (expand-file-name (directory-file-name dirname)))
+      (if (file-directory-p dirname)
+	  (setq dirname (file-name-as-directory dirname)))
+      (if (consp dir-or-list)
+	  (setq dir-or-list (cons dirname (cdr dir-or-list)))
+	(setq dir-or-list dirname))
+      (dired-internal-noselect dir-or-list switches))))
 
 ;; Adapted from code by wurgler@zippysun.math.uakron.edu (Tom Wurgler).
 ;;;###autoload (define-key ctl-x-map "\C-j" 'dired-jump-back)
   ;; If dired-find-subdir is non-nil, is satisfied with a dired
   ;; buffer containing DIR-OR-LIST as a subdirectory. If there is more
   ;; than one candidate, returns the most recently used.
-  (if dired-find-subdir
-      (let ((buffers (sort (delq (current-buffer)
-				 (dired-buffers-for-dir dir-or-list t))
-			   (function dired-buffer-more-recently-used-p))))
-	(or (car buffers)
-	    ;; Couldn't find another buffer. Will the current one do?
-	    ;; It is up dired-initial-position to actually go to the subdir.
-	    (and (or (equal dir-or-list dired-directory) ; covers wildcards
-		     (and (stringp dir-or-list)
-			  (not (string-equal
-				dir-or-list
-				(expand-file-name default-directory)))
-			  (assoc (file-name-as-directory dir-or-list)
-				 dired-subdir-alist)))
-		 (current-buffer))))
-    ;; Else just look through the buffer list.
-    (let (found
-	  (search-directory
-	   (if find-file-compare-truenames
-	       (dired-directory-truename dir-or-list)
-	     dir-or-list))
-	  (blist (buffer-list)))
-      (or mode (setq mode 'dired-mode))
-      (save-excursion
-	(while blist
-	  (set-buffer (car blist))
-	  (if (and (eq major-mode mode)
-		   (equal (if find-file-compare-truenames
-			      (dired-directory-truename dired-directory)
-			    dired-directory)
-			  search-directory))
-	      (setq found (car blist)
-		    blist nil)
-	    (setq blist (cdr blist)))))
-      found)))
+  (let ((find-file-compare-truenames (and (boundp 'find-file-compare-truenames)
+					  find-file-compare-truenames
+ 					  dired-find-file-compare-truenames)))
+    (if dired-find-subdir
+	(let ((buffers (sort (delq (current-buffer)
+				   (dired-buffers-for-dir dir-or-list t))
+			     (function dired-buffer-more-recently-used-p))))
+	  (or (car buffers)
+	      ;; Couldn't find another buffer. Will the current one do?
+	      ;; It is up dired-initial-position to actually go to the subdir.
+	      (and (or (equal dir-or-list dired-directory) ; covers wildcards
+		       (and (stringp dir-or-list)
+			    (not (string-equal
+				  dir-or-list
+				  (expand-file-name default-directory)))
+			    (assoc (file-name-as-directory dir-or-list)
+				   dired-subdir-alist)))
+		   (current-buffer))))
+      ;; Else just look through the buffer list.
+      (let (found
+	    (search-directory
+	     (if (or (not (boundp 'find-file-compare-truenames))
+		     find-file-compare-truenames)
+		 (dired-directory-truename dir-or-list)
+	       dir-or-list))
+	    (blist (buffer-list)))
+	(or mode (setq mode 'dired-mode))
+	(save-excursion
+	  (while blist
+	    (set-buffer (car blist))
+	    (if (and (eq major-mode mode)
+		     (equal (if (or (not (boundp 'find-file-compare-truenames))
+				    find-file-compare-truenames)
+				(dired-directory-truename dired-directory)
+			      dired-directory)
+			    search-directory))
+		(setq found (car blist)
+		      blist nil)
+	      (setq blist (cdr blist)))))
+	found))))
 
 (defun dired-directory-truename (dir)
   "Convert value of `dired-directory' to truename form."
   ;; list.
   (let ((opoint (point))
 	(insert-directory-program dired-ls-program) end)
+    (if dired-use-ls-dired
+	(setq switches (concat "--dired " switches)))
     (if (consp dir-or-list)
 	(mapcar
 	 (function
 	     (dired-update-mode-line-modified t))))))
 
 (defun dired-indent-listing (start end)
-  ;; Indent a dired listing.
-  (let (indent-tabs-mode)
-    (indent-rigidly start end 2)
-    ;; Quote any null lines that shouldn't be.
-    (save-excursion
-      (goto-char start)
-      (while (search-forward "\n\n" end t)
-	(forward-char -2)
-	(if (looking-at dired-subdir-regexp)
-	    (goto-char (match-end 3))
-	  (progn
-	    (forward-char 1)
-	    (insert " ")))))))
+  ;; If we used --dired and it worked, the lines are already indented.
+  (unless (save-excursion
+	    (goto-char start)
+	    (looking-at "  "))
+    ;; Indent a dired listing.
+    (let (indent-tabs-mode)
+      (indent-rigidly start end 2)
+      ;; Quote any null lines that shouldn't be.
+      (save-excursion
+	(goto-char start)
+	(while (search-forward "\n\n" end t)
+	  (forward-char -2)
+	  (if (looking-at dired-subdir-regexp)
+	      (goto-char (match-end 3))
+	    (progn
+	      (forward-char 1)
+	      (insert " "))))))))
 
 
 ;;;; ------------------------------------------------------------
 	  (setq end (point-marker)))
       (let ((switches (dired-make-switches-string switches))
 	    (insert-directory-program dired-ls-program))
+	(if dired-use-ls-dired
+	    (setq switches (concat "--dired " switches)))
 	(if (consp dir-or-list)
 	    (progn
 	      (insert "list wildcard\n")
     (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
     (or bol (setq bol (progn (skip-chars-backward "^\r\n") (point))))
     
-    (if (or (memq ?l dired-internal-switches)
+    (let ((maybe (dired-maybe-filename-start bol eol)))
+      (cond
+       (maybe (goto-char maybe))
+       ((or (memq ?l dired-internal-switches)
 	    (memq ?g dired-internal-switches))
 	(if (and
-	     (> (- eol bol) 17)         ; a valid file line must have at least
+	     (> (- eol bol) 17)	; a valid file line must have at least
 					; 17 chars. 2 leading, 10 perms,
 					; separator, node #, separator, owner,
 					; separator
 	  (goto-char bol)
 	  (if raise-error
 	      (error "No file on this line")
-	    nil))
-      ;; else ls switches don't contain -l.
-      ;; Note that even if we make dired-move-to-filename and
-      ;; dired-move-to-end-of-filename (and thus dired-get-filename)
-      ;; work, all commands that gleaned information from the permission
-      ;; bits (like dired-mark-directories) will cease to work properly.
-      (if (= bol eol)
-	  (if raise-error
-	      (error "No file on this line")
-	    nil)
-	;; skip marker, if any
-	(goto-char bol)
-	(forward-char))
-      ;; If we not going to use the l switch, and use nstd listings,
-      ;; then we must bomb on files starting with spaces.
-      (skip-chars-forward " \t")
-      (point))))
+	    nil)))
+       ;; else ls switches don't contain -l.
+       ;; Note that even if we make dired-move-to-filename and
+       ;; dired-move-to-end-of-filename (and thus dired-get-filename)
+       ;; work, all commands that gleaned information from the permission
+       ;; bits (like dired-mark-directories) will cease to work properly.
+       (t
+	(if (= bol eol)
+	    (if raise-error
+		(error "No file on this line")
+	      nil)
+	  ;; skip marker, if any
+	  (goto-char bol)
+	  (forward-char))
+	;; If we not going to use the l switch, and use nstd listings,
+	;; then we must bomb on files starting with spaces.
+	(skip-chars-forward " \t")
+	(point))))))
 
 (defun dired-manual-move-to-end-of-filename (&optional no-error bol eol)
   ;; Assumes point is at beginning of filename,
       ((error
 	(substitute-command-keys
 	 "File line is omitted. Type \\[dired-omit-toggle] to un-omit.")))))
-    (if (or (memq ?l dired-internal-switches)
+    (let ((maybe (dired-maybe-filename-end bol eol)))
+      (cond
+       (maybe (goto-char maybe))
+       ((or (memq ?l dired-internal-switches)
 	    (memq ?g dired-internal-switches))
 	(if (save-excursion
 	      (goto-char bol)
 	      (setq modes-start (match-beginning 0)
 		    file-type (char-after modes-start))
 	      ;; Move point to end of name:
-	      (if (equal file-type ?l) ; symlink
+	      (if (equal file-type ?l)	; symlink
 		  (progn
 		    (if (search-forward " -> " eol t)
 			(goto-char (match-beginning 0))
 		(skip-chars-backward "/")
 		(point)))
 	  (and (null no-error)
-	       (error "No file on this line")))
+	       (error "No file on this line"))))
       
-      ;; A brief listing
-      (if (eq (point) eol)
-	  (and (null no-error)
-	       (error "No file on this line"))
+       ;; A brief listing
+       ((eq (point) eol)
+	(and (null no-error)
+	     (error "No file on this line")))
+       (t
 	(goto-char eol)
 	(if (and (memq (char-before) '(?@ ?* ?=))
 		 (memq ?F dired-internal-switches))
 	    ;; A guess, since without a long listing, we can't be sure.
 	    (forward-char -1))
 	(skip-chars-backward "/")
-	(point)))))
+	(point))))))
 
 (defun dired-goto-next-nontrivial-file ()
   ;; Position point on first nontrivial file after point.
 
 (defun dired-copy-file (from to ok-flag)
   (dired-handle-overwrite to)
-  (copy-file from to ok-flag dired-copy-preserve-time))
+  (dired-copy-file-recursive from to ok-flag dired-copy-preserve-time t))
+
+(defun dired-copy-file-recursive (from to ok-flag &optional
+				       preserve-time top no-confirm-recursive)
+  (if (and (eq t (car (file-attributes from))) ; A directory, no symbolic link.
+	   (or (memq 'recursive-copy dired-no-confirm)
+	       no-confirm-recursive
+	       (funcall dired-copy-confirmer
+			(format "Recursive copies of %s? " from))))
+      (let ((files (directory-files from)))
+	(if (file-exists-p to)
+	    (or top (dired-handle-overwrite to))
+	  (make-directory to))
+	(while files
+	  (let ((file (car files)))
+	    (if (not (member (file-name-nondirectory file)
+			     '("." "..")))
+		(dired-copy-file-recursive
+		 (expand-file-name file from)
+		 (expand-file-name file to)
+		 ok-flag preserve-time nil t)))
+	  (setq files (cdr files))))
+    (or top (dired-handle-overwrite to)) ; Just a file.
+    (copy-file from to ok-flag preserve-time)))
 
 ;;; Renaming/moving files
 
 				      t ; nowait
 				      marker-char)
 	      (let ((insert-directory-program dired-ls-program))
+		(if dired-use-ls-dired
+		    (setq switches (concat "--dired " switches)))
 		(insert-directory filename switches nil nil))
 	      (dired-after-add-entry b-of-l marker-char))
 	    (if dired-verify-modtimes
 ;; This is a separate function for the sake of nested dired format.
 (defun dired-add-entry-do-indentation (marker-char)
   ;; two spaces or a marker plus a space:
-  (insert (if marker-char
-	      (let ((char (if (characterp marker-char)
-			      marker-char
-			    dired-marker-char)))
-		(dired-update-marker-counters char)
-		(dired-update-mode-line-modified)
-		char)
-	    ?\040)
-	  ?\040))
+  (cond
+   ((not (looking-at "  "))
+    ;; two spaces or a marker plus a space:
+    (insert (if marker-char
+		(let ((char (if (characterp marker-char)
+				marker-char
+			      dired-marker-char)))
+		  (dired-update-marker-counters char)
+		  (dired-update-mode-line-modified)
+		  char)
+	      ?\040)
+	    ?\040))
+   (marker-char
+    (delete-char)
+    (let ((char (if (characterp marker-char)
+		    marker-char
+		  dired-marker-char)))
+      (dired-update-marker-counters char)
+      (dired-update-mode-line-modified)
+      (insert char)))))
 
 (defun dired-remove-file (file)
   (let ((alist dired-buffers)
     (fset 'dired-insert-set-properties 'ignore)
     (fset 'dired-remove-text-properties 'ignore)
     (fset 'dired-set-text-properties 'ignore)
+    (fset 'dired-maybe-filename-start 'ignore)
+    (fset 'dired-maybe-filename-end 'ignore)
     (fset 'dired-move-to-filename 'dired-manual-move-to-filename)
     (fset 'dired-move-to-end-of-filename
 	  'dired-manual-move-to-end-of-filename))))