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

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents
children 7e54bd776075 9f59509498e1
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-vms.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: VMS support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9 ;; Authors: Andy Norman, Joe Wells, Sandy Rutherford <sandy@itp.ethz.ch>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Modified: Sun Nov 27 18:44:59 1994 by sandy on gandalf
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11 ;;
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 ;;; This file is part of efs. See efs.el for copyright
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
15 ;;; (it's copylefted) and warrranty (there isn't one) information.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
16
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
17 (provide 'efs-vms)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
18 (require 'efs)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
19
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20 (defconst efs-vms-version
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
21 (concat (substring "$efs release: 1.15 $" 14 -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
22 "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
23 (substring "$Revision: 1.1 $" 11 -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 ;;;; ------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
26 ;;;; VMS support.
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 ;;; efs has full support for VMS hosts, including tree dired support. It
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
30 ;;; should be able to automatically recognize any VMS machine. However, if it
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31 ;;; fails to do this, you can use the command efs-add-vms-host. As well,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 ;;; you can set the variable efs-vms-host-regexp in your .emacs file. We
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33 ;;; would be grateful if you would report any failures to automatically
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 ;;; recognize a VMS 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 ;;; For ease of *implementation*, the user enters the VMS filename syntax in a
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 ;;; UNIX-y way. For example:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 ;;; PUB$:[ANONYMOUS.SDSCPUB.NEXT]README.TXT;1
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 ;;; would be entered as:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42 ;;; /PUB$$:/ANONYMOUS/SDSCPUB/NEXT/README.TXT;1
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 ;;; i.e. to log in as anonymous on ymir.claremont.edu and grab the file:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 ;;; [.CSV.POLICY]RULES.MEM
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45 ;;; you would type:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 ;;; C-x C-f /anonymous@ymir.claremont.edu:CSV/POLICY/RULES.MEM
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;;; A legal VMS filename is of the form: FILE.TYPE;##
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49 ;;; where FILE can be up to 39 characters
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 ;;; TYPE can be up to 39 characters
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;;; ## is a version number (an integer between 1 and 32,767)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52 ;;; Valid characters in FILE and TYPE are A-Z 0-9 _ - $
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 ;;; $ cannot begin a filename, and - cannot be used as the first or last
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 ;;; character.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 ;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 ;;; Tips:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57 ;;; 1. To access the latest version of file under VMS, you use the filename
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 ;;; without the ";" and version number. You should always edit the latest
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 ;;; version of a file. If you want to edit an earlier version, copy it to a
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 ;;; new file first. This has nothing to do with efs, but is simply
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61 ;;; good VMS operating practice. Therefore, to edit FILE.TXT;3 (say 3 is
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 ;;; latest version), do C-x C-f /ymir.claremont.edu:FILE.TXT. If you
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 ;;; inadvertently do C-x C-f /ymir.claremont.edu:FILE.TXT;3, you will find
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 ;;; that VMS will not allow you to save the file because it will refuse to
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 ;;; overwrite FILE.TXT;3, but instead will want to create FILE.TXT;4, and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 ;;; attach the buffer to this file. To get out of this situation, M-x
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 ;;; write-file /ymir.claremont.edu:FILE.TXT will attach the buffer to
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 ;;; latest version of the file. For this reason, in tree dired "f"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 ;;; (dired-find-file), always loads the file sans version, whereas "v",
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70 ;;; (dired-view-file), always loads the explicit version number. The
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 ;;; reasoning being that it reasonable to view old versions of a file, but
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 ;;; not to edit them.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73 ;;; 2. EMACS has a feature in which it does environment variable substitution
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74 ;;; in filenames. Therefore, to enter a $ in a filename, you must quote it
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 ;;; by typing $$. There is a bug in EMACS, in that it neglects to quote the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 ;;; $'s in the default directory when it writes it in the minibuffer. You
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 ;;; must edit the minibuffer to quote the $'s manually. Hopefully, this bug
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 ;;; will be fixed in EMACS 19. If you use Sebastian Kremer's gmhist (V 4.26
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 ;;; or newer), you will not have this problem.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82 ;; Because some VMS ftp servers convert filenames to lower case
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83 ;; we allow a-z in the filename regexp.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85 (defconst efs-vms-filename-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 "\\([_A-Za-z0-9$][-_A-Za-z0-9$]*\\)?\\.\\([-_A-Za-z0-9$]*\\);[0-9]+")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 ;; Regular expression to match for a valid VMS file name in Dired buffer.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 (defvar efs-vms-month-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 '(("JAN" . 1) ("FEB". 2) ("MAR" . 3) ("APR" . 4) ("MAY" . 5) ("JUN" . 6)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 ("JUL" . 7) ("AUG" . 8) ("SEP" . 9) ("OCT" . 10)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 ("NOV" . 11) ("DEC" . 12)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 (defvar efs-vms-date-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96 "\\([0-3]?[0-9]\\)-"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 "\\(JAN\\|FEB\\|MAR\\|APR\\|MAY\\|JUN\\|"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98 "JUL\\|AUG\\|SEP\\|OCT\\|NOV\\|DEC\\)-"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
99 "\\([0-9][0-9][0-9]?[0-9]?\\) \\(\\([0-5][0-9]\\):\\([0-5][0-9]\\)"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 "\\(:[0-5][0-9]\\)?\\)? "))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 ;;; The following two functions are entry points to this file.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 ;;; They are defined as efs-autoloads in efs.el
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-fix-path vms (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107 ;; Convert PATH from UNIX-ish to VMS.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 ;; If REVERSE given then convert from VMS to UNIX-ish.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 (if reverse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111 (if (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 "^\\([^:]+:\\)?\\(\\[[^]]+\\]\\)?\\([^][]*\\)$" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 (let (drive dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114 (if (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 (setq drive (substring path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 (match-end 1))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 (if (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119 (setq dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 (substring path (match-beginning 2) (match-end 2))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 (if (match-beginning 3)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 (setq file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 (substring path (match-beginning 3) (match-end 3))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 (and dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 (setq dir (apply (function concat)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 (mapcar (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 (lambda (char)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 (if (= char ?.)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 (vector ?/)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 (vector char))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 (substring dir 1 -1)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 (concat (and drive
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 (concat "/" drive "/"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134 dir (and dir "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 (error "path %s didn't match" path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 (let (drive dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 (if (string-match "^/[^:/]+:/" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 (setq drive (substring path 1 (1- (match-end 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140 path (substring path (1- (match-end 0)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141 (setq dir (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 file (efs-internal-file-name-nondirectory path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 (if dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 (let ((len (1- (length dir)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 (n 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146 (if (<= len 0)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 (setq dir nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 (while (<= n len)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149 (and (char-equal (aref dir n) ?/)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 ((zerop n) (aset dir n ?\[))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 ((= n len) (aset dir n ?\]))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153 (t (aset dir n ?.))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154 (setq n (1+ n))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155 (concat drive dir file)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157 ;; It is important that this function barf for directories for which we know
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 ;; that we cannot possibly get a directory listing, such as "/" and "/DEV:/".
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159 ;; This is because it saves an unnecessary FTP error, or possibly the listing
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160 ;; might succeed, but give erroneous info. This last case is particularly
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161 ;; likely for OS's (like MTS) for which we need to use a wildcard in order
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162 ;; to list a directory.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 (efs-defun efs-fix-dir-path vms (dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165 ;; Convert path from UNIX-ish to VMS ready for a DIRectory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166 ;; Should there be entries for .. -> [-] and . -> [] below. Don't
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167 ;; think so, because expand-filename should have already short-circuited
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168 ;; them.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169 (cond ((string-equal dir-path "/")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 (error "Cannot get listing for fictitious \"/\" directory."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 ((string-match "^/[-A-Z0-9_$]+:/$" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 (error "Cannot get listing for device."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 ((efs-fix-path 'vms dir-path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 ;; These parsing functions are as general as possible because the syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176 ;; of ftp listings from VMS hosts is a bit erratic. What saves us is that
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
177 ;; the VMS filename syntax is so rigid. If they bomb on a listing in the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
178 ;; standard VMS Multinet format, then this is a bug. If they bomb on a listing
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
179 ;; from vms.weird.net, then too bad.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
180
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
181 (defmacro efs-parse-vms-filename ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
182 "Extract the next filename from a VMS dired-like listing."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
183 (` (if (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
184 efs-vms-filename-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
185 nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
186 (buffer-substring (match-beginning 0) (match-end 0)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
187
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
188 (defun efs-parse-vms-listing ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
189 ;; Parse the current buffer which is assumed to be a VMS DIR
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
190 ;; listing (either a short (NLIST) or long listing).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
191 ;; Assumes that point is at the beginning of the buffer.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
192 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
193 file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
194 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
195 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
196 (while (setq file (efs-parse-vms-filename))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
197 (if (string-match "\\.\\(DIR\\|dir\\);[0-9]+" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
198 ;; deal with directories
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
199 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
200 (substring file 0 (match-beginning 0)) '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
201 (efs-put-hash-entry file '(nil) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
202 (if (string-match ";[0-9]+$" file) ; deal with extension
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
203 ;; sans extension
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
204 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
205 (substring file 0 (match-beginning 0)) '(nil) tbl)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
206 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
207 ;; Would like to look for a "Total" line, or a "Directory" line to
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
208 ;; make sure that the listing isn't complete garbage before putting
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
209 ;; in "." and "..", but we can't even count on all VAX's giving us
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
210 ;; either of these.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
211 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
212 (efs-put-hash-entry ".." '(t) tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
213 tbl))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
214
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
215 (efs-defun efs-parse-listing vms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
216 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
217 ;; Parse the current buffer which is assumed to be a VMS FTP dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
218 ;; format, and return a hashtable as the result. SWITCHES are never used,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
219 ;; but they must be specified in the argument list for compatibility
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
220 ;; with the unix version of this function.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
221 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
222 ;; USER = user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
223 ;; DIR = directory in as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
224 ;; PATH = directory in full efs path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
225 ;; SWITCHES = ls switches (not relevant here)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
226 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
227 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
228 ;; check for a DIR/FULL monstrosity
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
229 (if (search-forward "\nSize:" nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
230 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
231 (efs-add-listing-type 'vms:full host user)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
232 ;; This will cause the buffer to be refilled with an NLIST
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
233 (let ((efs-ls-uncache t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
234 (efs-ls path nil (format "Relisting %s"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
235 (efs-relativize-filename path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
236 t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
237 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
238 (efs-parse-vms-listing))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
239 (efs-parse-vms-listing))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
240
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
241
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
242 ;;;; Sorting of listings
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
243
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
244 (efs-defun efs-t-converter vms (&optional regexp reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
245 (if regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
246 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
247 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
248 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
249 (if (re-search-forward efs-vms-filename-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
250 (let (list-start start end list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
251 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
252 (setq list-start (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
253 (while (and (looking-at efs-vms-filename-regexp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
254 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
255 (setq start (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
256 (goto-char (match-end 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
257 (forward-line (if (eolp) 2 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
258 (setq end (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
259 (goto-char (match-end 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
260 (re-search-forward efs-vms-date-regexp nil t)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
261 (setq list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
262 (cons
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
263 (cons
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
264 (nconc
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
265 (list (string-to-int (buffer-substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
266 (match-beginning 3)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
267 (match-end 3))) ; year
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
268 (cdr (assoc
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
269 (buffer-substring (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
270 (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
271 efs-vms-month-alist)) ; month
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
272 (string-to-int (buffer-substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
273 (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
274 (match-end 1)))) ;day
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
275 (if (match-beginning 4)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
276 (list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
277 (string-to-int (buffer-substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
278 (match-beginning 5)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
279 (match-end 5))) ; hour
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
280 (string-to-int (buffer-substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
281 (match-beginning 6)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
282 (match-end 6))) ; minute
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
283 (if (match-beginning 7)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
284 (string-to-int (buffer-substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
285 (1+ (match-beginning 7))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
286 (match-end 7))) ; seconds
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
287 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
288 (list 0 0 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
289 (buffer-substring start end))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
290 list))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
291 (goto-char end))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
292 (if list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
293 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
294 (setq list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
295 (mapcar 'cdr
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
296 (sort list 'efs-vms-t-converter-sort-pred)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
297 (if reverse (setq list (nreverse list)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
298 (delete-region list-start (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
299 (apply 'insert list)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
300 t)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
301
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
302 (defun efs-vms-t-converter-sort-pred (elt1 elt2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
303 (let* ((data1 (car elt1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
304 (data2 (car elt2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
305 (year1 (car data1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
306 (year2 (car data2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
307 (month1 (nth 1 data1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
308 (month2 (nth 1 data2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
309 (day1 (nth 2 data1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
310 (day2 (nth 2 data2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
311 (hour1 (nth 3 data1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
312 (hour2 (nth 3 data2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
313 (minute1 (nth 4 data1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
314 (minute2 (nth 4 data2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
315 (or (> year1 year2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
316 (and (= year1 year2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
317 (or (> month1 month2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
318 (and (= month1 month2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
319 (or (> day1 day2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
320 (and (= day1 day2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
321 (or (> hour1 hour2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
322 (and (= hour1 hour2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
323 (or (> minute1 minute2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
324 (and (= minute1 minute2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
325 (or (> (nth 5 data1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
326 (nth 5 data2)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
327 ))))))))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
328
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
329
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
330 (efs-defun efs-X-converter vms (&optional regexp reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
331 ;; Sorts by extension
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
332 (if regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
333 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
334 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
335 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
336 (if (re-search-forward efs-vms-filename-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
337 (let (list-start start list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
338 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
339 (setq list-start (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
340 (while (looking-at efs-vms-filename-regexp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
341 (setq start (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
342 (goto-char (match-end 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
343 (forward-line (if (eolp) 2 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
344 (setq list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
345 (cons
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
346 (cons (buffer-substring (match-beginning 2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
347 (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
348 (buffer-substring start (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
349 list)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
350 (setq list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
351 (mapcar 'cdr
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
352 (sort list
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
353 (if reverse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
354 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
355 (lambda (x y)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
356 (string< (car y) (car x))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
357 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
358 (lambda (x y)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
359 (string< (car x) (car y))))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
360 (delete-region list-start (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
361 (apply 'insert list)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
362 t)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
363
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
364 ;; This version only deletes file entries which have
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
365 ;; explicit version numbers, because that is all VMS allows.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
366
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
367 (efs-defun efs-delete-file-entry vms (path &optional dir-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
368 (let ((ignore-case (memq 'vms efs-case-insensitive-host-types)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
369 (if dir-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
370 (let ((path (file-name-as-directory path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
371 files)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
372 (efs-del-hash-entry path efs-files-hashtable ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
373 (setq path (directory-file-name path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
374 files (efs-get-hash-entry (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
375 efs-files-hashtable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
376 ignore-case))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
377 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
378 (efs-del-hash-entry (efs-get-file-part path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
379 files ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
380 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
381 (let ((file (efs-get-file-part path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
382 (if (string-match ";[0-9]+$" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
383 ;; In VMS you can't delete a file without an explicit
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
384 ;; version number, or wild-card (e.g. FOO;*)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
385 ;; For now, we give up on wildcards.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
386 (let ((files (efs-get-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
387 (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
388 efs-files-hashtable ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
389 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
390 (let ((root (substring file 0
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
391 (match-beginning 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
392 (completion-ignore-case ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
393 (len (match-beginning 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
394 (efs-del-hash-entry file files ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
395 ;; Now we need to check if there are any
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
396 ;; versions left. If not, then delete the
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
397 ;; root entry.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
398 (or (all-completions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
399 root files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
400 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
401 (lambda (sym)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
402 (string-match ";[0-9]+$"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
403 (symbol-name sym) len))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
404 (efs-del-hash-entry root files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
405 ignore-case)))))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
406 (efs-del-from-ls-cache path t ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
407
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
408 (efs-defun efs-add-file-entry vms (path dir-p size owner
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
409 &optional modes nlinks mdtm)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
410 ;; The vms version of this function needs to keep track
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
411 ;; of vms's file versions.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
412 (let ((ignore-case (memq 'vms efs-case-insensitive-host-types))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
413 (ent (let ((dir-p (null (null dir-p))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
414 (if mdtm
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
415 (list dir-p size owner nil nil mdtm)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
416 (list dir-p size owner)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
417 (if dir-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
418 (let* ((path (directory-file-name path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
419 (files (efs-get-hash-entry (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
420 efs-files-hashtable
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
421 ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
422 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
423 (efs-put-hash-entry (efs-get-file-part path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
424 ent files ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
425 (let ((files (efs-get-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
426 (file-name-directory path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
427 efs-files-hashtable ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
428 (if files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
429 (let ((file (efs-get-file-part path)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
430 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
431 ;; In VMS files must have an extension. If there isn't
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
432 ;; one, it will be added.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
433 (or (string-match "^[^;]*\\." file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
434 (if (string-match ";" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
435 (setq file (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
436 (substring file 0 (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
437 ".;"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
438 (substring file (match-end 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
439 (setq file (concat file "."))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
440 (if (string-match ";[0-9]+$" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
441 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
442 (substring file 0 (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
443 ent files ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
444 ;; Need to figure out what version of the file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
445 ;; is being added.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
446 (let* ((completion-ignore-case ignore-case)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
447 (len (length file))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
448 (versions (all-completions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
449 file files
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
450 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
451 (lambda (sym)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
452 (string-match ";[0-9]+$"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
453 (symbol-name sym) len)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
454 (N (1+ len))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
455 (max (apply
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
456 'max
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
457 (cons 0 (mapcar
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
458 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
459 (lambda (x)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
460 (string-to-int (substring x N))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
461 versions)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
462 ;; No need to worry about case here.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
463 (efs-put-hash-entry
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
464 (concat file ";" (int-to-string (1+ max))) ent files))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
465 (efs-put-hash-entry file ent files ignore-case)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
466 (efs-del-from-ls-cache path t ignore-case)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
467
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
468 (efs-defun efs-really-file-p vms (file ent)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
469 ;; Returns whether the hash entry FILE with entry ENT is a real file.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
470 (or (car ent) ; file-directory-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
471 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
472 (string-match ";" file))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
473
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
474 (efs-defun efs-internal-file-name-as-directory vms (name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
475 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
476 (if (string-match "\\.\\(DIR\\|dir\\)\\(;[0-9]+\\)?$" name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
477 (setq name (substring name 0 (match-beginning 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
478 (let (file-name-handler-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
479 (file-name-as-directory name))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
480
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
481 (efs-defun efs-remote-directory-file-name vms (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
482 ;; Returns the VMS filename in unix directory syntax for directory DIR.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
483 ;; This is something like /FM/SANDY/FOOBAR.DIR;1
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
484 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
485 (setq dir (directory-file-name dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
486 (concat dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
487 (if (string-match "[a-z]" (nth 2 (efs-ftp-path dir)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
488 ".dir;1"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
489 ".DIR;1"))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
490
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
491 (efs-defun efs-allow-child-lookup vms (host user dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
492 ;; Returns t if FILE in directory DIR could possibly be a subdir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
493 ;; according to its file-name syntax, and therefore a child listing should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
494 ;; be attempted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
495
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
496 ;; Subdirs in VMS can't have an extension (other than .DIR, which we
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
497 ;; have truncated).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
498 (not (or (string-match "\\." file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
499 (and (boundp 'dired-local-variables-file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
500 (stringp dired-local-variables-file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
501 (string-equal dired-local-variables-file file)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
502
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
503 ;;; Tree dired support:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
504
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
505 ;; For this code I have borrowed liberally from Sebastian Kremer's
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
506 ;; dired-vms.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
507
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
508
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
509 ;; These regexps must be anchored to beginning of line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
510 ;; Beware that the ftpd may put the device in front of the filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
511
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
512 (defconst efs-dired-vms-re-exe
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
513 "^. [^ \t.]+\\.\\(EXE\\|exe\\)[; ]")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
514
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
515 (or (assq 'vms efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
516 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
517 (cons (cons 'vms efs-dired-vms-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
518 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
519
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
520 (defconst efs-dired-vms-re-dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
521 "^. [^ \t.]+\\.\\(DIR\\|dir\\)[; ]")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
522
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
523 (or (assq 'vms efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
524 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
525 (cons (cons 'vms efs-dired-vms-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
526 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
527
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
528 (efs-defun efs-dired-insert-headerline vms (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
529 ;; VMS inserts a headerline. I would prefer the headerline
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
530 ;; to be in efs format. This version tries to
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
531 ;; be careful, because we can't count on a headerline
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
532 ;; over ftp, and we wouldn't want to delete anything
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
533 ;; important.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
534 (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
535 (if (looking-at "^ \\(list \\)?wildcard ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
536 (forward-line 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
537 ;; This is really aggressive. Too aggressive?
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
538 (let ((start (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
539 (skip-chars-forward " \t\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
540 (if (looking-at efs-vms-filename-regexp)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
541 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
542 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
543 (skip-chars-forward " \t\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
544 (beginning-of-line))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
545 (delete-region start (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
546 (insert " \n"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
547 (efs-real-dired-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
548
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
549 (efs-defun efs-dired-fixup-listing vms (file path &optional switches wildcard)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
550 ;; Some vms machines list the entire path. Scrape this off.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
551 (setq path (efs-fix-path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
552 'vms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
553 ;; Need the file-name-directory, in case of widcards.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
554 ;; Note that path is a `local' path rel. the remote host.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
555 ;; Lose on wildcards in parent dirs. Fix if somebody complains.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
556 (let (file-name-handler-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
557 (file-name-directory path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
558 ;; Some machines put a Node name down too.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
559 (let ((regexp (concat "^\\([_A-Za-z0-9][-_A-Za-z0-9]*\\$\\)?"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
560 (regexp-quote path))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
561 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
562 (while (re-search-forward regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
563 (delete-region (match-beginning 0) (match-end 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
564 ;; Now need to deal with continuation lines.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
565 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
566 (let (col start end)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
567 (while (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
568 ";[0-9]+[ \t]*\\(\n[ \t]+\\)[^; \t\n]+[^\n;]*\n" nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
569 (setq start (match-beginning 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
570 end (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
571 ;; guess at the column dimensions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
572 (or col
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
573 (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
574 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
575 (if (re-search-forward
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
576 (concat efs-vms-filename-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
577 "[ \t]+[^ \t\n\r]") nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
578 (setq col (- (goto-char (match-end 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
579 (progn (beginning-of-line) (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
580 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
581 (setq col 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
582 ;; join cont. lines.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
583 (delete-region start end)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
584 (goto-char start)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
585 (insert-char ? (max (- col (current-column)) 2))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
586 ;; Some vms dir listings put a triple null line before the total line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
587 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
588 (skip-chars-forward "\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
589 (if (search-forward "\n\n\n" nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
590 (delete-char -1)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
591
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
592 (efs-defun efs-dired-manual-move-to-filename vms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
593 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
594 ;; In dired, move to first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
595 ;; Returns position (point) or nil if no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
596 ;; This is the VMS version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
597 (or eol (setq eol (save-excursion (skip-chars-forward "^\r\n") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
598 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
599 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
600 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
601 (skip-chars-backward "^\n\r"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
602 (if (re-search-forward efs-vms-filename-regexp eol t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
603 (goto-char (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
604 (and raise-error (error "No file on this line")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
605
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
606 (efs-defun efs-dired-manual-move-to-end-of-filename vms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
607 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
608 ;; Assumes point is at beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
609 ;; So, it should be called only after (dired-move-to-filename t).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
610 ;; case-fold-search must be nil, at least for VMS.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
611 ;; On failure, signals an error or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
612 ;; This is the VMS version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
613 (let ((opoint (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
614 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
615 (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
616 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
617 (1- (or bol (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
618 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
619 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
620 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
621 ;; File is hidden or omitted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
622 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
623 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
624 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
625 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
626 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
627 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
628 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
629 "File line is omitted. Type \\[dired-omit-toggle] to un-omit."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
630 )))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
631 (skip-chars-forward "-_A-Za-z0-9$.;")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
632 (if (or (= opoint (point)) (not (memq (following-char) '(?\ ?\t ?\n ?\r))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
633 (if no-error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
634 nil
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
635 (error "No file on this line"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
636 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
637
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
638 (efs-defun efs-dired-ls-trim vms ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
639 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
640 (let ((case-fold-search nil))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
641 (re-search-forward efs-vms-filename-regexp))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
642 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
643 (delete-region (point-min) (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
644 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
645 (delete-region (point) (point-max)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
646
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
647 (efs-defun efs-internal-file-name-sans-versions vms
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
648 (name &optional keep-backup-version)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
649 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
650 (if (string-match ";[0-9]+$" name)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
651 (substring name 0 (match-beginning 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
652 name)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
653
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
654 (efs-defun efs-dired-collect-file-versions vms ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
655 ;; If it looks like file FN has versions, return a list of the versions.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
656 ;; That is a list of strings which are file names.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
657 ;; The caller may want to flag some of these files for deletion.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
658 (let ((completion-ignore-case (memq 'vms efs-case-insensitive-host-types))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
659 result)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
660 (dired-map-dired-file-lines
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
661 (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
662 (lambda (fn)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
663 (if (string-match ";[0-9]+$" fn)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
664 (let* ((base-fn (substring fn 0 (match-beginning 0)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
665 (base-version (file-name-nondirectory
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
666 (substring fn 0 (1+ (match-beginning 0)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
667 (bv-length (length base-version))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
668 (possibilities (and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
669 (null (assoc base-fn result))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
670 (file-name-all-completions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
671 base-version
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
672 (file-name-directory fn)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
673 (if possibilities
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
674 (setq result
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
675 (cons (cons base-fn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
676 ;; code this explicitly
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
677 ;; using backup-extract-version has a
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
678 ;; lot of function-call overhead.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
679 (mapcar (function
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
680 (lambda (fn)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
681 (string-to-int
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
682 (substring fn bv-length))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
683 possibilities)) result))))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
684 result))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
685
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
686 (efs-defun efs-dired-flag-backup-files vms (&optional unflag-p)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
687 (interactive "P")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
688 (let ((dired-kept-versions 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
689 (kept-old-versions 0)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
690 marker msg)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
691 (if unflag-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
692 (setq marker ?\040 msg "Unflagging old versions")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
693 (setq marker dired-del-marker msg "Purging old versions"))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
694 (dired-clean-directory 1 marker msg)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
695
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
696 (efs-defun efs-internal-diff-latest-backup-file vms (fn)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
697 ;; For FILE;#, returns the filename FILE;N, where N
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
698 ;; is the largest number less than #, for which this file exists.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
699 ;; Returns nil if none found.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
700 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
701 (and (string-match ";[0-9]+$" fn)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
702 (let ((base (substring fn 0 (1+ (match-beginning 0))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
703 (num (1- (string-to-int (substring fn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
704 (1+ (match-beginning 0))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
705 found file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
706 (while (and (setq found (> num 0))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
707 (not (file-exists-p
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
708 (setq file
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
709 (concat base (int-to-string num))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
710 (setq num (1- num)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
711 (and found file)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
712
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
713 ;;;;--------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
714 ;;;; Support for VMS DIR/FULL listings. (listing type vms:full)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
715 ;;;;--------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
716
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
717 (efs-defun efs-parse-listing vms:full
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
718 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
719 ;; Parse the current buffer which is assumed to be a VMS FTP dir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
720 ;; format, and return a hashtable as the result. SWITCHES are never used,
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
721 ;; but they must be specified in the argument list for compatibility
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
722 ;; with the unix version of this function.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
723 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
724 ;; USER = user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
725 ;; DIR = directory in as a full remote path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
726 ;; PATH = directory in full efs path syntax
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
727 ;; SWITCHES = ls switches (not relevant here)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
728 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
729 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
730 (efs-parse-vms-listing)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
731
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
732 ;;; Tree Dired
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
733
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
734 (or (assq 'vms:full efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
735 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
736 (cons (cons 'vms:full efs-dired-vms-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
737 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
738
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
739 (or (assq 'vms:full efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
740 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
741 (cons (cons 'vms:full efs-dired-vms-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
742 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
743
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
744 (efs-defun efs-dired-insert-headerline vms:full (dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
745 ;; Insert a blank line for aesthetics.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
746 (insert " \n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
747 (forward-char -2)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
748 (efs-real-dired-insert-headerline dir))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
749
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
750 (efs-defun efs-dired-manual-move-to-filename vms:full
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
751 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
752 (let ((efs-dired-listing-type 'vms))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
753 (efs-dired-manual-move-to-filename raise-error bol eol)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
754
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
755 (efs-defun efs-dired-manual-move-to-end-of-filename vms:full
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
756 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
757 (let ((efs-dired-listing-type 'vms))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
758 (efs-dired-manual-move-to-end-of-filename no-error bol eol)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
759
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
760 ;;; end of efs-vms.el