Mercurial > hg > xemacs-beta
comparison lisp/vms/vms-patch.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 0293115a14e9 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 ;;; vms-patch.el --- override parts of files.el for VMS. | |
2 ;; Keywords: vms | |
3 | |
4 ;; Copyright (C) 1986 Free Software Foundation, Inc. | |
5 | |
6 ;; This file is part of XEmacs. | |
7 | |
8 ;; XEmacs is free software; you can redistribute it and/or modify it | |
9 ;; under the terms of the GNU General Public License as published by | |
10 ;; the Free Software Foundation; either version 2, or (at your option) | |
11 ;; any later version. | |
12 | |
13 ;; XEmacs is distributed in the hope that it will be useful, but | |
14 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
16 ;; General Public License for more details. | |
17 | |
18 ;; You should have received a copy of the GNU General Public License | |
19 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
20 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | |
22 | |
23 ;;; Functions that need redefinition | |
24 | |
25 ;;; VMS file names are upper case, but buffer names are more | |
26 ;;; convenient in lower case. | |
27 | |
28 (defun create-file-buffer (filename) | |
29 "Create a suitably named buffer for visiting FILENAME, and return it. | |
30 FILENAME (sans directory) is used unchanged if that name is free; | |
31 otherwise a string <2> or <3> or ... is appended to get an unused name." | |
32 (generate-new-buffer (downcase (file-name-nondirectory filename)))) | |
33 | |
34 ;;; Given a string FN, return a similar name which is a legal VMS filename. | |
35 ;;; This is used to avoid invalid auto save file names. | |
36 (defun make-legal-file-name (fn) | |
37 (setq fn (copy-sequence fn)) | |
38 (let ((dot nil) (indx 0) (len (length fn)) chr) | |
39 (while (< indx len) | |
40 (setq chr (aref fn indx)) | |
41 (cond | |
42 ((eq chr ?.) (if dot (aset fn indx ?_) (setq dot t))) | |
43 ((not (or (and (>= chr ?a) (<= chr ?z)) (and (>= chr ?A) (<= chr ?Z)) | |
44 (and (>= chr ?0) (<= chr ?9)) | |
45 (eq chr ?$) (eq chr ?_) (and (eq chr ?-) (> indx 0)))) | |
46 (aset fn indx ?_))) | |
47 (setq indx (1+ indx)))) | |
48 fn) | |
49 | |
50 ;;; Auto save filesnames start with _$ and end with $. | |
51 | |
52 (defun make-auto-save-file-name () | |
53 "Return file name to use for auto-saves of current buffer. | |
54 Does not consider auto-save-visited-file-name; that is checked | |
55 before calling this function. | |
56 This is a separate function so your .emacs file or site-init.el can redefine it. | |
57 See also auto-save-file-name-p." | |
58 (if buffer-file-name | |
59 (concat (file-name-directory buffer-file-name) | |
60 "_$" | |
61 (file-name-nondirectory buffer-file-name) | |
62 "$") | |
63 (expand-file-name (concat "_$_" (make-legal-file-name (buffer-name)) "$")))) | |
64 | |
65 (defun auto-save-file-name-p (filename) | |
66 "Return t if FILENAME can be yielded by make-auto-save-file-name. | |
67 FILENAME should lack slashes. | |
68 This is a separate function so your .emacs file or site-init.el can redefine it." | |
69 (string-match "^_\\$.*\\$" filename)) | |
70 | |
71 (defun vms-suspend-resume-hook () | |
72 "When resuming suspended Emacs, check for file to be found. | |
73 If the logical name `EMACS_FILE_NAME' is defined, `find-file' that file." | |
74 (let ((file (vms-system-info "LOGICAL" "EMACS_FILE_NAME"))) | |
75 (if file (find-file file)))) | |
76 | |
77 (setq suspend-resume-hook 'vms-suspend-resume-hook) | |
78 | |
79 (defun vms-suspend-hook () | |
80 "Don't allow suspending if logical name `DONT_SUSPEND_EMACS' is defined." | |
81 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") | |
82 (error "Can't suspend this emacs")) | |
83 nil) | |
84 | |
85 (setq suspend-hook 'vms-suspend-hook) | |
86 | |
87 (defun vms-read-directory (dirname switches buffer) | |
88 (save-excursion | |
89 (set-buffer buffer) | |
90 (subprocess-command-to-buffer | |
91 (concat "DIRECTORY " switches " " dirname) | |
92 buffer) | |
93 (goto-char (point-min)) | |
94 ;; Remove all the trailing blanks. | |
95 (while (search-forward " \n") | |
96 (forward-char -1) | |
97 (delete-horizontal-space)) | |
98 (goto-char (point-min)))) | |
99 | |
100 (setq dired-listing-switches | |
101 "/SIZE/DATE/OWNER/WIDTH=(FILENAME=32,SIZE=5)") |