changeset 47881:2a95bf2d8eaf

(vc-dired-reformat-line): Simplified. Handles text properties correctly now.
author André Spiegel <spiegel@gnu.org>
date Mon, 14 Oct 2002 15:13:59 +0000
parents 5508277df103
children 2bf98e61feaf
files lisp/vc.el
diffstat 1 files changed, 8 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc.el	Mon Oct 14 11:02:07 2002 +0000
+++ b/lisp/vc.el	Mon Oct 14 15:13:59 2002 +0000
@@ -6,7 +6,7 @@
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 ;; Keywords: tools
 
-;; $Id: vc.el,v 1.342 2002/10/08 15:31:43 monnier Exp $
+;; $Id: vc.el,v 1.343 2002/10/11 09:36:00 spiegel Exp $
 
 ;; This file is part of GNU Emacs.
 
@@ -2176,31 +2176,13 @@
 Replace various columns with version control information, VC-INFO.
 This code, like dired, assumes UNIX -l format."
   (beginning-of-line)
-  (let ((pos (point)) limit)
-    (end-of-line)
-    (setq limit (point))
-    (goto-char pos)
-    (when
-        (or
-         (re-search-forward  ;; owner and group
-          "^\\(..[drwxlts-]+ \\) *[0-9]+ [^ ]+ +[^ ]+ +[0-9]+\\( .*\\)"
-          limit t)
-         (re-search-forward  ;; only owner displayed
-          "^\\(..[drwxlts-]+ \\) *[0-9]+ [^ ]+ +[0-9]+\\( .*\\)"
-	  limit t)
-         (re-search-forward  ;; OS/2 -l format, no links, owner, group
-          "^\\(..[drwxlts-]+ \\) *[0-9]+\\( .*\\)"
-          limit t))
-      (let ((replacement (concat (match-string 1)
-                                 (substring (concat vc-info "          ")
-                                            0 10)
-                                 (match-string 2))))
-        ;; FIXME: Clear the text properties to make it work, because with
-        ;; a straightforward replacement, they will get messed up.
-        ;; Eventually, the text properties should be transformed correctly,
-        ;; not removed.
-        (set-text-properties 0 (length replacement) nil replacement)
-        (replace-match replacement)))))
+  (when (re-search-forward  
+         ;; Match link count, owner, group, size.  Group may be missing,
+         ;; and only the size is present in OS/2 -l format.
+         "^..[drwxlts-]+ \\( *[0-9]+\\( [^ ]+ +\\([^ ]+ +\\)?[0-9]+\\)?\\) "
+         (line-end-position) t)
+      (replace-match (substring (concat vc-info "          ") 0 10)
+                     t t nil 1)))
 
 (defun vc-dired-hook ()
   "Reformat the listing according to version control.