Anonymous avatar Anonymous committed 9d8d075

Dired 7.13.

Comments (0)

Files changed (22)

-2004-10-04  Norbert Koch  <viteno@xemacs.org>
+2005-04-09  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
 
-	* Makefile (VERSION): XEmacs package 1.16 released.
+	* Dired 7.13.
+
+	* dired-help.el (dired-bug-address): Change to Savannah mailing list.
+
+2005-02-23  Michael Sperber  <sperber@informatik.uni-tuebingen.de>
+
+	* dired-xemacs.el (dired-maybe-filename-start): 
+	(dired-maybe-filename-end): 
+	(dired-filename-extents): Introduce `dired-filename-extents,'
+	which we use now instead of `extent-list,', the previous usage of
+	which isn't in XEmacs 21.1.
+
+2005-03-17  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
+
+	* dired.el (dired-align-file): Merge from GNU Emacs:
+	(dired-after-add-entry): Use `dired-align-file'.
+
+	2004-09-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+	
+		(dired-align-file): New function.
+	
+2005-01-14  Steve Youngs  <steve@sxemacs.org>
+
+	* dired.el: Use `emacs-*-version' variables for finding version
+	information instead of string-matching through `emacs-version'.
+
+	* diff.el (diff-emacs-19-p): Ditto.
 
 2004-10-02  Mike Sperber  <sperber@informatik.uni-tuebingen.de>
 
-	* Dired 7.12.
-
+	* Dired 7.13.
++
 2004-08-27  Ville Skytt�  <scop@xemacs.org>
 
 	* diff.el (diff): `diff-next-hunk' has been renamed to
-There are several mailing lists relevant to Dired.  If you wish to join
-a list, send e-mail to their -request address.
+The Dired mailing list discusses all aspects of Dired.  You can send
+messages to the list at
 
-  efs-bugs@hplb.hpl.hp.com
+elisp-code-dired@nongnu.org
 
-This is where all bug reports should go.  M-x dired-report-bug is the
-recommended way of sending bug reports about Dired, and this will send
-by default to this address.
+You can subscribe, view the archives, and perform a number of other
+adminstrative tasks at:
 
-  efs-help@hplb.hpl.hp.com
-
-This is where general discussions about Dired should go.  For beta-testing
-discussions, use efs-testers instead.
-
-  efs-testers@hplb.hpl.hp.com
-
-This is where discussions about beta testing Dired should go.  Bugs should
-however be reported to efs-bugs. Patches for beta test bugs will be
-sent to this list.
-
-  efs-announce@hplb.hpl.hp.com
-
-This is where announcements such as new generally available releases of efs
-should go.
-
-Each of the lists have a -request address to join and leave the list.
+http://lists.nongnu.org/mailman/listinfo/elisp-code-dired
 include Makefile.dired
 
 VERSION = 1.16
-AUTHOR_VERSION = 7.12
+AUTHOR_VERSION = 7.13
 MAINTAINER = Mike Sperber <sperber@informatik.uni-tuebingen.de>
 PACKAGE = dired
 PKG_TYPE = regular
 #
 # File:         Makefile
 # Release:      $EFS release: 1.21 $
-# Release:      $dired release: 7.12 $
+# Release:      $dired release: 7.13 $
 # Version:      $Revision$
 # RCS:
 # Description:  Makefile for byte-compiling dired (primarily) and EFS.
-This is Dired 7.12
+This is Dired 7.13
 ==================
 
 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.
 
-NOTE: If you're using Dired 7.12 in conjunction with EFS, you are
+NOTE: If you're using Dired 7.13 in conjunction with EFS, you are
       advised to use EFS 1.21 or higher.
 
 ;;; Internal variables
 
 (defconst diff-emacs-19-p
-  (let ((ver (string-to-int (substring emacs-version 0 2))))
+  (let ((ver emacs-major-version))
     (>= ver 19)))
 
 (or diff-emacs-19-p (require 'emacs-19))
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-cmpr.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   Commands for compressing marked files.
 ;;
 ;;
 ;; File:           dired-diff.el
 ;; RCS:
-;; Dired Version: #Revision:  $
+;; Dired Version:  7.13
 ;; 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
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   rudimentary face customization support for dired
 ;; Author:        Mike Sperber <sperber@informatik.uni-tuebingen.de>
 ;;
 ;; File:           dired-grep.el
 ;; RCS:
-;; Dired Version: #Revision:  $
+;; Dired Version:  7.13
 ;; 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
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   Obtaining help for dired
 ;; Modified:      Sun Nov 20 21:10:47 1994 by sandy on gandalf
 
 ;;; Constants
 
-(defconst dired-bug-address "efs-bugs@hplb.hpl.hp.com")
+(defconst dired-bug-address "elisp-code-dired@nongnu.org")
 
 (defvar dired-documentation nil)
 
 ;;
 ;; File:           dired-mob.el
 ;; RCS:
-;; Dired Version: #Revision:  $
+;; Dired Version:  7.13
 ;; Description:    Commands for marking files from another buffer.
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-mule.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   MULE support for dired.
 ;; Created:       Sun Jul 17 14:45:12 1994 by sandy on ibm550
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-oas.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   dired odds and sods. Dired functions not usually needed.
 ;;                This file is not a reference to the Organization of
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
-;; File:           dired-rgxp.el
-;; Dired Version: #Revision:  $
+;; File:          dired-rgxp.el
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   Commands for running commands on files whose names
 ;;                match a regular expression.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-sex.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   Marking files according to sexpressions.  Sorry.
 ;; Created:       Wed Sep 14 01:30:43 1994 by sandy on ibm550
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-shell.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   Commands for running shell commands on marked files.
 ;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-uu.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   Commands for uuencoding/uudecoding marked files.
 ;; Author:        Sandy Rutherford <sandy@math.ubc.ca>
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-vir.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   Virtual dired mode for browsing ls -lR listings.
 ;; Author:        Sebastian Kremer <sk@thp.uni-koeln.de>
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-xemacs.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   dired functions for XEmacs
 ;; Author:        Mike Sperber <sperber@informatik.uni-tuebingen.de>
 (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)))
+  (let ((extents (dired-filename-extents start end)))
     (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)))
