diff options
| author | André Spiegel | 1998-04-15 10:13:07 +0000 |
|---|---|---|
| committer | André Spiegel | 1998-04-15 10:13:07 +0000 |
| commit | edcb979fe496aedb4ddaa70e2382481711427392 (patch) | |
| tree | 1a2b303ba24553bd81a1717790459c0f7d646536 | |
| parent | ae4c702967955c45c1f34620628874cf204d0a60 (diff) | |
| download | emacs-edcb979fe496aedb4ddaa70e2382481711427392.tar.gz emacs-edcb979fe496aedb4ddaa70e2382481711427392.zip | |
(vc-dired-mode): Redefine dired-move-to-filename-regexp locally.
(vc-dired-reformat-line): Streamlined. Should handle all sorts of
date formats now.
| -rw-r--r-- | lisp/vc.el | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index 75de4586233..9197d2a2da6 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -5,7 +5,7 @@ | |||
| 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 | ||
| @@ -1603,6 +1603,27 @@ the file named in the current Dired buffer line. `vv' invokes | |||
| 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) |
| @@ -1649,32 +1670,29 @@ There is a special command, `*l', to mark all files currently locked." | |||
| 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) |
| 1668 | (setq perm (match-string 1) | 1689 | (re-search-forward ;; OS/2 -l format, no links, owner, group |
| 1669 | owner (match-string 2) | 1690 | "^\\(..[drwxlts-]+ \\) *[0-9]+\\( .*\\)" |
| 1670 | date-and-file (match-string 3))) | 1691 | limit t)) |
| 1671 | ((re-search-forward ;; OS/2 -l format, no links, owner, group | ||
| 1672 | "^\\(..[drwxlts-]+ \\) *[0-9]+\\( [^ 0-9]+ [0-9 ][0-9] .*\\)" | ||
| 1673 | limit t) | ||
| 1674 | (setq perm (match-string 1) | 1692 | (setq perm (match-string 1) |
| 1675 | date-and-file (match-string 2)))) | 1693 | date-and-file (match-string 2)) |
| 1676 | (setq x (substring (concat x " ") 0 10)) | 1694 | (setq x (substring (concat x " ") 0 10)) |
| 1677 | (replace-match (concat perm x date-and-file)))) | 1695 | (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. |