Mercurial > emacs
annotate lisp/vms-patch.el @ 828:4b56424868f6
*** empty log message ***
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Tue, 21 Jul 1992 07:57:59 +0000 |
parents | 485e82a8acb5 |
children | 113281b361ec |
rev | line source |
---|---|
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
156
diff
changeset
|
1 ;;; vms-patch.el --- override parts of files.el for VMS. |
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
156
diff
changeset
|
2 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
3 ;; Maintainer: FSF |
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
4 ;; Last-Modified: 06 May 1992 |
812
485e82a8acb5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
5 ;; Keywords: vms |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
6 |
36 | 7 ;; Copyright (C) 1986 Free Software Foundation, Inc. |
8 | |
9 ;; This file is part of GNU Emacs. | |
10 | |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
13 ;; the Free Software Foundation; either version 2, or (at your option) |
36 | 14 ;; any later version. |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
22 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
23 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
25 ;;; Code: |
36 | 26 |
27 ;;; Functions that need redefinition | |
28 | |
29 ;;; VMS file names are upper case, but buffer names are more | |
30 ;;; convenient in lower case. | |
31 | |
32 (defun create-file-buffer (filename) | |
33 "Create a suitably named buffer for visiting FILENAME, and return it. | |
34 FILENAME (sans directory) is used unchanged if that name is free; | |
35 otherwise a string <2> or <3> or ... is appended to get an unused name." | |
36 (generate-new-buffer (downcase (file-name-nondirectory filename)))) | |
37 | |
38 ;;; Given a string FN, return a similar name which is a legal VMS filename. | |
39 ;;; This is used to avoid invalid auto save file names. | |
40 (defun make-legal-file-name (fn) | |
41 (setq fn (copy-sequence fn)) | |
42 (let ((dot nil) (indx 0) (len (length fn)) chr) | |
43 (while (< indx len) | |
44 (setq chr (aref fn indx)) | |
45 (cond | |
46 ((eq chr ?.) (if dot (aset fn indx ?_) (setq dot t))) | |
47 ((not (or (and (>= chr ?a) (<= chr ?z)) (and (>= chr ?A) (<= chr ?Z)) | |
48 (and (>= chr ?0) (<= chr ?9)) | |
49 (eq chr ?$) (eq chr ?_) (and (eq chr ?-) (> indx 0)))) | |
50 (aset fn indx ?_))) | |
51 (setq indx (1+ indx)))) | |
52 fn) | |
53 | |
54 ;;; Auto save filesnames start with _$ and end with $. | |
55 | |
56 (defun make-auto-save-file-name () | |
57 "Return file name to use for auto-saves of current buffer. | |
58 Does not consider auto-save-visited-file-name; that is checked | |
59 before calling this function. | |
60 This is a separate function so your .emacs file or site-init.el can redefine it. | |
61 See also auto-save-file-name-p." | |
62 (if buffer-file-name | |
63 (concat (file-name-directory buffer-file-name) | |
64 "_$" | |
65 (file-name-nondirectory buffer-file-name) | |
66 "$") | |
67 (expand-file-name (concat "_$_" (make-legal-file-name (buffer-name)) "$")))) | |
68 | |
69 (defun auto-save-file-name-p (filename) | |
70 "Return t if FILENAME can be yielded by make-auto-save-file-name. | |
71 FILENAME should lack slashes. | |
72 This is a separate function so your .emacs file or site-init.el can redefine it." | |
73 (string-match "^_\\$.*\\$" filename)) | |
74 | |
75 (defun vms-suspend-resume-hook () | |
76 "When resuming suspended Emacs, check for file to be found. | |
77 If the logical name `EMACS_FILE_NAME' is defined, `find-file' that file." | |
78 (let ((file (vms-system-info "LOGICAL" "EMACS_FILE_NAME"))) | |
79 (if file (find-file file)))) | |
80 | |
81 (setq suspend-resume-hook 'vms-suspend-resume-hook) | |
82 | |
83 (defun vms-suspend-hook () | |
84 "Don't allow suspending if logical name `DONT_SUSPEND_EMACS' is defined." | |
85 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") | |
86 (error "Can't suspend this emacs")) | |
87 nil) | |
88 | |
89 (setq suspend-hook 'vms-suspend-hook) | |
90 | |
91 (defun vms-read-directory (dirname switches buffer) | |
92 (save-excursion | |
93 (set-buffer buffer) | |
94 (subprocess-command-to-buffer | |
95 (concat "DIRECTORY " switches " " dirname) | |
96 buffer) | |
97 (goto-char (point-min)) | |
98 ;; Remove all the trailing blanks. | |
99 (while (search-forward " \n") | |
100 (forward-char -1) | |
101 (delete-horizontal-space)) | |
102 (goto-char (point-min)))) | |
103 | |
104 (setq dired-listing-switches | |
105 "/SIZE/DATE/OWNER/WIDTH=(FILENAME=32,SIZE=5)") | |
156 | 106 |
107 (setq print-region-function | |
108 '(lambda (start end command ign1 ign2 ign3 &rest switches) | |
109 (write-region start end "sys$login:delete-me.txt") | |
110 (send-command-to-subprocess | |
111 1 | |
112 (concat command | |
113 " sys$login:delete-me.txt/name=""GNUprintbuffer"" " | |
114 (mapconcat 'identity switches " ")) | |
115 nil nil nil))) | |
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
156
diff
changeset
|
116 |
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
156
diff
changeset
|
117 ;;; vms-patch.el ends here |