summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog16
-rw-r--r--lisp/dired-x.el2
-rw-r--r--lisp/dired.el71
-rw-r--r--lisp/files.el51
-rw-r--r--lisp/locate.el6
-rw-r--r--lisp/net/ange-ftp.el43
-rw-r--r--lisp/vc.el4
-rw-r--r--man/ChangeLog6
-rw-r--r--man/faq.texi4
9 files changed, 99 insertions, 104 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e15a3b6ef6a..e3e7f75b5e6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 8ce5e5d48d0..50c52f0ab6b 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -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
diff --git a/lisp/dired.el b/lisp/dired.el
index 3934fe4e433..3cc83b29fdd 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -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."
;;; 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
diff --git a/lisp/files.el b/lisp/files.el
index 89ff4da76a6..4373738080a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -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)
diff --git a/lisp/locate.el b/lisp/locate.el
index 390e0ec72b3..5b61ed522e9 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -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)
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index f50ca07a488..758346e3647 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -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)))
diff --git a/lisp/vc.el b/lisp/vc.el
index f7afbedc354..fc743f4962a 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -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 ".".
diff --git a/man/ChangeLog b/man/ChangeLog
index 5a2741177e2..0a225d2f93f 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -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.
diff --git a/man/faq.texi b/man/faq.texi
index 1212ed87d8e..4ac0bdc979c 100644
--- a/man/faq.texi
+++ b/man/faq.texi
@@ -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.