annotate lisp/efs/efs-ti-twenex.el @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents
children 8b8b7f3559a2 8619ce7e4c50
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-ti-twenex.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: Support for a TI lisp machine in Twenex emulation mode.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9 ;; Author: Jamie Zawinski <jwz@lucid.com>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Created: Thu Dec 17 15:04:14 1992
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11 ;; Modified: Sun Nov 27 18:43:17 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-ti-twenex)
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-ti-twenex-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 ;;;; Twenex 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 ;;; Written for an explorer in ti-twenex mode. Twenex is supposed to be just
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31 ;;; MIT's name for tops-20, but an explorer emulating twenex is not the same
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 ;;; thing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 (defconst efs-ti-twenex-filename-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35 (let* ((excluded-chars ":;<>.#\n\r\ta-z")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 (token (concat "[^" excluded-chars "]+"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
37 (token* (concat "[^" excluded-chars "]*")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
38 (concat "\\(" token ": *" "\\)?" ; optional device
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 "<\\(" token "\\)?\\(\\." token "\\)*> *" ; directory
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 "\\(" token* "." token* "\\|\\) *" ; name and extension
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 "\\(\\. *-?\\([0-9]+\\|>\\)\\)?"))) ; version
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 ;;; The above isn't entirely accurate, because "/" can quote any character
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;;; anywhere in a pathname.
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-fix-path ti-twenex (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 ;; Convert PATH from UNIX-ish to Twenex. If REVERSE given then convert
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;; from Twenex to UNIX-ish.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 (if reverse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 (if (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52 "^\\([^:]+:\\)? *\\([^:]+:\\)? *<\\([^>]*\\)> *\\(.*\\)$"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 (let (dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 ;; I don't understand how "devices" work, so I'm ignoring them.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 ;; (if (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57 ;; (setq device (substring path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 ;; (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 ;; (1- (match-end 2)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 (if (match-beginning 3)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61 (setq dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 (substring path (match-beginning 3) (match-end 3))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 (if (match-beginning 4)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 (setq file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 (substring path (match-beginning 4) (match-end 4))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 (cond (dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 (setq dir (apply (function concat)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 (mapcar (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 (lambda (char)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70 (if (= char ?.)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 (vector ?/)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 (vector char))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73 dir)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74 (if (string-match "^/" dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 (setq dir (substring dir 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 (setq dir (concat "/" dir)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 ;; (and device ":") device (and device ":")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 dir (and dir "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80 file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 (error "path %s didn't match ti-twenex syntax" path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82 (let (dir file tmp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 ;; (if (string-match "^/[^:]+:" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 ;; (setq device (substring path 1
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85 ;; (1- (match-end 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 ;; path (substring path (match-end 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 (cond ((setq tmp (file-name-directory path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 (setq dir (apply (function concat)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 (mapcar (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 (lambda (char)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 (if (= char ?/)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 (vector ?.)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93 (vector char))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 (substring tmp 0 -1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 (if (string-match "^[.]" dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96 (setq dir (substring dir 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 (setq dir (concat "." dir)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98 (setq file (file-name-nondirectory path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
99 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 ;; (and device ":") device (and device ":")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101 (and dir "<")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102 dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 (and dir ">")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 file)))))
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-fix-path-for-twenex "/PUBLIC/ZMACS/ZYMURG.LISP.1")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107 ;; (efs-fix-path-for-twenex "<PUBLIC.ZMACS>ZYMURG.LISP.1" t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 (efs-defun efs-fix-dir-path ti-twenex (dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 ;; Convert path from UNIX-ish to Explorer ready for a DIRectory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111 (cond ((string-equal dir-path "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 (efs-fix-path 'ti-twenex "/~/" nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 ((string-match "^/[-A-Z0-9_$]+:/" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114 (error "Don't grok TWENEX \"devices\" yet."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 ((efs-fix-path 'ti-twenex dir-path nil))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 (defmacro efs-parse-ti-twenex-filename ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 ;; Extract the next filename from an Explorer dired-like listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119 (` (if (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 efs-ti-twenex-filename-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 (buffer-substring (match-beginning 0) (match-end 0)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 (efs-defun efs-parse-listing ti-twenex
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 ;; Parse the current buffer which is assumed to be a TWENEX directory
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 ;; listing, and return a hashtable as the result.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 ;; USER = user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 ;; DIR = directory in as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 ;; PATH = directory in full efs path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 ;; SWITCHES = ls switches (not relevant here)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134 file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 (while (setq file (efs-parse-ti-twenex-filename))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 ;; Explorer/Twenex listings might come out in absolute form.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 (if (string-match "^[^>]*> *" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140 (setq file (substring file (match-end 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141 (if (string-match "\\.\\(DIRECTORY\\|directory\\).[0-9]+$" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 ;; deal with directories
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 (substring file 0 (match-beginning 0)) '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 (efs-put-hash-entry file '(nil) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146 (if (string-match "\\.[0-9]+$" file) ; deal with extension
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 ;; sans extension
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149 (substring file 0 (match-beginning 0)) '(nil) tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 (efs-put-hash-entry ".." '(t) tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153 tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155 (efs-defun efs-really-file-p ti-twenex (file ent)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156 ;; Eliminates the version entries
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157 (or (car ent) ; file-directory-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159 (string-match "\\.[0-9]+$" file))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161 (efs-defun efs-delete-file-entry ti-twenex (path &optional dir-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162 (let ((ignore-case (memq 'ti-twenex efs-case-insensitive-host-types)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163 (if dir-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 (let ((path (file-name-as-directory path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165 files)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166 (efs-del-hash-entry path efs-files-hashtable ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167 (setq path (directory-file-name path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168 files (efs-get-hash-entry (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169 efs-files-hashtable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 ignore-case))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 (efs-del-hash-entry (efs-get-file-part path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 files ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 (let ((file (efs-get-file-part path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176 (if (string-match "\\.[0-9]+$" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
177 ;; Only delete versions with explicit version numbers.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
178 (let ((files (efs-get-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
179 (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
180 efs-files-hashtable ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
181 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
182 (let ((root (substring file 0
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
183 (match-beginning 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
184 (completion-ignore-case ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
185 (len (match-beginning 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
186 (efs-del-hash-entry file files ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
187 ;; Now we need to check if there are any
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
188 ;; versions left. If not, then delete the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
189 ;; root entry.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
190 (or (all-completions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
191 root files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
192 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
193 (lambda (sym)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
194 (string-match "\\.[0-9]+$"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
195 (symbol-name sym) len))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
196 (efs-del-hash-entry root files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
197 ignore-case)))))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
198 (efs-del-from-ls-cache path t ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
199
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
200 (efs-defun efs-add-file-entry ti-twenex
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
201 (path dir-p size owner &optional modes nlinks mdtm)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
202 ;; The ti-twenex version of this function needs to keep track
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
203 ;; of ti-twenex's file versions.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
204 (let ((ignore-case (memq 'ti-twenex efs-case-insensitive-host-types))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
205 (ent (let ((dir-p (null (null dir-p))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
206 (if mdtm
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
207 (list dir-p size owner nil nil mdtm)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
208 (list dir-p size owner)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
209 (if dir-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
210 (let* ((path (directory-file-name path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
211 (files (efs-get-hash-entry (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
212 efs-files-hashtable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
213 ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
214 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
215 (efs-put-hash-entry (efs-get-file-part path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
216 ent files ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
217 (let ((files (efs-get-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
218 (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
219 efs-files-hashtable ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
220 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
221 (let ((file (efs-get-file-part path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
222 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
223 (if (string-match "\\.[0-9]+$" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
224 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
225 (substring file 0 (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
226 ent files ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
227 ;; Need to figure out what version of the file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
228 ;; is being added.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
229 (let* ((completion-ignore-case ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
230 (len (length file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
231 (versions (all-completions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
232 file files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
233 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
234 (lambda (sym)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
235 (string-match "\\.[0-9]+$"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
236 (symbol-name sym) len)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
237 (N (1+ len))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
238 (max (apply
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
239 'max
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
240 (cons 0 (mapcar
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
241 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
242 (lambda (x)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
243 (string-to-int (substring x N))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
244 versions)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
245 ;; No need to worry about case here.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
246 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
247 (concat file "." (int-to-string (1+ max))) ent files))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
248 (efs-put-hash-entry file ent files ignore-case)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
249 (efs-del-from-ls-cache path t ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
250
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
251 (efs-defun efs-internal-file-name-as-directory ti-twenex (name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
252 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
253 (if (string-match "\\.\\(DIRECTORY\\|directory\\)\\(\\.[0-9>]\\)?$" name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
254 (setq name (substring name 0 (match-beginning 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
255 (let (file-name-handler-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
256 (file-name-as-directory name))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
257
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
258 (efs-defun efs-allow-child-lookup ti-twenex (host user dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
259 ;; Returns t if FILE in directory DIR could possibly be a subdir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
260 ;; according to its file-name syntax, and therefore a child listing should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
261 ;; be attempted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
262
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
263 ;; Subdirs in TI-TWENEX can't have an extension (other than .DIRECTORY,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
264 ;; which we have truncated).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
265 (not (string-match "\\." file)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
266
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
267 ;;; Tree Dired
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
268
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
269 (defconst efs-dired-ti-twenex-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
270 "^. *[^>\n\r]+>[^>\n\r.]+\\.\\(DIRECTORY\\|directory\\)\\b"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
271 "Regular expression to use to search for TWENEX directories.")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
272
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
273 (or (assq 'ti-twenex efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
274 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
275 (cons (cons 'ti-twenex efs-dired-ti-twenex-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
276 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
277
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
278 (efs-defun efs-dired-manual-move-to-filename ti-twenex
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
279 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
280 ;; In dired, move to first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
281 ;; Returns position (point) or nil if no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
282 ;; This is the Twenex version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
283 (or eol (setq eol (save-excursion (skip-chars-forward "^\n\r") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
284 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
285 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
286 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
287 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
288 (if (re-search-forward efs-ti-twenex-filename-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
289 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
290 (goto-char (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
291 ;; Twenex listings might come out in absolute form.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
292 (if (looking-at "[^>]*> *")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
293 (goto-char (match-end 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
294 (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
295 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
296
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
297 (efs-defun efs-dired-manual-move-to-end-of-filename ti-twenex
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
298 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
299 ;; Assumes point is at beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
300 ;; So, it should be called only after (dired-move-to-filename t).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
301 ;; On failure, signals an error or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
302 ;; This is the Explorer version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
303 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
304 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
305 (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
306 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
307 (1- (or bol (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
308 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
309 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
310 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
311 ;; File is hidden or omitted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
312 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
313 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
314 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
315 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
316 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
317 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
318 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
319 "File line is omitted. Type \\[dired-omit-toggle] to un-omit."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
320 )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
321 (if (looking-at efs-ti-twenex-filename-regexp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
322 (goto-char (match-end 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
323 (if no-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
324 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
325 (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
326
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
327 (efs-defun efs-internal-file-name-sans-versions ti-twenex
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
328 (name &optional keep-backup-version)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
329 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
330 (if (string-match "\\.[0-9]+$" name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
331 (substring name 0 (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
332 name)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
333
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
334 ;;; ### still need to ape these from vms:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
335 ;;; efs-dired-vms-clean-directory
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
336 ;;; efs-dired-vms-collect-file-versions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
337 ;;; efs-dired-vms-trample-file-versions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
338 ;;; efs-dired-vms-flag-backup-files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
339 ;;; efs-dired-vms-backup-diff
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
340
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
341 ;;; end of efs-ti-twenex.el