Mercurial > emacs
comparison lisp/vc.el @ 21560:9e3de167472c
(vc-dired-mode): Redefine dired-move-to-filename-regexp locally.
(vc-dired-reformat-line): Streamlined. Should handle all sorts of
date formats now.
author | André Spiegel <spiegel@gnu.org> |
---|---|
date | Wed, 15 Apr 1998 10:13:07 +0000 |
parents | 275fad04745d |
children | 9861518505cb |
comparison
equal
deleted
inserted
replaced
21559:275fad04745d | 21560:9e3de167472c |
---|---|
3 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> | 5 ;; Author: Eric S. Raymond <esr@snark.thyrsus.com> |
6 ;; Maintainer: Andre Spiegel <spiegel@inf.fu-berlin.de> | 6 ;; Maintainer: Andre Spiegel <spiegel@inf.fu-berlin.de> |
7 | 7 |
8 ;; $Id: vc.el,v 1.221 1998/04/14 12:38:25 spiegel Exp $ | 8 ;; $Id: vc.el,v 1.222 1998/04/15 09:48:04 schwab Exp spiegel $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
1601 the file named in the current Dired buffer line. `vv' invokes | 1601 the file named in the current Dired buffer line. `vv' invokes |
1602 `vc-next-action' on this file, or on all files currently marked. | 1602 `vc-next-action' on this file, or on all files currently marked. |
1603 There is a special command, `*l', to mark all files currently locked." | 1603 There is a special command, `*l', to mark all files currently locked." |
1604 (make-local-hook 'dired-after-readin-hook) | 1604 (make-local-hook 'dired-after-readin-hook) |
1605 (add-hook 'dired-after-readin-hook 'vc-dired-hook nil t) | 1605 (add-hook 'dired-after-readin-hook 'vc-dired-hook nil t) |
1606 ;; The following is slightly modified from dired.el, | |
1607 ;; because file lines look a bit different in vc-dired-mode. | |
1608 (set (make-local-variable 'dired-move-to-filename-regexp) | |
1609 (let* | |
1610 ((l "\\([A-Za-z]\\|[^\0-\177]\\)") | |
1611 ;; In some locales, month abbreviations are as short as 2 letters, | |
1612 ;; and they can be padded on the right with spaces. | |
1613 (month (concat l l "+ *")) | |
1614 ;; Recognize any non-ASCII character. | |
1615 ;; The purpose is to match a Kanji character. | |
1616 (k "[^\0-\177]") | |
1617 ;; (k "[^\x00-\x7f\x80-\xff]") | |
1618 (s " ") | |
1619 (yyyy "[0-9][0-9][0-9][0-9]") | |
1620 (mm "[ 0-1][0-9]") | |
1621 (dd "[ 0-3][0-9]") | |
1622 (HH:MM "[ 0-2][0-9]:[0-5][0-9]") | |
1623 (western (concat "\\(" month s dd "\\|" dd s month "\\)" | |
1624 s "\\(" HH:MM "\\|" s yyyy "\\)")) | |
1625 (japanese (concat mm k s dd k s "\\(" s HH:MM "\\|" yyyy k "\\)"))) | |
1626 (concat s "\\(" western "\\|" japanese "\\)" s))) | |
1606 (setq vc-dired-mode t)) | 1627 (setq vc-dired-mode t)) |
1607 | 1628 |
1608 (define-key vc-dired-mode-map "\C-xv" vc-prefix-map) | 1629 (define-key vc-dired-mode-map "\C-xv" vc-prefix-map) |
1609 (define-key vc-dired-mode-map "v" vc-prefix-map) | 1630 (define-key vc-dired-mode-map "v" vc-prefix-map) |
1610 (define-key vc-dired-mode-map "=" 'vc-diff) | 1631 (define-key vc-dired-mode-map "=" 'vc-diff) |
1647 ((eq cvs-state 'locally-added) "added")) | 1668 ((eq cvs-state 'locally-added) "added")) |
1648 (vc-locking-user file)))) | 1669 (vc-locking-user file)))) |
1649 (if state (concat "(" state ")")))) | 1670 (if state (concat "(" state ")")))) |
1650 | 1671 |
1651 (defun vc-dired-reformat-line (x) | 1672 (defun vc-dired-reformat-line (x) |
1652 ;; Reformat a directory-listing line, plugging in version control info in | 1673 ;; Reformat a directory-listing line, replacing various columns with |
1653 ;; place of the user and group info. | 1674 ;; version control information. |
1654 ;; This code, like dired, assumes UNIX -l format. | 1675 ;; This code, like dired, assumes UNIX -l format. |
1655 (beginning-of-line) | 1676 (beginning-of-line) |
1656 (let ((pos (point)) limit perm owner date-and-file) | 1677 (let ((pos (point)) limit perm date-and-file) |
1657 (end-of-line) | 1678 (end-of-line) |
1658 (setq limit (point)) | 1679 (setq limit (point)) |
1659 (goto-char pos) | 1680 (goto-char pos) |
1660 (cond | 1681 (when |
1661 ((or | 1682 (or |
1662 (re-search-forward ;; owner and group | 1683 (re-search-forward ;; owner and group |
1663 "^\\(..[drwxlts-]+ \\) *[0-9]+ \\([^ ]+\\) +[^ ]+ +[0-9]+\\( [^ 0-9]+ [0-9 ][0-9] .*\\)" | 1684 "^\\(..[drwxlts-]+ \\) *[0-9]+ [^ ]+ +[^ ]+ +[0-9]+\\( .*\\)" |
1664 limit t) | 1685 limit t) |
1665 (re-search-forward ;; only owner displayed | 1686 (re-search-forward ;; only owner displayed |
1666 "^\\(..[drwxlts-]+ \\) *[0-9]+ \\([^ ]+\\) +[0-9]+\\( [^ 0-9]+ [0-9 ][0-9] .*\\)" | 1687 "^\\(..[drwxlts-]+ \\) *[0-9]+ [^ ]+ +[0-9]+\\( .*\\)" |
1667 limit t)) | 1688 limit t) |
1689 (re-search-forward ;; OS/2 -l format, no links, owner, group | |
1690 "^\\(..[drwxlts-]+ \\) *[0-9]+\\( .*\\)" | |
1691 limit t)) | |
1668 (setq perm (match-string 1) | 1692 (setq perm (match-string 1) |
1669 owner (match-string 2) | 1693 date-and-file (match-string 2)) |
1670 date-and-file (match-string 3))) | 1694 (setq x (substring (concat x " ") 0 10)) |
1671 ((re-search-forward ;; OS/2 -l format, no links, owner, group | 1695 (replace-match (concat perm x date-and-file))))) |
1672 "^\\(..[drwxlts-]+ \\) *[0-9]+\\( [^ 0-9]+ [0-9 ][0-9] .*\\)" | |
1673 limit t) | |
1674 (setq perm (match-string 1) | |
1675 date-and-file (match-string 2)))) | |
1676 (setq x (substring (concat x " ") 0 10)) | |
1677 (replace-match (concat perm x date-and-file)))) | |
1678 | 1696 |
1679 (defun vc-dired-hook () | 1697 (defun vc-dired-hook () |
1680 ;; Called by dired after any portion of a vc-dired buffer has been read in. | 1698 ;; Called by dired after any portion of a vc-dired buffer has been read in. |
1681 ;; Reformat the listing according to version control. | 1699 ;; Reformat the listing according to version control. |
1682 (message "Getting version information... ") | 1700 (message "Getting version information... ") |