changeset 66325:fda96ff4c7e5

* 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'. * faq.texi (Bugs and problems): Replace `dired-move-to-filename-regexp' by `directory-listing-before-filename-regexp'.
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 23 Oct 2005 12:17:28 +0000
parents 3ef412c92565
children f838f175603c
files 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
diffstat 9 files changed, 99 insertions(+), 104 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Oct 23 09:45:44 2005 +0000
+++ b/lisp/ChangeLog	Sun Oct 23 12:17:28 2005 +0000
@@ -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
--- a/lisp/dired-x.el	Sun Oct 23 09:45:44 2005 +0000
+++ b/lisp/dired-x.el	Sun Oct 23 12:17:28 2005 +0000
@@ -1517,7 +1517,7 @@
               ;; 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
--- a/lisp/dired.el	Sun Oct 23 09:45:44 2005 +0000
+++ b/lisp/dired.el	Sun Oct 23 12:17:28 2005 +0000
@@ -842,16 +842,17 @@
   ;; 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 @@
 	(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 @@
 
 ;;; 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 @@
     (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
--- a/lisp/files.el	Sun Oct 23 09:45:44 2005 +0000
+++ b/lisp/files.el	Sun Oct 23 12:17:28 2005 +0000
@@ -4475,6 +4475,57 @@
 		  (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)
 
--- a/lisp/locate.el	Sun Oct 23 09:45:44 2005 +0000
+++ b/lisp/locate.el	Sun Oct 23 12:17:28 2005 +0000
@@ -376,13 +376,13 @@
   (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)
--- a/lisp/net/ange-ftp.el	Sun Oct 23 09:45:44 2005 +0000
+++ b/lisp/net/ange-ftp.el	Sun Oct 23 12:17:28 2005 +0000
@@ -2666,36 +2666,6 @@
 ;;;; 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 @@
   ;;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 @@
       ;; (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 @@
   (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)))
--- a/lisp/vc.el	Sun Oct 23 09:45:44 2005 +0000
+++ b/lisp/vc.el	Sun Oct 23 12:17:28 2005 +0000
@@ -2061,10 +2061,10 @@
   ;; 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 ".".
--- a/man/ChangeLog	Sun Oct 23 09:45:44 2005 +0000
+++ b/man/ChangeLog	Sun Oct 23 12:17:28 2005 +0000
@@ -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.
--- a/man/faq.texi	Sun Oct 23 09:45:44 2005 +0000
+++ b/man/faq.texi	Sun Oct 23 12:17:28 2005 +0000
@@ -3228,7 +3228,7 @@
 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 @@
 
 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.