comparison lisp/vc.el @ 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 f7c7cc74fde2
children ae2a3a67e382
comparison
equal deleted inserted replaced
47880:5508277df103 47881:2a95bf2d8eaf
4 4
5 ;; Author: FSF (see below for full credits) 5 ;; Author: FSF (see below for full credits)
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
7 ;; Keywords: tools 7 ;; Keywords: tools
8 8
9 ;; $Id: vc.el,v 1.342 2002/10/08 15:31:43 monnier Exp $ 9 ;; $Id: vc.el,v 1.343 2002/10/11 09:36:00 spiegel Exp $
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
2174 (defun vc-dired-reformat-line (vc-info) 2174 (defun vc-dired-reformat-line (vc-info)
2175 "Reformat a directory-listing line. 2175 "Reformat a directory-listing line.
2176 Replace various columns with version control information, VC-INFO. 2176 Replace various columns with version control information, VC-INFO.
2177 This code, like dired, assumes UNIX -l format." 2177 This code, like dired, assumes UNIX -l format."
2178 (beginning-of-line) 2178 (beginning-of-line)
2179 (let ((pos (point)) limit) 2179 (when (re-search-forward
2180 (end-of-line) 2180 ;; Match link count, owner, group, size. Group may be missing,
2181 (setq limit (point)) 2181 ;; and only the size is present in OS/2 -l format.
2182 (goto-char pos) 2182 "^..[drwxlts-]+ \\( *[0-9]+\\( [^ ]+ +\\([^ ]+ +\\)?[0-9]+\\)?\\) "
2183 (when 2183 (line-end-position) t)
2184 (or 2184 (replace-match (substring (concat vc-info " ") 0 10)
2185 (re-search-forward ;; owner and group 2185 t t nil 1)))
2186 "^\\(..[drwxlts-]+ \\) *[0-9]+ [^ ]+ +[^ ]+ +[0-9]+\\( .*\\)"
2187 limit t)
2188 (re-search-forward ;; only owner displayed
2189 "^\\(..[drwxlts-]+ \\) *[0-9]+ [^ ]+ +[0-9]+\\( .*\\)"
2190 limit t)
2191 (re-search-forward ;; OS/2 -l format, no links, owner, group
2192 "^\\(..[drwxlts-]+ \\) *[0-9]+\\( .*\\)"
2193 limit t))
2194 (let ((replacement (concat (match-string 1)
2195 (substring (concat vc-info " ")
2196 0 10)
2197 (match-string 2))))
2198 ;; FIXME: Clear the text properties to make it work, because with
2199 ;; a straightforward replacement, they will get messed up.
2200 ;; Eventually, the text properties should be transformed correctly,
2201 ;; not removed.
2202 (set-text-properties 0 (length replacement) nil replacement)
2203 (replace-match replacement)))))
2204 2186
2205 (defun vc-dired-hook () 2187 (defun vc-dired-hook ()
2206 "Reformat the listing according to version control. 2188 "Reformat the listing according to version control.
2207 Called by dired after any portion of a vc-dired buffer has been read in." 2189 Called by dired after any portion of a vc-dired buffer has been read in."
2208 (message "Getting version information... ") 2190 (message "Getting version information... ")