Mercurial > emacs
comparison lisp/vms-patch.el @ 90185:5b029ff3b08d
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-55
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 320-323)
- Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Thu, 26 May 2005 05:42:19 +0000 |
parents | f042e7c0fe20 11dc1e2caaf0 |
children | f9a65d7ebd29 |
comparison
equal
deleted
inserted
replaced
90184:9e5e2f01c7ab | 90185:5b029ff3b08d |
---|---|
191 \\[vms-pmail-abort] vms-pmail-abort | 191 \\[vms-pmail-abort] vms-pmail-abort |
192 | 192 |
193 All other Emacs commands are still available." | 193 All other Emacs commands are still available." |
194 t) | 194 t) |
195 | 195 |
196 ;;; | |
197 ;;; Filename handling in the minibuffer | |
198 ;;; | |
199 (defun vms-magic-right-square-brace () | |
200 "\ | |
201 Insert a right square brace, but do other things first depending on context. | |
202 During filename completion, when point is at the end of the line and the | |
203 character before is not a right square brace, do one of three things before | |
204 inserting the brace: | |
205 - If there are already two left square braces preceding, do nothing special. | |
206 - If there is a previous right-square-brace, convert it to dot. | |
207 - If the character before is dot, delete it. | |
208 Additionally, if the preceding chars are right-square-brace followed by | |
209 either \"-\" or \"..\", strip one level of directory hierarchy." | |
210 (interactive) | |
211 (when (and minibuffer-completing-file-name | |
212 (= (point) (point-max)) | |
213 (not (= 93 (char-before)))) | |
214 (cond | |
215 ;; Avoid clobbering: user:[one.path][another.path | |
216 ((search-backward "[" (field-beginning) t 2)) | |
217 ((search-backward "]" (field-beginning) t) | |
218 (delete-char 1) | |
219 (insert ".") | |
220 (goto-char (point-max))) | |
221 ((= ?. (char-before)) | |
222 (delete-char -1))) | |
223 (goto-char (point-max)) | |
224 (let ((specs '(".." "-")) | |
225 (pmax (point-max))) | |
226 (while specs | |
227 (let* ((up (car specs)) | |
228 (len (length up)) | |
229 (cut (- (point) len))) | |
230 (when (and (< (1+ len) pmax) | |
231 (= ?. (char-before cut)) | |
232 (string= up (buffer-substring cut (point)))) | |
233 (delete-char (- (1+ len))) | |
234 (while (not (let ((c (char-before))) | |
235 (or (= ?. c) (= 91 c)))) | |
236 (delete-char -1)) | |
237 (when (= ?. (char-before)) (delete-char -1)) | |
238 (setq specs nil))) | |
239 (setq specs (cdr specs))))) | |
240 (insert "]")) | |
241 | |
242 (defun vms-magic-colon () | |
243 "\ | |
244 Insert a colon, but do other things first depending on context. | |
245 During filename completion, when point is at the end of the line | |
246 and the line contains a right square brace, remove all characters | |
247 from the beginning of the line up to and including such brace. | |
248 This enables one to type a new filespec without having to delete | |
249 the old one." | |
250 (interactive) | |
251 (when (and minibuffer-completing-file-name | |
252 (= (point) (point-max)) | |
253 (search-backward "]" (field-beginning) t)) | |
254 (delete-region (field-beginning) (1+ (point))) | |
255 (goto-char (point-max))) | |
256 (insert ":")) | |
257 | |
258 (let ((m minibuffer-local-completion-map)) | |
259 (define-key m "]" 'vms-magic-right-square-brace) | |
260 (define-key m "/" 'vms-magic-right-square-brace) | |
261 (define-key m ":" 'vms-magic-colon)) | |
262 | |
196 ;;; arch-tag: c178494e-2c37-4d02-99b7-e47e615656cf | 263 ;;; arch-tag: c178494e-2c37-4d02-99b7-e47e615656cf |
197 ;;; vms-patch.el ends here | 264 ;;; vms-patch.el ends here |