annotate lisp/efs/efs-guardian.el @ 50:ee648375d8d6 r19-16b91

Import from CVS: tag r19-16b91
author cvs
date Mon, 13 Aug 2007 08:56:41 +0200
parents 8b8b7f3559a2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
1 ;; -*-Emacs-Lisp-*-
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
2 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
3 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
4 ;; File: efs-guardian.el
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
5 ;; Release: $efs release: 1.15 $
42
8b8b7f3559a2 Import from CVS: tag r19-15b104
cvs
parents: 40
diff changeset
6 ;; Version: #Revision: 1.7 $
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
7 ;; RCS:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
8 ;; Description: Guardian support for efs
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
9 ;; Author: Sandy Rutherford <sandy@math.ubc.ca>
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
10 ;; Created: Sat Jul 10 12:26:12 1993 by sandy on ibm550
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
11 ;; Language: Emacs-Lisp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
12 ;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
13 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
14
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
15 ;;; This file is part of efs. See efs.el for copyright
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
16 ;;; (it's copylefted) and warrranty (there isn't one) information.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
17
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
18 ;;; Acknowledgements:
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
19 ;;; Adrian Philips and David Karr for answering questions
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
20 ;;; and debugging. Thanks.
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-guardian-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 "/"
42
8b8b7f3559a2 Import from CVS: tag r19-15b104
cvs
parents: 40
diff changeset
25 (substring "#Revision: 1.7 $" 11 -2)))
22
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
26
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
27 (provide 'efs-guardian)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
28 (require 'efs)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
29
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
30 ;;;; ------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
31 ;;;; Support for Tandem's GUARDIAN operating system.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
32 ;;;; ------------------------------------------------------------
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
33
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
34 ;;; Supposed to work for (Version 2.7 TANDEM 01SEP92).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
35
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
36 ;;; File name 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 ;;; File names are of the form volume.subvolume.file where
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
39 ;;; volume is $[alphanumeric characters]{1 to 7}
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
40 ;;; subvolume is <alpha character>[<alphanumeric character>]{0 to 7}
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
41 ;;; and file is the same as subvolume.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
42
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
43 (defconst efs-guardian-date-regexp
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
44 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
45 " [ 1-3][0-9]-\\(Jan\\|Feb\\|Mar\\|Apr\\|May\\|Jun\\|Jul\\|Aug\\|"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
46 "Sep\\|Oct\\|Nov\\|Dec\\)-[0-9][0-9] "))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
47
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
48 ;;; entry points -- 2 of 'em.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
49
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
50 (efs-defun efs-fix-path guardian (path &optional reverse)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
51 ;; Convert PATH from unix-ish to guardian.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
52 ;; If REVERSE is non-nil do just that.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
53 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
54 (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
55 (if reverse
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
56 (if (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
57 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
58 "^\\(\\\\[A-Z0-9]+\\.\\)?"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
59 "\\(\\$[A-Z0-9]+\\)\\.\\([A-Z0-9]+\\)\\(\\.[A-Z0-9]+\\)?$")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
60 path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
61 (concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
62 "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
63 (substring path (match-beginning 2) (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
64 "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
65 (substring path (match-beginning 3) (match-end 3))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
66 "/"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
67 (and (match-beginning 4)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
68 (substring path (1+ (match-beginning 4)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
69 (error "path %s is invalid for the GUARDIAN operating system"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
70 path))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
71 (if (string-match
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
72 "^/\\(\\$[A-Z0-9]+\\)/\\([A-Z0-9]+\\)\\(/[A-Z0-9]*\\)?$" path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
73 (apply 'concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
74 (substring path 1 (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
75 "."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
76 (substring path (match-beginning 2) (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
77 (and (match-beginning 3)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
78 (/= (- (match-end 3) (match-beginning 3)) 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
79 (list "."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
80 (substring path (1+ (match-beginning 3))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
81 (error "path %s is invalid for the guardian operating system"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
82 path))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
83
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
84 (efs-defun efs-fix-dir-path guardian (dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
85 ;; Convert DIR-PATH from unix-ish to guardian fir a DIR listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
86 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
87 (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
88 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
89 ((string-equal "/" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
90 (error "Can't grok guardian disk volumes."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
91 ((string-match "^/\\$[A-Z0-9]+/?$" dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
92 (error "Can't grok guardian subvolumes."))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
93 ((string-match "^/\\(\\$[A-Z0-9]+\\)/\\([A-Z0-9]+\\)\\(/[A-Z0-9]*\\)?$"
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
94 dir-path)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
95 (apply 'concat
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
96 (substring dir-path 1 (match-end 1))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
97 "."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
98 (substring dir-path (match-beginning 2) (match-end 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
99 (and (match-beginning 3)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
100 (/= (- (match-end 3) (match-beginning 3)) 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
101 (list "."
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
102 (substring dir-path (1+ (match-beginning 3)))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
103 (t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
104 (error "path %s is invalid for the guardian operating system"))))))
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-parse-listing guardian
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
107 (host user dir path &optional switches)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
108 ;; Parses a GUARDIAN DIRectory listing.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
109 ;; HOST = remote host name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
110 ;; USER = remote user name
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
111 ;; DIR = remote directory as a remote full path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
112 ;; PATH = directory as an efs full path
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
113 ;; SWITCHES are never used here, but they
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
114 ;; must be specified in the argument list for compatibility
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
115 ;; with the unix version of this function.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
116 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
117 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
118 (if (re-search-forward efs-guardian-date-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
119 (let ((tbl (efs-make-hashtable))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
120 file size)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
121 (while
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
122 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
123 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
124 (setq file (buffer-substring (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
125 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
126 (skip-chars-forward "A-Z0-9")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
127 (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
128 (skip-chars-forward " ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
129 (skip-chars-forward "^ ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
130 (skip-chars-forward " ")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
131 (setq size (string-to-int (buffer-substring
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
132 (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
133 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
134 (skip-chars-forward "0-9")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
135 (efs-put-hash-entry file (list nil size) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
136 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
137 (re-search-forward efs-guardian-date-regexp nil t)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
138 (efs-put-hash-entry "." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
139 (efs-put-hash-entry ".." '(t) tbl)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
140 tbl))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
141
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
142 (efs-defun efs-allow-child-lookup guardian (host user dir file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
143 ;; Returns t if FILE in directory DIR could possibly be a subdir
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
144 ;; according to its file-name syntax, and therefore a child listing should
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
145 ;; be attempted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
146 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
147 (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
148 (string-match "^/\\$[A-Z0-9]+/$" dir))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
149
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
150 (efs-defun efs-internal-file-directory-p guardian (file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
151 ;; Directories pop into existence simply by putting files in them.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
152 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
153 (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
154 (if (string-match "^/\\$[A-Z0-9]+\\(/[A-Z0-9]+\\)?/?$" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
155 t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
156 (efs-internal-file-directory-p nil file)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
157
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
158 (efs-defun efs-internal-file-exists-p guardian (file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
159 ;; Directories pop into existence simply by putting files in them.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
160 (efs-save-match-data
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
161 (let ((case-fold-search t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
162 (if (string-match "^/\\$[A-Z0-9]+\\(/[A-Z0-9]+\\)?/?$" file)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
163 t
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
164 (efs-internal-file-exists-p nil file)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
165
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
166 ;;; Tree Dired support
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
167
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
168 (defconst efs-dired-guardian-re-exe nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
169
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
170 (or (assq 'guardian efs-dired-re-exe-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
171 (setq efs-dired-re-exe-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
172 (cons (cons 'guardian efs-dired-guardian-re-exe)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
173 efs-dired-re-exe-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
174
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
175 (defconst efs-dired-guardian-re-dir nil)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
176
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
177 (or (assq 'guardian efs-dired-re-dir-alist)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
178 (setq efs-dired-re-dir-alist
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
179 (cons (cons 'guardian efs-dired-guardian-re-dir)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
180 efs-dired-re-dir-alist)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
181
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
182 (efs-defun efs-dired-manual-move-to-filename guardian
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
183 (&optional raise-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
184 ;; In dired, move to first char of filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
185 ;; Returns position (point) or nil if no filename on this line.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
186 ;; This is the guardian version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
187 (or eol (setq eol (save-excursion (skip-chars-forward "^\n\r") (point))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
188 (if bol
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
189 (goto-char bol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
190 (skip-chars-backward "^\n\r")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
191 (setq bol (point)))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
192 (if (save-excursion (re-search-forward efs-guardian-date-regexp eol t))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
193 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
194 (if (looking-at ". [^ ]")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
195 (forward-char 2))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
196 (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
197 (and raise-error (error "No file on this line"))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
198
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
199 (efs-defun efs-dired-manual-move-to-end-of-filename guardian
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
200 (&optional no-error bol eol)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
201 ;; Assumes point is at beginning of filename.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
202 ;; So, it should be called only after (dired-move-to-filename t).
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
203 ;; On failure, signals an error or returns nil.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
204 ;; This is the guardian version.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
205 (and selective-display
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
206 (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
207 (eq (char-after
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
208 (1- (or bol (save-excursion
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
209 (skip-chars-backward "^\r\n")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
210 (point)))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
211 ?\r)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
212 ;; File is hidden or omitted.
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
213 (cond
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
214 ((dired-subdir-hidden-p (dired-current-directory))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
215 (error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
216 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
217 "File line is hidden. Type \\[dired-hide-subdir] to unhide.")))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
218 ((error
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
219 (substitute-command-keys
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
220 "File line is omitted. Type \\[dired-omit-toggle] to un-omit.")))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
221 (if (and
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
222 (>= (following-char) ?A)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
223 (<= (following-char) ?Z)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
224 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
225 (skip-chars-forward "A-Z0-9")
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
226 (= (following-char) ?\ )))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
227 (point)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
228 (and (null no-error)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
229 (error "No file on this line"))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
230
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
231 (efs-defun efs-dired-ls-trim guardian ()
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
232 (goto-char (point-min))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
233 (let (case-fold-search)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
234 (if (re-search-forward efs-guardian-date-regexp nil t)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
235 (progn
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
236 (beginning-of-line)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
237 (delete-region (point-min) (point))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
238 (forward-line 1)
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
239 (delete-region (point) (point-max))))))
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
240
8fc7fe29b841 Import from CVS: tag r19-15b94
cvs
parents:
diff changeset
241 ;;; end of efs-guardian.el