annotate lisp/vms/vms-patch.el @ 16:0293115a14e9 r19-15b91

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