3
$Id: dired.scm,v 1.194 2004/03/30 04:45:01 cph Exp $
3
$Id: dired.scm,v 1.199 2006/06/12 04:19:43 cph Exp $
5
Copyright 1986, 1989-2001 Massachusetts Institute of Technology
5
Copyright 1987,1989,1991,1992,1993,1994 Massachusetts Institute of Technology
6
Copyright 1995,1996,1997,1999,2000,2001 Massachusetts Institute of Technology
7
Copyright 2004,2006 Massachusetts Institute of Technology
7
9
This file is part of MIT/GNU Scheme.
710
715
(set-buffer-point! buffer (buffer-start buffer))
711
716
(buffer-not-modified! buffer)
712
(pop-up-buffer buffer false))))
717
(pop-up-buffer buffer #f))))
716
721
(define (dired-filename-start lstart)
717
(let ((eol (line-end lstart 0)))
720
"\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct\\|Nov\\|Dec\\)[ ]+[0-9]+"
725
(re-match-forward " *[^ ]* *" m eol)))))
722
(re-match-forward directory-listing-before-filename-regexp
727
727
(define (dired-filename-string lstart)
728
728
(let ((start (dired-filename-start lstart)))
789
789
(move-mark-to! point (line-start point 1)))
790
790
(mark-temporary! point)))
792
;;; Regular expression to match up to the file name in a directory
793
;;; listing. The default value is designed to recognize dates and
794
;;; times regardless of the language.
796
;;; Stolen from Emacs 22 and translated to REXP format.
798
(define directory-listing-before-filename-regexp
800
(char-set-union char-set:alphabetic
801
(ascii-range->char-set #x80 #x100)))
802
(l? (rexp-optional l))
803
(l-or-quote (char-set-union l (char-set #\')))
804
(digit (string->char-set "0123456789"))
805
;; In some locales, month abbreviations are as short as 2 letters,
806
;; and they can be followed by ".".
807
;; In Breton, a month name can include a quote character.
809
(rexp-sequence (rexp-n* 2 l-or-quote)
810
(rexp-optional ".")))
813
(yyyy (rexp-n*n 4 char-set:numeric))
814
(dd (rexp-sequence (string->char-set " 0123") digit))
815
(HH:MM (rexp-sequence (string->char-set " 012")
817
(string->char-set ":.")
818
(string->char-set "012345")
820
(seconds (rexp-sequence (string->char-set "0123456")
822
(rexp-optional (string->char-set ".,")
824
(zone (rexp-sequence (string->char-set "-+")
825
(string->char-set "012")
827
(string->char-set "012345")
829
(iso-mm-dd (rexp-sequence (string->char-set "01")
832
(string->char-set "0123")
838
(rexp-optional (rexp-optional s)
841
(rexp-alternatives (rexp-sequence (rexp-optional yyyy "-")
843
(string->char-set " T")
850
(rexp-alternatives (rexp-sequence month s+ dd)
851
(rexp-sequence dd (rexp-optional ".") s month))
853
(rexp-alternatives HH:MM yyyy)))
855
(rexp-sequence month s+ dd "," s+ yyyy))
856
;; Japanese MS-Windows ls-lisp has one-digit months, and
857
;; omits the Kanji characters after month and day-of-month.
858
;; On Mac OS X 10.3, the date format in East Asian locales is
859
;; day-of-month digits followed by month digits.
860
(mm (rexp-sequence (rexp-optional (string->char-set " 01"))
864
(rexp-alternatives (rexp-sequence mm l? s dd l? s+)
865
(rexp-sequence dd s mm s+))
866
(rexp-alternatives HH:MM
867
(rexp-sequence yyyy l?)))))
868
;; The "[0-9]" below requires the previous column to end in a digit.
869
;; This avoids recognizing `1 may 1997' as a date in the line:
870
;; -r--r--r-- 1 may 1997 1168 Oct 19 16:49 README
872
;; The "[BkKMGTPEZY]?" below supports "ls -alh" output.
873
;; The ".*" below finds the last match if there are multiple matches.
874
;; This avoids recognizing `jservice 10 1024' as a date in the line:
875
;; drwxr-xr-x 3 jservice 10 1024 Jul 2 1997 esg-host
877
;; vc dired listings provide the state or blanks between file
878
;; permissions and date. The state is always surrounded by
880
;; -rw-r--r-- (modified) 2005-10-22 21:25 files.el
881
;; Support for this was added to Edwin by cph.
883
(rexp-sequence (rexp* (rexp-any-char))
887
(string->char-set "BkKMGTPEZY")))
890
(rexp-alternatives western
792
896
(define (dired-redisplay pathname #!optional mark)
794
898
(mark-right-inserting-copy