annotate lisp/efs/efs-dos-distinct.el @ 51:69ce12f60f55

Added tag r19-16b91 for changeset ee648375d8d6
author cvs
date Mon, 13 Aug 2007 08:56:44 +0200
parents 8b8b7f3559a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
1 ;; -*-Emacs-Lisp-*-
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
3 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
4 ;; File: efs-dos-distinct.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
5 ;; Release: $efs release: 1.15 $
42
8b8b7f3559a2 Import from CVS: tag r19-15b104
cvs
parents: 22
diff changeset
6 ;; Version: #Revision: 1.1 $
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
7 ;; RCS:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
8 ;; Description: Distinct's DOS FTP server support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9 ;; Author: Sandy Rutherford <sandy@tsmi19.sissa.it>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Created: Fri Jan 15 22:20:32 1993 by sandy on ibm550
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11 ;; Modified: Sun Nov 27 18:30:04 1994 by sandy on gandalf
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
12 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
13 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
14
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
15 ;;; This file is part of efs. See efs.el for copyright
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
16 ;;; (it's copylefted) and warrranty (there isn't one) information.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
17
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
18 ;;; Thanks to Rodd Zurcher <rbz@hook.corp.mot.com> for beta testing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
19
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20 (provide 'efs-dos-distinct)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
21 (require 'efs)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
23 (defconst efs-dos-distinct-version
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
24 (concat (substring "$efs release: 1.15 $" 14 -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
25 "/"
42
8b8b7f3559a2 Import from CVS: tag r19-15b104
cvs
parents: 22
diff changeset
26 (substring "#Revision: 1.1 $" 11 -2)))
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
27
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
28 ;;;; -----------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
29 ;;;; Distinct's DOS FTP server support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
30 ;;;; -----------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 ;;; This is not included in efs-dos.el with the support for the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33 ;;; other dos ftp servers, because the Distinct server uses unix syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 ;;; for path names.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 ;; This is defined in efs.el, but we put it here too.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
37
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
38 (defconst efs-dos-distinct-date-and-time-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 " \\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 "\\|Nov\\|Dec\\) [ 0-3][0-9],[12][90][0-9][0-9] "
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42 "[ 12][0-9]:[0-5][0-9] "))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;;; entry point
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 (efs-defun efs-parse-listing dos-distinct
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;; Parse the current buffer which is assumed to be a listing from
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49 ;; Distinct's DOS FTP server. Both empty dirs, and ls errors return
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 ;; empty buffers.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 ;; DIR = remote directory as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 ;; PATH = directory in full efs-path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57 (if (re-search-forward efs-dos-distinct-date-and-time-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 dir-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61 (while (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 (setq dir-p (eq (following-char) ?d)) ; we're bolp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 efs-dos-distinct-date-and-time-regexp nil t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 (efs-put-hash-entry (buffer-substring (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 (progn (end-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 (list dir-p) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 tbl))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74 (efs-defun efs-allow-child-lookup dos-distinct (host user dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 ;; Returns t if FILE in directory DIR could possibly be a subdir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 ;; according to its file-name syntax, and therefore a child listing should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 ;; be attempted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 ;; Subdirs in DOS can't have an extension.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 (not (string-match "\\." file)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 ;;; Tree Dired
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 (defconst efs-dired-dos-distinct-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 "^[^\n]+\\.exe$")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 (or (assq 'dos-distinct efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 (cons (cons 'dos-distinct efs-dired-dos-distinct-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 (defconst efs-dired-dos-distinct-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 "^. [ \t]*d")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 (or (assq 'dos-distinct efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96 (cons (cons 'dos-distinct efs-dired-dos-distinct-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
99 (efs-defun efs-dired-insert-headerline dos-distinct (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 ;; The Distinct DOS server has no total line, so we insert a
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101 ;; blank line for aesthetics.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102 (insert "\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 (forward-char -1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 (efs-real-dired-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
105
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
106 (efs-defun efs-dired-manual-move-to-filename dos-distinct
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 ;; In dired, move to the first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 ;; Returns (point) or nil if raise-error is nil, and there is no
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 ;; no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111 ;; This version is for Distinct's DOS FTP server.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 (if (re-search-forward efs-dos-distinct-date-and-time-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 (efs-defun efs-dired-manual-move-to-end-of-filename dos-distinct
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 ;; Assumes point is at the beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 ;; So, it should be called only after (dired-move-to-filename t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 ;; On failure signals an error, or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 ;; This is the version for Distinct's DOS FTP server.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 (let ((opoint (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 (1- (or bol (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 ;; it's hidden or omitted
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 "File line is omitted. Type \\[dired-omit-toggle] to un-omit."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 (skip-chars-forward "-_+=a-z0-9.$")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146 (if (or (= opoint (point)) (not (memq (following-char) '(\n \r))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 (if no-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149 (error "No file on this line"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 ;;; end of efs-dos-distinct.el