annotate lisp/vms-patch.el @ 77998:71120e9b162d

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Mon, 11 Jun 2007 05:12:38 +0000
parents e3694f1cb928
children 9355f9b7bbff 95d0cdf160ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 31658
diff changeset
1 ;;; vms-patch.el --- override parts of files.el for VMS
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 156
diff changeset
2
74442
b2e5081b9320 Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
3 ;; Copyright (C) 1986, 1992, 2001, 2002, 2003, 2004,
75347
e3694f1cb928 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 74442
diff changeset
4 ;; 2005, 2006, 2007 Free Software Foundation, Inc.
840
113281b361ec *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 812
diff changeset
5
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
6 ;; Maintainer: FSF
812
485e82a8acb5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 807
diff changeset
7 ;; Keywords: vms
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
8
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
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
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14 ;; any later version.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19 ;; GNU General Public License for more details.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11045
diff changeset
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
64091
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62700
diff changeset
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
6fb026ad601f Update FSF's address.
Lute Kamstra <lute@gnu.org>
parents: 62700
diff changeset
24 ;; Boston, MA 02110-1301, USA.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
25
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 31658
diff changeset
26 ;;; Commentary:
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 31658
diff changeset
27
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 657
diff changeset
28 ;;; Code:
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
29
17245
12e32a06de22 (auto-mode-alist): Add .com element.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
30 (setq auto-mode-alist (cons '(("\\.com\\'" . dcl-mode)) auto-mode-alist))
12e32a06de22 (auto-mode-alist): Add .com element.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
31
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
32 ;;; Functions that need redefinition
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
33
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
34 ;;; VMS file names are upper case, but buffer names are more
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
35 ;;; convenient in lower case.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
37 (defun create-file-buffer (filename)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
38 "Create a suitably named buffer for visiting FILENAME, and return it.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
39 FILENAME (sans directory) is used unchanged if that name is free;
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
40 otherwise a string <2> or <3> or ... is appended to get an unused name."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
41 (generate-new-buffer (downcase (file-name-nondirectory filename))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
42
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
43 ;;; Given a string FN, return a similar name which is a legal VMS filename.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
44 ;;; This is used to avoid invalid auto save file names.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
45 (defun make-legal-file-name (fn)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
46 (setq fn (copy-sequence fn))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
47 (let ((dot nil) (indx 0) (len (length fn)) chr)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
48 (while (< indx len)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49 (setq chr (aref fn indx))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
50 (cond
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
51 ((eq chr ?.) (if dot (aset fn indx ?_) (setq dot t)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
52 ((not (or (and (>= chr ?a) (<= chr ?z)) (and (>= chr ?A) (<= chr ?Z))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
53 (and (>= chr ?0) (<= chr ?9))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
54 (eq chr ?$) (eq chr ?_) (and (eq chr ?-) (> indx 0))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
55 (aset fn indx ?_)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
56 (setq indx (1+ indx))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
57 fn)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
58
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
59 ;;; Auto save filesnames start with _$ and end with $.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
60
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
61 (defun make-auto-save-file-name ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
62 "Return file name to use for auto-saves of current buffer.
11045
b4bf1f2d99f8 (make-auto-save-file-name, auto-save-file-name-p): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 2864
diff changeset
63 This function does not consider `auto-save-visited-file-name';
b4bf1f2d99f8 (make-auto-save-file-name, auto-save-file-name-p): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 2864
diff changeset
64 the caller should check that before calling this function.
b4bf1f2d99f8 (make-auto-save-file-name, auto-save-file-name-p): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 2864
diff changeset
65 This is a separate function so that your `.emacs' file or the site's
b4bf1f2d99f8 (make-auto-save-file-name, auto-save-file-name-p): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 2864
diff changeset
66 `site-init.el' can redefine it.
b4bf1f2d99f8 (make-auto-save-file-name, auto-save-file-name-p): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 2864
diff changeset
67 See also `auto-save-file-name-p'."
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
68 (if buffer-file-name
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
69 (concat (file-name-directory buffer-file-name)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
70 "_$"
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
71 (file-name-nondirectory buffer-file-name)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
72 "$")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
73 (expand-file-name (concat "_$_" (make-legal-file-name (buffer-name)) "$"))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
74
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
75 (defun auto-save-file-name-p (filename)
11045
b4bf1f2d99f8 (make-auto-save-file-name, auto-save-file-name-p): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 2864
diff changeset
76 "Return t if FILENAME can be yielded by `make-auto-save-file-name'.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
77 FILENAME should lack slashes.
11045
b4bf1f2d99f8 (make-auto-save-file-name, auto-save-file-name-p): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 2864
diff changeset
78 This is a separate function so that your `.emacs' file or the site's
b4bf1f2d99f8 (make-auto-save-file-name, auto-save-file-name-p): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 2864
diff changeset
79 `site-init.el' can redefine it."
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
80 (string-match "^_\\$.*\\$" filename))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
81
1174
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
82 ;;;
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
83 ;;; This goes along with kepteditor.com which defines these logicals
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
84 ;;; If EMACS_COMMAND_ARGS is defined, it supersedes EMACS_FILE_NAME,
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
85 ;;; which is probably set up incorrectly anyway.
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
86 ;;; The function command-line-again is a kludge, but it does the job.
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
87 ;;;
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
88 (defun vms-suspend-resume-hook ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
89 "When resuming suspended Emacs, check for file to be found.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
90 If the logical name `EMACS_FILE_NAME' is defined, `find-file' that file."
1174
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
91 (let ((file (vms-system-info "LOGICAL" "EMACS_FILE_NAME"))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
92 (args (vms-system-info "LOGICAL" "EMACS_COMMAND_ARGS"))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
93 (line (vms-system-info "LOGICAL" "EMACS_FILE_LINE")))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
94 (if (not args)
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
95 (if file
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
96 (progn (find-file file)
62402
a7e02ef1e3d6 Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents: 52401
diff changeset
97 (if line (goto-line (string-to-number line)))))
1174
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
98 (cd (file-name-directory file))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
99 (vms-command-line-again))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
100
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
101 (setq suspend-resume-hook 'vms-suspend-resume-hook)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
102
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
103 (defun vms-suspend-hook ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
104 "Don't allow suspending if logical name `DONT_SUSPEND_EMACS' is defined."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
105 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
106 (error "Can't suspend this emacs"))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
107 nil)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
108
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
109 (setq suspend-hook 'vms-suspend-hook)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
110
1174
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
111 ;;;
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
112 ;;; A kludge that allows reprocessing of the command line. This is mostly
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
113 ;;; to allow a spawned VMS mail process to do something reasonable when
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
114 ;;; used in conjunction with the modifications to sysdep.c that allow
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
115 ;;; Emacs to attach to a "foster" parent.
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
116 ;;;
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
117 (defun vms-command-line-again ()
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
118 "Reprocess command line arguments. VMS specific.
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
119 Command line arguments are initialized from the logical EMACS_COMMAND_ARGS
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
120 which is defined by kepteditor.com. On VMS this allows attaching to a
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
121 spawned Emacs and doing things like \"emacs -l myfile.el -f doit\""
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
122 (let* ((args (downcase (vms-system-info "LOGICAL" "EMACS_COMMAND_ARGS")))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
123 (command-line-args (list "emacs"))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
124 (beg 0)
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
125 (end 0)
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
126 (len (length args))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
127 this-char)
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
128 (if args
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
129 (progn
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
130 ;;; replace non-printable stuff with spaces
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
131 (while (< beg (length args))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
132 (if (or (> 33 (setq this-char (aref args beg)))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
133 (< 127 this-char))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
134 (aset args beg 32))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
135 (setq beg (1+ beg)))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
136 (setq beg (1- (length args)))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
137 (while (= 32 (aref args beg)) (setq beg (1- beg)))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
138 (setq args (substring args 0 (1+ beg)))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
139 (setq beg 0)
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
140 ;;; now start parsing args
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
141 (while (< beg (length args))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
142 (while (and (< beg (length args))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
143 (or (> 33 (setq this-char (aref args beg)))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
144 (< 127 this-char))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
145 (setq beg (1+ beg))))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
146 (setq end (1+ beg))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
147 (while (and (< end (length args))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
148 (< 32 (setq this-char (aref args end)))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
149 (> 127 this-char))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
150 (setq end (1+ end)))
49597
e88404e8f2cf Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 38412
diff changeset
151 (setq command-line-args (append
1174
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
152 command-line-args
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
153 (list (substring args beg end))))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
154 (setq beg (1+ end)))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
155 (command-line)))))
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
156
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
157 (defun vms-read-directory (dirname switches buffer)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
158 (save-excursion
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
159 (set-buffer buffer)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
160 (subprocess-command-to-buffer
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
161 (concat "DIRECTORY " switches " " dirname)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
162 buffer)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
163 (goto-char (point-min))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
164 ;; Remove all the trailing blanks.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
165 (while (search-forward " \n")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
166 (forward-char -1)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
167 (delete-horizontal-space))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
168 (goto-char (point-min))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
169
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
170 (setq dired-listing-switches
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
171 "/SIZE/DATE/OWNER/WIDTH=(FILENAME=32,SIZE=5)")
156
29a528f78681 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
172
29a528f78681 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
173 (setq print-region-function
31658
d4105bd038d0 (print-region-function): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 17245
diff changeset
174 (lambda (start end command ign1 ign2 ign3 &rest switches)
156
29a528f78681 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
175 (write-region start end "sys$login:delete-me.txt")
29a528f78681 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
176 (send-command-to-subprocess
29a528f78681 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
177 1
29a528f78681 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
178 (concat command
2864
9c3bf565b354 * bibtex.el (bibtex-string): Use \" instead of "" to get a double
Jim Blandy <jimb@redhat.com>
parents: 1174
diff changeset
179 " sys$login:delete-me.txt/name=\"GNUprintbuffer\" "
156
29a528f78681 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
180 (mapconcat 'identity switches " "))
29a528f78681 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 36
diff changeset
181 nil nil nil)))
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 156
diff changeset
182
1174
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
183 ;;;
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
184 ;;; Fuctions for using Emacs as a VMS Mail editor
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
185 ;;;
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
186 (autoload 'vms-pmail-setup "vms-pmail"
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
187 "Set up file assuming use by VMS Mail utility.
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
188 The buffer is put into text-mode, auto-save is turned off and the
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
189 following bindings are established.
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
190
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
191 \\[vms-pmail-save-and-exit] vms-pmail-save-and-exit
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
192 \\[vms-pmail-abort] vms-pmail-abort
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
193
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
194 All other Emacs commands are still available."
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
195 t)
69fc2c96e27e entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 840
diff changeset
196
62700
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
197 ;;;
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
198 ;;; Filename handling in the minibuffer
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
199 ;;;
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
200 (defun vms-magic-right-square-brace ()
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
201 "\
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
202 Insert a right square brace, but do other things first depending on context.
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
203 During filename completion, when point is at the end of the line and the
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
204 character before is not a right square brace, do one of three things before
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
205 inserting the brace:
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
206 - If there are already two left square braces preceding, do nothing special.
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
207 - If there is a previous right-square-brace, convert it to dot.
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
208 - If the character before is dot, delete it.
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
209 Additionally, if the preceding chars are right-square-brace followed by
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
210 either \"-\" or \"..\", strip one level of directory hierarchy."
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
211 (interactive)
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
212 (when (and minibuffer-completing-file-name
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
213 (= (point) (point-max))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
214 (not (= 93 (char-before))))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
215 (cond
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
216 ;; Avoid clobbering: user:[one.path][another.path
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
217 ((search-backward "[" (field-beginning) t 2))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
218 ((search-backward "]" (field-beginning) t)
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
219 (delete-char 1)
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
220 (insert ".")
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
221 (goto-char (point-max)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
222 ((= ?. (char-before))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
223 (delete-char -1)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
224 (goto-char (point-max))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
225 (let ((specs '(".." "-"))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
226 (pmax (point-max)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
227 (while specs
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
228 (let* ((up (car specs))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
229 (len (length up))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
230 (cut (- (point) len)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
231 (when (and (< (1+ len) pmax)
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
232 (= ?. (char-before cut))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
233 (string= up (buffer-substring cut (point))))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
234 (delete-char (- (1+ len)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
235 (while (not (let ((c (char-before)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
236 (or (= ?. c) (= 91 c))))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
237 (delete-char -1))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
238 (when (= ?. (char-before)) (delete-char -1))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
239 (setq specs nil)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
240 (setq specs (cdr specs)))))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
241 (insert "]"))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
242
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
243 (defun vms-magic-colon ()
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
244 "\
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
245 Insert a colon, but do other things first depending on context.
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
246 During filename completion, when point is at the end of the line
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
247 and the line contains a right square brace, remove all characters
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
248 from the beginning of the line up to and including such brace.
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
249 This enables one to type a new filespec without having to delete
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
250 the old one."
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
251 (interactive)
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
252 (when (and minibuffer-completing-file-name
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
253 (= (point) (point-max))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
254 (search-backward "]" (field-beginning) t))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
255 (delete-region (field-beginning) (1+ (point)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
256 (goto-char (point-max)))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
257 (insert ":"))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
258
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
259 (let ((m minibuffer-local-completion-map))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
260 (define-key m "]" 'vms-magic-right-square-brace)
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
261 (define-key m "/" 'vms-magic-right-square-brace)
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
262 (define-key m ":" 'vms-magic-colon))
11dc1e2caaf0 (vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 62402
diff changeset
263
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49597
diff changeset
264 ;;; arch-tag: c178494e-2c37-4d02-99b7-e47e615656cf
657
fec3f9a1e3e5 *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 156
diff changeset
265 ;;; vms-patch.el ends here