annotate lisp/efs/efs-mts.el @ 98:0d2f883870bc r20-1b1

Import from CVS: tag r20-1b1
author cvs
date Mon, 13 Aug 2007 09:13:56 +0200
parents 8fc7fe29b841
children 8b8b7f3559a2
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-mts.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
5 ;; Release: $efs release: 1.15 $
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
6 ;; Version: $Revision: 1.1 $
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: MTS support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9 ;; Author: Sandy Rutherford <sandy@itp.ethz.ch>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Created: Fri Oct 23 08:51:29 1992
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11 ;; Modified: Sun Nov 27 18:37:18 1994 by sandy on gandalf
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
12 ;; Language: Emacs-Lisp
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
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
16 ;;; This file is part of efs. See efs.el for copyright
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
17 ;;; (it's copylefted) and warrranty (there isn't one) information.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
18
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
19 (provide 'efs-mts)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20 (require 'efs)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
21
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
22 (defconst efs-mts-version
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
23 (concat (substring "$efs release: 1.15 $" 14 -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
24 "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
25 (substring "$Revision: 1.1 $" 11 -2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
26
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
27 ;;;; ------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
28 ;;;; MTS support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
29 ;;;; ------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
30
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31 ;;; efs has full support, including tree dired support, for hosts running
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 ;;; the Michigan terminal system. It should be able to automatically
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33 ;;; recognize any MTS machine. We would be grateful if you
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 ;;; would report any failures to automatically recognize a MTS host as a bug.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 ;;; Filename syntax:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
37 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
38 ;;; MTS filenames are entered in a UNIX-y way. For example, if your account
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 ;;; was YYYY, the file FILE in the account XXXX: on mtsg.ubc.ca would be
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 ;;; entered as
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 ;;; /YYYY@mtsg.ubc.ca:/XXXX:/FILE
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42 ;;; In other words, MTS accounts are treated as UNIX directories. Of course,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 ;;; to access a file in another account, you must have access permission for
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;;; it. If FILE were in your own account, then you could enter it in a
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45 ;;; relative path fashion as
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 ;;; /YYYY@mtsg.ubc.ca:FILE
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 ;;; MTS filenames can be up to 12 characters. Like UNIX, the structure of the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;;; filename does not contain a TYPE (i.e. it can have as many "."'s as you
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49 ;;; like.) MTS filenames are always in upper case, and hence be sure to enter
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 ;;; them as such! MTS is not case sensitive, but an EMACS running under UNIX
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;;; is.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 (defconst efs-mts-date-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 " \\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|Sep\\|Oct"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57 "\\|Nov\\|Dec\\) [ 123]?[0-9] "))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 ;;; The following two functions are entry points to this file.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 ;;; They are put into the appropriate alists in efs.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 (efs-defun efs-fix-path mts (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 ;; Convert PATH from UNIX-ish to MTS.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 ;; If REVERSE given then convert from MTS to UNIX-ish.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 (if reverse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 (if (string-match "^\\([^:]+:\\)?\\(.*\\)$" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 (let (acct file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 (if (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70 (setq acct (substring path 0 (match-end 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 (if (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 (setq file (substring path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73 (match-beginning 2) (match-end 2))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74 (concat (and acct (concat "/" acct "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 (error "path %s didn't match" path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 (if (string-match "^/\\([^:]+:\\)/\\(.*\\)$" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 (concat (substring path 1 (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 (substring path (match-beginning 2) (match-end 2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80 ;; Let's hope that mts will recognize it anyway.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 (efs-defun efs-fix-dir-path mts (dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 ;; Convert path from UNIX-ish to MTS ready for a DIRectory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85 ;; Remember that there are no directories in MTS.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 (if (string-equal dir-path "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 (error "Cannot get listing for fictitious \"/\" directory.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 (let ((dir-path (efs-fix-path 'mts dir-path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 ((string-equal dir-path "")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 "?")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 ((efs-save-match-data (string-match ":$" dir-path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93 (concat dir-path "?"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 (dir-path))))) ; It's just a single file.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 (efs-defun efs-parse-listing mts
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
99 ;; Parse the current buffer which is assumed to be in
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 ;; mts ftp dir format.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 ;; DIR = remote directory as a remote full path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 ;; PATH = directory as an efs full path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
105 ;; SWITCHES are never used here, but they
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
106 ;; must be specified in the argument list for compatibility
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107 ;; with the unix version of this function.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 perms)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 (while (re-search-forward efs-mts-date-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114 (if (looking-at "[rwed]+")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 (setq perms (buffer-substring (match-beginning 0) (match-end 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 (setq perms nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 (end-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 (skip-chars-backward " ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119 (let ((end (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 (skip-chars-backward "-A-Z0-9_.!")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 (efs-put-hash-entry (buffer-substring (point) end)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 (list nil nil nil perms) tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 (forward-line 1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 ;; Don't need to bother with ..
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 (efs-defun efs-allow-child-lookup mts (host user dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 ;; Returns t if FILE in directory DIR could possibly be a subdir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 ;; according to its file-name syntax, and therefore a child listing should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 ;; be attempted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 ;; MTS file system is flat. Only "accounts" are subdirs.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134 (string-equal "/" dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 (efs-defun efs-internal-file-writable-p mts (user owner modes)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 (if (stringp modes)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 (null (null (string-match "w" modes))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140 t)) ; guess
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 (efs-defun efs-internal-file-readable-p mts (user owner modes)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 (if (stringp modes)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 (null (null (string-match "r" modes))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146 t)) ; guess
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 ;;; Tree dired support:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 ;; There aren't too many systems left that use MTS. This dired support will
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 ;; work for the implementation of ftp on mtsg.ubc.ca. I hope other mts systems
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 ;; implement ftp in the same way. If not, it might be necessary to make the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153 ;; following more flexible.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155 (defconst efs-dired-mts-re-exe nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157 (or (assq 'mts efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159 (cons (cons 'mts efs-dired-mts-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162 (defconst efs-dired-mts-re-dir nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 (or (assq 'mts efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166 (cons (cons 'mts efs-dired-mts-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169 (efs-defun efs-dired-manual-move-to-filename mts
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 ;; In dired, move to first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 ;; Returns position (point) or nil if no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 ;; This is the MTS version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174 (or eol (setq eol (save-excursion (skip-chars-forward "^\n\r") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
177 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
178 (if (re-search-forward efs-mts-date-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
179 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
180 (skip-chars-forward " ") ; Eat blanks after date
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
181 (skip-chars-forward "0-9:") ; Eat time or year
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
182 (skip-chars-forward " ") ; one space before filename
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
183 (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
184 (and raise-error (error "No file on this line"))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
185
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
186 (efs-defun efs-dired-manual-move-to-end-of-filename mts
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
187 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
188 ;; Assumes point is at beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
189 ;; So, it should be called only after (dired-move-to-filename t).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
190 ;; On failure, signals an error or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
191 ;; This is the MTS version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
192 (let ((opoint (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
193 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
194 (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
195 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
196 (1- (or bol (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
197 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
198 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
199 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
200 ;; File is hidden or omitted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
201 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
202 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
203 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
204 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
205 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
206 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
207 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
208 "File line is omitted. Type \\[dired-omit-toggle] to un-omit."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
209 )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
210 (skip-chars-forward "-A-Z0-9._!")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
211 (if (or (= opoint (point)) (not (memq (following-char) '(?\r ?\n))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
212 (if no-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
213 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
214 (error "No file on this line"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
215 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
216
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
217 (efs-defun efs-dired-fixup-listing mts (file path &optional switches wildcard)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
218 ;; If you're not listing your own account, MTS puts the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
219 ;; account name in front of each filename. Scrape them off.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
220 ;; PATH will have unix /'s on it.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
221 ;; file-name-directory is in case of wildcards
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
222 (let ((len (length path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
223 (if (> len 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
224 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
225 (if (= (aref path (1- len)) ?/)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
226 (setq path (substring path -2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
227 (setq path (substring path -1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
228 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
229 (while (search-forward path nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
230 (delete-region (match-beginning 0) (match-end 0)))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
231
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
232 (efs-defun efs-dired-insert-headerline mts (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
233 ;; MTS has no total line, so we insert a blank line for
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
234 ;; aesthetics.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
235 (insert "\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
236 (forward-char -1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
237 (efs-real-dired-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
238
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
239 ;;; end of efs-mts.el