bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Patch for ange-ftp/dired for Chinese


From: Georges Ko
Subject: Patch for ange-ftp/dired for Chinese
Date: 28 Jul 2001 00:38:57 +0800
User-agent: Gnus/5.090003 (Oort Gnus v0.03) Emacs/20.7

    Hello,

    In some Unix servers I use, locales are set to Chinese, which
affect the output of ftp commands and break ange-ftp and dired. Here's
a patch for Chinese on HP-UX so that ange-ftp and dired work
correctly:

ange-ftp.el diff (ange-ftp_.el is from Emacs 20.7):

------------------------------------8<------------------------------------
*** ange-ftp_.el        Sat Jul 28 00:03:52 2001
--- ange-ftp.el Sat Jul 28 00:08:14 2001
***************
*** 2543,2553 ****
         (mm "[ 0-1][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
!     (concat "[0-9]" s "\\(" western "\\|" japanese "\\)" s))
    "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.")
--- 2543,2554 ----
         (mm "[ 0-1][0-9]")
         (dd "[ 0-3][0-9]")
         (western (concat "\\(" month s dd "\\|" dd s month "\\)"))
!        (japanese (concat mm k s dd k))
!        (chinese "1?[0-9]. [ 1-3]?[0-9].")) ;; -> dired-move-to-filename-regexp
         ;; 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
!     (concat "[0-9]" s "\\(" western "\\|" japanese "\\|"  chinese  "\\)" s))
    "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.")
***************
*** 2695,2701 ****
  (defun ange-ftp-parse-dired-listing (&optional switches)
    (save-match-data
      (cond
!      ((looking-at "^total [0-9]+$")
        (forward-line 1)
        ;; Some systems put in a blank line here.
        (if (eolp) (forward-line 1))
--- 2696,2702 ----
  (defun ange-ftp-parse-dired-listing (&optional switches)
    (save-match-data
      (cond
!      ((looking-at "^\\(total [0-9]+$\\|.* [0-9]+[ ].*$\\)") ;; XXX number YYY
        (forward-line 1)
        ;; Some systems put in a blank line here.
        (if (eolp) (forward-line 1))
------------------------------------8<------------------------------------

dired.el diff (dired_.el is from Emacs 20.7):

------------------------------------8<------------------------------------
*** dired_.el   Sat Jul 28 00:09:28 2001
--- dired.el    Sat Jul 28 00:10:56 2001
*************** Hooks (use \\[describe-variable] to see 
*** 1375,1388 ****
           ;; weiand: changed: year potentially unaligned
  ;;old                   s "\\(" HH:MM "\\|" s yyyy "\\|" yyyy s "\\)"))
                          s "\\(" HH:MM "\\|" s "?" yyyy "\\|" yyyy s "\\)"))
!        (japanese (concat mm k s dd k s "\\(" s HH:MM "\\|" yyyy k "\\)")))
         ;; 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 ".*" 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]" s "\\(" western "\\|" japanese "\\)" 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.")
--- 1375,1397 ----
           ;; weiand: changed: year potentially unaligned
  ;;old                   s "\\(" HH:MM "\\|" s yyyy "\\|" yyyy s "\\)"))
                          s "\\(" HH:MM "\\|" s "?" yyyy "\\|" yyyy s "\\)"))
!        (japanese (concat mm k s dd k s "\\(" s HH:MM "\\|" yyyy k "\\)"))
!        ;; Chinese date formats: monthX dayY           (day >= 10)
!        ;;                       monthX  dayY          (day <   9)
!        ;; - X and Y are Chinese characters for month (yue) and day (ri)
!        (chinese-month "[0-9]+.")
!        (chinese-day "[ ]?[0-9]+.")
!        (chinese (concat "\\(" chinese-month s chinese-day s yyyy
!                         "\\|" chinese-month s chinese-day s HH:MM
!                         "\\)")))
         ;; 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 ".*" 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]" s "\\(" western "\\|" japanese ;;"\\)"  s)))
!                "\\|"  chinese "\\)" 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.")
------------------------------------8<------------------------------------

ChangeLog entry:

------------------------------------8<------------------------------------
2001-07-28  Georges Ko  <gko@gko.net>

        * ange-ftp.el (ange-ftp-date-regexp, 
        ange-ftp-parse-dired-listing): supports Chinese dates.

        * dired.el (dired-move-to-filename-regexp): supports Chinese dates.
------------------------------------8<------------------------------------

    Georges.
-- 
 Georges Ko (Taipei, Taiwan)      2001-07-28      gko@gko.net / ICQ: 8719684
                                                      Samedi 28 juillet 2001



reply via email to

[Prev in Thread] Current Thread [Next in Thread]