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