0
|
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
|
16
|
19 ;; along with XEmacs; see the file COPYING. If not, write to the
|
|
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
21 ;; Boston, MA 02111-1307, USA.
|
0
|
22
|
|
23
|
|
24 ;;; Functions that need redefinition
|
|
25
|
|
26 ;;; VMS file names are upper case, but buffer names are more
|
|
27 ;;; convenient in lower case.
|
|
28
|
|
29 (defun create-file-buffer (filename)
|
|
30 "Create a suitably named buffer for visiting FILENAME, and return it.
|
|
31 FILENAME (sans directory) is used unchanged if that name is free;
|
|
32 otherwise a string <2> or <3> or ... is appended to get an unused name."
|
|
33 (generate-new-buffer (downcase (file-name-nondirectory filename))))
|
|
34
|
|
35 ;;; Given a string FN, return a similar name which is a legal VMS filename.
|
|
36 ;;; This is used to avoid invalid auto save file names.
|
|
37 (defun make-legal-file-name (fn)
|
|
38 (setq fn (copy-sequence fn))
|
|
39 (let ((dot nil) (indx 0) (len (length fn)) chr)
|
|
40 (while (< indx len)
|
|
41 (setq chr (aref fn indx))
|
|
42 (cond
|
|
43 ((eq chr ?.) (if dot (aset fn indx ?_) (setq dot t)))
|
|
44 ((not (or (and (>= chr ?a) (<= chr ?z)) (and (>= chr ?A) (<= chr ?Z))
|
|
45 (and (>= chr ?0) (<= chr ?9))
|
|
46 (eq chr ?$) (eq chr ?_) (and (eq chr ?-) (> indx 0))))
|
|
47 (aset fn indx ?_)))
|
|
48 (setq indx (1+ indx))))
|
|
49 fn)
|
|
50
|
|
51 ;;; Auto save filesnames start with _$ and end with $.
|
|
52
|
|
53 (defun make-auto-save-file-name ()
|
|
54 "Return file name to use for auto-saves of current buffer.
|
|
55 Does not consider auto-save-visited-file-name; that is checked
|
|
56 before calling this function.
|
|
57 This is a separate function so your .emacs file or site-init.el can redefine it.
|
|
58 See also auto-save-file-name-p."
|
|
59 (if buffer-file-name
|
|
60 (concat (file-name-directory buffer-file-name)
|
|
61 "_$"
|
|
62 (file-name-nondirectory buffer-file-name)
|
|
63 "$")
|
|
64 (expand-file-name (concat "_$_" (make-legal-file-name (buffer-name)) "$"))))
|
|
65
|
|
66 (defun auto-save-file-name-p (filename)
|
|
67 "Return t if FILENAME can be yielded by make-auto-save-file-name.
|
|
68 FILENAME should lack slashes.
|
|
69 This is a separate function so your .emacs file or site-init.el can redefine it."
|
|
70 (string-match "^_\\$.*\\$" filename))
|
|
71
|
|
72 (defun vms-suspend-resume-hook ()
|
|
73 "When resuming suspended Emacs, check for file to be found.
|
|
74 If the logical name `EMACS_FILE_NAME' is defined, `find-file' that file."
|
|
75 (let ((file (vms-system-info "LOGICAL" "EMACS_FILE_NAME")))
|
|
76 (if file (find-file file))))
|
|
77
|
|
78 (setq suspend-resume-hook 'vms-suspend-resume-hook)
|
|
79
|
|
80 (defun vms-suspend-hook ()
|
|
81 "Don't allow suspending if logical name `DONT_SUSPEND_EMACS' is defined."
|
|
82 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS")
|
|
83 (error "Can't suspend this emacs"))
|
|
84 nil)
|
|
85
|
|
86 (setq suspend-hook 'vms-suspend-hook)
|
|
87
|
|
88 (defun vms-read-directory (dirname switches buffer)
|
|
89 (save-excursion
|
|
90 (set-buffer buffer)
|
|
91 (subprocess-command-to-buffer
|
|
92 (concat "DIRECTORY " switches " " dirname)
|
|
93 buffer)
|
|
94 (goto-char (point-min))
|
|
95 ;; Remove all the trailing blanks.
|
|
96 (while (search-forward " \n")
|
|
97 (forward-char -1)
|
|
98 (delete-horizontal-space))
|
|
99 (goto-char (point-min))))
|
|
100
|
|
101 (setq dired-listing-switches
|
|
102 "/SIZE/DATE/OWNER/WIDTH=(FILENAME=32,SIZE=5)")
|