+  (let ((extents (dired-filename-extents start end)))
     (and extents
 	 (extent-end-position (car extents)))))
 
+(defun dired-filename-extents (start end)
+  "Returns extents with DIRED-FILE-NAME property.
+START and END say where."
+  (let ((extents '()))
+    (map-extents #'(lambda (extent _)
+		     (if (extent-property extent 'dired-file-name)
+			 (setq extents (cons extent extents)))
+		     nil)
+		 nil
+		 start end)
+    extents))
+
 (defun dired-set-extent-text-properties (extent face)
   (set-extent-face extent face)
   (set-extent-property extent 'keymap dired-filename-local-map)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;; File:          dired-xy.el
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; RCS:
 ;; Description:   Commands for reading mail from dired.
 ;;
 ;;
 ;; File:          dired.el
 ;; RCS:           
-;; Dired Version: #Revision:  $
+;; Dired Version: 7.13
 ;; Description:   The DIRectory EDitor is for manipulating, and running
 ;;                commands on files in a directory.
 ;; Authors:       FSF,
 
 ;;; Dired Version
 
-(defconst dired-version (substring "#Revision: 7.12 $" 11 -2)
+(defconst dired-version (substring "#Revision: 7.13 $" 11 -2)
   "The revision number of Tree Dired (as a string).
 
 Don't forget to mention this when reporting bugs to:
    
-   efs-bugs@hplb.hpl.hp.com")
+   elisp-code-dired@nongnu.org")
 
 ;; Global key bindings:
 ;; --------------------
 ;; Testing against the string `Lucid' breaks InfoDock.  How many years has
 ;; it been since Lucid went away?
 (let ((lucid-p (string-match "XEmacs" emacs-version))
-      ver subver)
-  (or (string-match "^\\([0-9]+\\)\\.\\([0-9]+\\)" emacs-version)
-      (error "dired does not work with emacs version %s" emacs-version))
-  (setq ver (string-to-int (substring emacs-version (match-beginning 1)
-				      (match-end 1)))
-	subver (string-to-int (substring emacs-version (match-beginning 2)
-					 (match-end 2))))
+      (ver emacs-major-version)
+      (subver emacs-minor-version))
+  (unless ver
+    (or (string-match "^\\([0-9]+\\)\\.\\([0-9]+\\)" emacs-version)
+	(error "dired does not work with emacs version %s" emacs-version))
+    (setq ver (string-to-int (substring emacs-version (match-beginning 1)
+					(match-end 1)))
+	  subver (string-to-int (substring emacs-version (match-beginning 2)
+					   (match-end 2)))))
   (cond
    ((= ver 18)
     (require 'emacs-19)
 		(dired-set-file-modtime directory dired-subdir-alist))
 	    t))))) ; return t on success, else nil.
 
+(defun dired-align-file (beg end)
+  "Align the fields of a file to the ones of surrounding lines.
+BEG..END is the line where the file info is located."
+  ;; Some versions of ls try to adjust the size of each field so as to just
+  ;; hold the largest element ("largest" in the current invocation, of
+  ;; course).  So when a single line is output, the size of each field is
+  ;; just big enough for that one output.  Thus when dired refreshes one
+  ;; line, the alignment if this line w.r.t the rest is messed up because
+  ;; the fields of that one line will generally be smaller.
+  ;;
+  ;; To work around this problem, we here add spaces to try and re-align the
+  ;; fields as needed.  Since this is purely aesthetic, it is of utmost
+  ;; importance that it doesn't mess up anything like
+  ;; `dired-move-to-filename'.  To this end, we limit ourselves to adding
+  ;; spaces only, and to only add them at places where there was already at
+  ;; least one space.  This way, as long as `dired-move-to-filename-regexp'
+  ;; always matches spaces with "*" or "+", we know we haven't made anything
+  ;; worse.  There is one spot where the exact number of spaces is
+  ;; important, which is just before the actual filename, so we refrain from
+  ;; adding spaces there (and within the filename as well, of course).
+  (save-excursion
+    (let (file file-col other other-col)
+      ;; Check the there is indeed a file, and that there is anoter adjacent
+      ;; file with which to align, and that additional spaces are needed to
+      ;; align the filenames.
+      (when (and (setq file (dired-move-to-filename nil beg end))
+		 (setq file-col (current-column))
+		 (setq other
+		       (or (and (goto-char beg)
+				(zerop (forward-line -1))
+				(dired-move-to-filename))
+			   (and (goto-char beg)
+				(zerop (forward-line 1))
+				(dired-move-to-filename))))
+		 (setq other-col (current-column))
+		 (/= file other)
+		 ;; Make sure there is some work left to do.
+		 (> other-col file-col))
+	;; If we've only looked at the line above, check to see if the line
+	;; below exists as well and if so, align with the shorter one.
+	(when (and (< other file)
+		   (goto-char beg)
+		   (zerop (forward-line 1))
+		   (dired-move-to-filename))
+	  (let ((alt-col (current-column)))
+	    (when (< alt-col other-col)
+	      (setq other-col alt-col)
+	      (setq other (point)))))
+	;; Keep positions uptodate when we insert stuff.
+	(if (> other file) (setq other (copy-marker other)))
+	(setq file (copy-marker file))
+	;; Main loop.
+	(goto-char beg)
+	(skip-chars-forward " ")	;Skip to the first field.
+	(while (and (> other-col file-col)
+		    ;; Don't touch anything just before (and after) the
+		    ;; beginning of the filename.
+		    (> file (point)))
+	  ;; We're now just in front of a field, with a space behind us.
+	  (let* ((curcol (current-column))
+		 ;; Nums are right-aligned.
+		 (num-align (looking-at "[0-9]"))
+		 ;; Let's look at the other line, in the same column: we
+		 ;; should be either near the end of the previous field, or
+		 ;; in the space between that field and the next.
+		 ;; [ Of course, it's also possible that we're already within
+		 ;; the next field or even past it, but that's unlikely since
+		 ;; other-col > file-col. ]
+		 ;; Let's find the distance to the alignment-point (either
+		 ;; the beginning or the end of the next field, depending on
+		 ;; whether this field is left or right aligned).
+		 (align-pt-offset
+		  (save-excursion
+		    (goto-char other)
+		    (move-to-column curcol)
+		    (when (looking-at
+			   (concat
+			    (if (eq (char-before) ?\ ) " *" "[^ ]* *")
+			    (if num-align "[0-9][^ ]*")))
+		      (- (match-end 0) (match-beginning 0)))))
+		 ;; Now, the number of spaces to insert is align-pt-offset
+		 ;; minus the distance to the equivalent point on the
+		 ;; current line.
+		 (spaces
+		  (if (not num-align)
+		      align-pt-offset
+		    (and align-pt-offset
+			 (save-excursion
+			   (skip-chars-forward "^ ")
+			   (- align-pt-offset (- (current-column) curcol)))))))
+	    (when (and spaces (> spaces 0))
+	      (setq file-col (+ spaces file-col))
+	      (if (> file-col other-col)
+		  (setq spaces (- spaces (- file-col other-col))))
+	      (insert-char ?\ spaces)
+	      ;; Let's just make really sure we did not mess up.
+	      (unless (save-excursion
+			(eq (dired-move-to-filename) (marker-position file)))
+		;; Damn!  We messed up: let's revert the change.
+		(delete-char (- spaces)))))
+	  ;; Now skip to next field.
+	  (skip-chars-forward "^ ") (skip-chars-forward " "))
+	(set-marker file nil)))))
+
 (defun dired-after-add-entry (start marker-char)
   ;; Does the cleanup of a dired entry after listing it.
   ;; START is the start of the new listing-line.
 					?\n ?\r))))))
     ;; clobber the extra newline at the end of the line
     (end-of-line)
-    (delete-char 1)))
+    (delete-char 1)
+    ;; Re-align fields, if necessary.
+    (dired-align-file (1+ start) (point))))
 
 ;; This is a separate function for the sake of nested dired format.
 (defun dired-add-entry-do-indentation (marker-char)
 ;;;; --------------------------------------------------------------
 
 (let ((lucid-p (string-match "XEmacs" emacs-version))
-      ver)
-  (or (string-match "^\\([0-9]+\\)\\." emacs-version)
-      (error "Weird emacs version %s" emacs-version))
-  (setq ver (string-to-int (substring emacs-version (match-beginning 1)
-				      (match-end 1))))
+      (ver emacs-major-version))
+  (unless ver
+    (or (string-match "^\\([0-9]+\\)\\." emacs-version)
+	(error "Weird emacs version %s" emacs-version))
+    (setq ver (string-to-int (substring emacs-version (match-beginning 1)
+					(match-end 1)))))
 
   ;; Reading with history.
   (if (>= ver 19)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.