]> code.delx.au - gnu-emacs/commitdiff
* files.el (directory-listing-before-filename-regexp): New
authorMichael Albinus <michael.albinus@gmx.de>
Sun, 23 Oct 2005 12:17:28 +0000 (12:17 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Sun, 23 Oct 2005 12:17:28 +0000 (12:17 +0000)
defvar.  Replaces `dired-move-to-filename-regexp' from dired.el.

* dired.el (dired-move-to-filename-regexp): Removed.  All
occurences replaced by `directory-listing-before-filename-regexp'.

* dired-x.el, locate.el, vc.el: Replace
`dired-move-to-filename-regexp' by
`directory-listing-before-filename-regexp'.  In vc.el it is
overwritten locally; maybe this can be handled in files.el too.

* net/ange-ftp.el (ange-ftp-date-regexp): Removed.  All occurences
replaced by `directory-listing-before-filename-regexp'.

* faq.texi (Bugs and problems): Replace
`dired-move-to-filename-regexp' by
`directory-listing-before-filename-regexp'.

lisp/ChangeLog
lisp/dired-x.el
lisp/dired.el
lisp/files.el
lisp/locate.el
lisp/net/ange-ftp.el
lisp/vc.el
man/ChangeLog
man/faq.texi

index e15a3b6ef6afefd06790585119d0dd4f0f47ac7d..e3e7f75b5e64d27889e0c05f5d8ef9036eda6758 100644 (file)
@@ -1,3 +1,19 @@
+2005-10-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * files.el (directory-listing-before-filename-regexp): New
+       defvar.  Replaces `dired-move-to-filename-regexp' from dired.el.
+
+       * dired.el (dired-move-to-filename-regexp): Removed.  All
+       occurences replaced by `directory-listing-before-filename-regexp'.
+
+       * dired-x.el, locate.el, vc.el: Replace
+       `dired-move-to-filename-regexp' by
+       `directory-listing-before-filename-regexp'.  In vc.el it is
+       overwritten locally; maybe this can be handled in files.el too.
+
+       * net/ange-ftp.el (ange-ftp-date-regexp): Removed.  All occurences
+       replaced by `directory-listing-before-filename-regexp'.
+
 2005-10-23  Andreas Schwab  <schwab@suse.de>
 
        * font-lock.el (lisp-font-lock-keywords-2): Add eval-at-startup
index 8ce5e5d48d0f501091be406af8572100fb857cd9..50c52f0ab6bcd19df859523438d0e113b92396c3 100644 (file)
@@ -1517,7 +1517,7 @@ to mark all zero length files."
               ;; Karsten Wenger <kw@cis.uni-muenchen.de> fixed uid.
               (setq uid (buffer-substring (+ (point) 1)
                                          (progn (forward-word 1) (point))))
-              (re-search-forward dired-move-to-filename-regexp)
+              (re-search-forward directory-listing-before-filename-regexp)
               (goto-char (match-beginning 1))
               (forward-char -1)
               (setq size (string-to-number (buffer-substring (save-excursion
index 3934fe4e43358fd9db303aece7b2443bf4a32e32..3cc83b29fddeae9a41a37f0afe8ee7aeb96fbab0 100644 (file)
@@ -842,16 +842,17 @@ BEG..END is the line where the file info is located."
   ;; line, the alignment if this line w.r.t the rest is messed up because
   ;; the fields of that one line will generally be smaller.
   ;;
-  ;; To work around this problem, we here add spaces to try and re-align the
-  ;; fields as needed.  Since this is purely aesthetic, it is of utmost
-  ;; importance that it doesn't mess up anything like
-  ;; `dired-move-to-filename'.  To this end, we limit ourselves to adding
-  ;; spaces only, and to only add them at places where there was already at
-  ;; least one space.  This way, as long as `dired-move-to-filename-regexp'
-  ;; always matches spaces with "*" or "+", we know we haven't made anything
-  ;; worse.  There is one spot where the exact number of spaces is
-  ;; important, which is just before the actual filename, so we refrain from
-  ;; adding spaces there (and within the filename as well, of course).
+  ;; To work around this problem, we here add spaces to try and
+  ;; re-align the fields as needed.  Since this is purely aesthetic,
+  ;; it is of utmost importance that it doesn't mess up anything like
+  ;; `dired-move-to-filename'.  To this end, we limit ourselves to
+  ;; adding spaces only, and to only add them at places where there
+  ;; was already at least one space.  This way, as long as
+  ;; `directory-listing-before-filename-regexp' always matches spaces
+  ;; with "*" or "+", we know we haven't made anything worse.  There
+  ;; is one spot where the exact number of spaces is important, which
+  ;; is just before the actual filename, so we refrain from adding
+  ;; spaces there (and within the filename as well, of course).
   (save-excursion
     (let (file file-col other other-col)
       ;; Check the there is indeed a file, and that there is anoter adjacent
@@ -953,7 +954,7 @@ If HDR is non-nil, insert a header line with the directory name."
        (setq switches (concat "--dired " switches)))
     ;; We used to specify the C locale here, to force English month names;
     ;; but this should not be necessary any more,
-    ;; with the new value of dired-move-to-filename-regexp.
+    ;; with the new value of `directory-listing-before-filename-regexp'.
     (if file-list
        (dolist (f file-list)
          (let ((beg (point)))
@@ -1837,50 +1838,6 @@ DIR must be a directory name, not a file name."
 \f
 ;;; Functions for finding the file name in a dired buffer line.
 
-(defvar dired-move-to-filename-regexp
-  (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
-        (l-or-quote "\\([A-Za-z']\\|[^\0-\177]\\)")
-        ;; In some locales, month abbreviations are as short as 2 letters,
-        ;; and they can be followed by ".".
-        ;; In Breton, a month name  can include a quote character.
-        (month (concat l-or-quote l-or-quote "+\\.?"))
-        (s " ")
-        (yyyy "[0-9][0-9][0-9][0-9]")
-        (dd "[ 0-3][0-9]")
-        (HH:MM "[ 0-2][0-9][:.][0-5][0-9]")
-        (seconds "[0-6][0-9]\\([.,][0-9]+\\)?")
-        (zone "[-+][0-2][0-9][0-5][0-9]")
-        (iso-mm-dd "[01][0-9]-[0-3][0-9]")
-        (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?"))
-        (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time
-                     "\\|" yyyy "-" iso-mm-dd "\\)"))
-        (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)"
-                         s "+"
-                         "\\(" HH:MM "\\|" yyyy "\\)"))
-        (western-comma (concat month s "+" dd "," s "+" yyyy))
-        ;; Japanese MS-Windows ls-lisp has one-digit months, and
-        ;; omits the Kanji characters after month and day-of-month.
-        ;; On Mac OS X 10.3, the date format in East Asian locales is
-        ;; day-of-month digits followed by month digits.
-        (mm "[ 0-1]?[0-9]")
-        (east-asian
-         (concat "\\(" mm l "?" s dd l "?" s "+"
-                 "\\|" dd s mm s "+" "\\)"
-                 "\\(" HH:MM "\\|" yyyy l "?" "\\)")))
-        ;; The "[0-9]" below requires the previous column to end in a digit.
-        ;; This avoids recognizing `1 may 1997' as a date in the line:
-        ;; -r--r--r--   1 may      1997        1168 Oct 19 16:49 README
-        ;; The "[BkKMGTPEZY]?" below supports "ls -alh" output.
-        ;; The ".*" below finds the last match if there are multiple matches.
-        ;; This avoids recognizing `jservice  10  1024' as a date in the line:
-        ;; drwxr-xr-x  3 jservice  10  1024 Jul  2  1997 esg-host
-    (concat ".*[0-9][BkKMGTPEZY]?" s
-           "\\(" western "\\|" western-comma "\\|" east-asian "\\|" iso "\\)"
-           s "+"))
-  "Regular expression to match up to the file name in a directory listing.
-The default value is designed to recognize dates and times
-regardless of the language.")
-
 (defvar dired-permission-flags-regexp
   "\\([^ ]\\)[-r][-w]\\([^ ]\\)[-r][-w]\\([^ ]\\)[-r][-w]\\([^ ]\\)"
   "Regular expression to match the permission flags in `ls -l'.")
@@ -1898,12 +1855,12 @@ Return the position of the beginning of the filename, or nil if none found."
     (cond
      ((and change (< change eol))
       (goto-char change))
-     ((re-search-forward dired-move-to-filename-regexp eol t)
+     ((re-search-forward directory-listing-before-filename-regexp eol t)
       (goto-char (match-end 0)))
      ((re-search-forward dired-permission-flags-regexp eol t)
       ;; Ha!  There *is* a file.  Our regexp-from-hell just failed to find it.
       (if raise-error
-         (error "Unrecognized line!  Check dired-move-to-filename-regexp"))
+         (error "Unrecognized line!  Check directory-listing-before-filename-regexp"))
       (beginning-of-line)
       nil)
      (raise-error
index 89ff4da76a65e8240b7ece2da52415a0ed04a513..4373738080a7c8b37279770649019138023599b5 100644 (file)
@@ -4475,6 +4475,57 @@ program specified by `directory-free-space-program' if that is non-nil."
                  (forward-word -1)
                  (buffer-substring (point) end)))))))))
 
+;; The following expression replaces `dired-move-to-filename-regexp'.
+(defvar directory-listing-before-filename-regexp
+  (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
+        (l-or-quote "\\([A-Za-z']\\|[^\0-\177]\\)")
+        ;; In some locales, month abbreviations are as short as 2 letters,
+        ;; and they can be followed by ".".
+        ;; In Breton, a month name  can include a quote character.
+        (month (concat l-or-quote l-or-quote "+\\.?"))
+        (s " ")
+        (yyyy "[0-9][0-9][0-9][0-9]")
+        (dd "[ 0-3][0-9]")
+        (HH:MM "[ 0-2][0-9][:.][0-5][0-9]")
+        (seconds "[0-6][0-9]\\([.,][0-9]+\\)?")
+        (zone "[-+][0-2][0-9][0-5][0-9]")
+        (iso-mm-dd "[01][0-9]-[0-3][0-9]")
+        (iso-time (concat HH:MM "\\(:" seconds "\\( ?" zone "\\)?\\)?"))
+        (iso (concat "\\(\\(" yyyy "-\\)?" iso-mm-dd "[ T]" iso-time
+                     "\\|" yyyy "-" iso-mm-dd "\\)"))
+        (western (concat "\\(" month s "+" dd "\\|" dd "\\.?" s month "\\)"
+                         s "+"
+                         "\\(" HH:MM "\\|" yyyy "\\)"))
+        (western-comma (concat month s "+" dd "," s "+" yyyy))
+        ;; Japanese MS-Windows ls-lisp has one-digit months, and
+        ;; omits the Kanji characters after month and day-of-month.
+        ;; On Mac OS X 10.3, the date format in East Asian locales is
+        ;; day-of-month digits followed by month digits.
+        (mm "[ 0-1]?[0-9]")
+        (east-asian
+         (concat "\\(" mm l "?" s dd l "?" s "+"
+                 "\\|" dd s mm s "+" "\\)"
+                 "\\(" HH:MM "\\|" yyyy l "?" "\\)")))
+        ;; The "[0-9]" below requires the previous column to end in a digit.
+        ;; This avoids recognizing `1 may 1997' as a date in the line:
+        ;; -r--r--r--   1 may      1997        1168 Oct 19 16:49 README
+
+        ;; The "[BkKMGTPEZY]?" below supports "ls -alh" output.
+        ;; The ".*" below finds the last match if there are multiple matches.
+        ;; This avoids recognizing `jservice  10  1024' as a date in the line:
+        ;; drwxr-xr-x  3 jservice  10  1024 Jul  2  1997 esg-host
+
+         ;; vc dired listings provide the state or blanks between file
+         ;; permissions and date.  The state is always surrounded by
+         ;; parantheses:
+         ;; -rw-r--r-- (modified) 2005-10-22 21:25 files.el
+         ;; This is not supported yet.
+    (concat ".*[0-9][BkKMGTPEZY]?" s
+           "\\(" western "\\|" western-comma "\\|" east-asian "\\|" iso "\\)"
+           s "+"))
+  "Regular expression to match up to the file name in a directory listing.
+The default value is designed to recognize dates and times
+regardless of the language.")
 
 (defvar insert-directory-ls-version 'unknown)
 
index 390e0ec72b35aceb69255f0e680efeb34c7418af..5b61ed522e9f805cbdcb664555d308feef3e206b 100644 (file)
@@ -376,13 +376,13 @@ do not work in subdirectories.
   (set (make-local-variable 'dired-directory) "/")
   (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches)
   (setq dired-switches-alist nil)
-  (make-local-variable 'dired-move-to-filename-regexp)
+  (make-local-variable 'directory-listing-before-filename-regexp)
   ;; This should support both Unix and Windoze style names
-  (setq dired-move-to-filename-regexp
+  (setq directory-listing-before-filename-regexp
        (concat "^."
                (make-string (1- locate-filename-indentation) ?\ )
                "\\(/\\|[A-Za-z]:\\)\\|"
-               (default-value 'dired-move-to-filename-regexp)))
+               (default-value 'directory-listing-before-filename-regexp)))
   (make-local-variable 'dired-actual-switches)
   (setq dired-actual-switches "")
   (make-local-variable 'dired-permission-flags-regexp)
index f50ca07a4889f5e96f6df4c1d6f36e328e4aaced..758346e3647bbd14f75ad75ab04863b1dd8b0074 100644 (file)
@@ -2666,36 +2666,6 @@ away in the internal cache."
 ;;;; Directory information caching support.
 ;;;; ------------------------------------------------------------
 
-(defconst ange-ftp-date-regexp
-  (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
-        ;; In some locales, month abbreviations are as short as 2 letters,
-        ;; and they can be padded on the right with spaces.
-        ;; weiand: changed: month ends with . or , or .,
-;;old   (month (concat l l "+ *"))
-        (month (concat l l "+[.]?,? *"))
-        ;; Recognize any non-ASCII character.
-        ;; The purpose is to match a Kanji character.
-        (k "[^\0-\177]")
-        (s " ")
-        (mm "[ 0-1][0-9]")
-        ;; weiand: changed: day ends with .
-;;old   (dd "[ 0-3][0-9]")
-        (dd "[ 0-3][0-9][.]?")
-        (western (concat "\\(" month s dd "\\|" dd s month "\\)"))
-        (japanese (concat mm k s dd k)))
-        ;; Require the previous column to end in a digit.
-        ;; This avoids recognizing `1 may 1997' as a date in the line:
-        ;; -r--r--r--   1 may      1997        1168 Oct 19 16:49 README
-        ;; albinus:
-         ;; Require also the following column to start in a digit.
-        ;; This avoids recognizing `kfs 10' as a date in the line:
-        ;; -rw-------   1 kfs                    10 May 27  2003 .autorun.lck
-;;  (concat "[0-9]" s "\\(" western "\\|" japanese "\\)" s))
-    (concat "[0-9]" s "\\(" western "\\|" japanese "\\)" s "+[0-9]"))
-  "Regular expression to match up to the column before the file name in a
-directory listing.  This regular expression is designed to recognize dates
-regardless of the language.")
-
 (defvar ange-ftp-add-file-entry-alist nil
   "Alist saying how to add file entries on certain OS types.
 Association list of pairs \( TYPE \. FUNC \), where FUNC
@@ -2730,13 +2700,8 @@ The main reason for this alist is to deal with file versions in VMS.")
   ;;Extract the filename from the current line of a dired-like listing.
   `(let ((eol (progn (end-of-line) (point))))
      (beginning-of-line)
-     (if (re-search-forward ange-ftp-date-regexp eol t)
-         (progn
-           (skip-chars-forward " ")
-           (skip-chars-forward "^ " eol)
-           (skip-chars-forward " " eol)
-           ;; We bomb on filenames starting with a space.
-           (buffer-substring (point) eol)))))
+     (if (re-search-forward directory-listing-before-filename-regexp eol t)
+        (buffer-substring (point) eol))))
 
 ;; This deals with the F switch. Should also do something about
 ;; unquoting names obtained with the SysV b switch and the GNU Q
@@ -2851,7 +2816,7 @@ match subdirectories as well.")
       ;; (3) The twilight zone.
       ;; We'll assume (1) for now.
       nil)
-     ((re-search-forward ange-ftp-date-regexp nil t)
+     ((re-search-forward directory-listing-before-filename-regexp nil t)
       (beginning-of-line)
       (ange-ftp-ls-parser switches))
      ((re-search-forward "^[^ \n\t]+ +\\([0-9]+\\|-\\|=\\) " nil t)
@@ -5532,7 +5497,7 @@ Other orders of $ and _ seem to all work just fine.")
   (let ((tbl (make-hash-table :test 'equal)))
     (goto-char (point-min))
     (save-match-data
-      (while (re-search-forward ange-ftp-date-regexp nil t)
+      (while (re-search-forward directory-listing-before-filename-regexp nil t)
        (end-of-line)
        (skip-chars-backward " ")
        (let ((end (point)))
index f7afbedc3548aeeae6aeb27cbaae98aae5c76f82..fc743f4962af7aec84cb16be64d5005115aac4ad 100644 (file)
@@ -2061,10 +2061,10 @@ There is a special command, `*l', to mark all files currently locked."
   ;; when vc-dired-mode-map is initialized.
   (set-keymap-parent vc-dired-mode-map dired-mode-map)
   (add-hook 'dired-after-readin-hook 'vc-dired-hook nil t)
-  ;; The following is slightly modified from dired.el,
+  ;; The following is slightly modified from files.el,
   ;; because file lines look a bit different in vc-dired-mode
   ;; (the column before the date does not end in a digit).
-  (set (make-local-variable 'dired-move-to-filename-regexp)
+  (set (make-local-variable 'directory-listing-before-filename-regexp)
   (let* ((l "\\([A-Za-z]\\|[^\0-\177]\\)")
          ;; In some locales, month abbreviations are as short as 2 letters,
          ;; and they can be followed by ".".
index 5a2741177e2d676df25ee61e35d9233bc145ccc1..0a225d2f93f2e4e36a00d2b953a8d30fcb91dce5 100644 (file)
@@ -1,3 +1,9 @@
+2005-10-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * faq.texi (Bugs and problems): Replace
+       `dired-move-to-filename-regexp' by
+       `directory-listing-before-filename-regexp'.
+
 2005-10-22  Eli Zaretskii  <eliz@gnu.org>
 
        * newsticker.texi (UPDATED): Set value.
index 1212ed87d8e428bce666e2386d1ab5e8516f1c72..4ac0bdc979c074dc59702b126067b68fa31f2be1 100644 (file)
@@ -3228,7 +3228,7 @@ setting things up so that @samp{ls -l} outputs US date format.  This can
 be done by setting the locale.  See your OS manual for more information.
 
 The second approach involves changing the regular expression used by
-dired, @code{dired-move-to-filename-regexp}.
+dired, @code{directory-listing-before-filename-regexp}.
 
 @c ------------------------------------------------------------
 @node Compiling and installing Emacs, Finding Emacs and related packages, Bugs and problems, Top
@@ -4634,7 +4634,7 @@ keymaps.
 
 However, in the specific case of @kbd{C-h} and @key{DEL}, you should
 toggle @code{normal-erase-is-backspace-mode} instead of calling
-@code{keyboard-translate}.  @inforef{DEL Does Not Delete, DEL Does Not Delete, 
+@code{keyboard-translate}.  @inforef{DEL Does Not Delete, DEL Does Not Delete,
 emacs}.
 
 Keyboard translations are not the same as key bindings in keymaps.