Mercurial > emacs
annotate lisp/vms-patch.el @ 95925:6e1d885ba36a
Remove option of licensing under GPL.
Add Cover-Texts to GFDL permissions notice.
(GPL): Remove section.
(GFDL): Include doclicense.texi rather than the actual text.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sun, 15 Jun 2008 02:17:13 +0000 |
parents | ee5932bf781d |
children |
rev | line source |
---|---|
86503
2c08ad76fc1f
* progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85510
diff
changeset
|
1 ;; -*- no-byte-compile: t -*- |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
31658
diff
changeset
|
2 ;;; 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
|
3 |
74442 | 4 ;; Copyright (C) 1986, 1992, 2001, 2002, 2003, 2004, |
79721 | 5 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
840
113281b361ec
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
812
diff
changeset
|
6 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
7 ;; Maintainer: FSF |
812
485e82a8acb5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
8 ;; Keywords: vms |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
9 |
36 | 10 ;; This file is part of GNU Emacs. |
11 | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
36 | 13 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
15 ;; (at your option) any later version. |
36 | 16 |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93975
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
36 | 24 |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
31658
diff
changeset
|
25 ;;; Commentary: |
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
31658
diff
changeset
|
26 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
657
diff
changeset
|
27 ;;; Code: |
36 | 28 |
85510
e2eac01cf548
* progmodes/prolog.el: Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85478
diff
changeset
|
29 (defvar print-region-function) |
85478
786d3a985758
* term/x-win.el (x-gtk-stock-map, icon-map-list)
Dan Nicolaescu <dann@ics.uci.edu>
parents:
78236
diff
changeset
|
30 |
17245
12e32a06de22
(auto-mode-alist): Add .com element.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
31 (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
|
32 |
36 | 33 ;;; Functions that need redefinition |
34 | |
35 ;;; VMS file names are upper case, but buffer names are more | |
36 ;;; convenient in lower case. | |
37 | |
38 (defun create-file-buffer (filename) | |
39 "Create a suitably named buffer for visiting FILENAME, and return it. | |
40 FILENAME (sans directory) is used unchanged if that name is free; | |
41 otherwise a string <2> or <3> or ... is appended to get an unused name." | |
42 (generate-new-buffer (downcase (file-name-nondirectory filename)))) | |
43 | |
92529
7b55b0a875cc
(make-legal-file-name): New obsolete alias.
Juanma Barranquero <lekktu@gmail.com>
parents:
87649
diff
changeset
|
44 ;;; Given a string FN, return a similar name which is a valid VMS filename. |
36 | 45 ;;; This is used to avoid invalid auto save file names. |
92529
7b55b0a875cc
(make-legal-file-name): New obsolete alias.
Juanma Barranquero <lekktu@gmail.com>
parents:
87649
diff
changeset
|
46 (defun make-valid-file-name (fn) |
36 | 47 (setq fn (copy-sequence fn)) |
48 (let ((dot nil) (indx 0) (len (length fn)) chr) | |
49 (while (< indx len) | |
50 (setq chr (aref fn indx)) | |
51 (cond | |
52 ((eq chr ?.) (if dot (aset fn indx ?_) (setq dot t))) | |
53 ((not (or (and (>= chr ?a) (<= chr ?z)) (and (>= chr ?A) (<= chr ?Z)) | |
54 (and (>= chr ?0) (<= chr ?9)) | |
55 (eq chr ?$) (eq chr ?_) (and (eq chr ?-) (> indx 0)))) | |
56 (aset fn indx ?_))) | |
57 (setq indx (1+ indx)))) | |
58 fn) | |
59 | |
92529
7b55b0a875cc
(make-legal-file-name): New obsolete alias.
Juanma Barranquero <lekktu@gmail.com>
parents:
87649
diff
changeset
|
60 (define-obsolete-function-alias 'make-legal-file-name 'make-valid-file-name "23.1") |
7b55b0a875cc
(make-legal-file-name): New obsolete alias.
Juanma Barranquero <lekktu@gmail.com>
parents:
87649
diff
changeset
|
61 |
36 | 62 ;;; Auto save filesnames start with _$ and end with $. |
63 | |
64 (defun make-auto-save-file-name () | |
65 "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
|
66 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
|
67 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
|
68 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
|
69 `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
|
70 See also `auto-save-file-name-p'." |
36 | 71 (if buffer-file-name |
72 (concat (file-name-directory buffer-file-name) | |
73 "_$" | |
74 (file-name-nondirectory buffer-file-name) | |
75 "$") | |
92529
7b55b0a875cc
(make-legal-file-name): New obsolete alias.
Juanma Barranquero <lekktu@gmail.com>
parents:
87649
diff
changeset
|
76 (expand-file-name (concat "_$_" (make-valid-file-name (buffer-name)) "$")))) |
36 | 77 |
78 (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
|
79 "Return t if FILENAME can be yielded by `make-auto-save-file-name'. |
36 | 80 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
|
81 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
|
82 `site-init.el' can redefine it." |
36 | 83 (string-match "^_\\$.*\\$" filename)) |
84 | |
1174 | 85 ;;; |
86 ;;; This goes along with kepteditor.com which defines these logicals | |
87 ;;; If EMACS_COMMAND_ARGS is defined, it supersedes EMACS_FILE_NAME, | |
88 ;;; which is probably set up incorrectly anyway. | |
89 ;;; The function command-line-again is a kludge, but it does the job. | |
90 ;;; | |
36 | 91 (defun vms-suspend-resume-hook () |
92 "When resuming suspended Emacs, check for file to be found. | |
93 If the logical name `EMACS_FILE_NAME' is defined, `find-file' that file." | |
1174 | 94 (let ((file (vms-system-info "LOGICAL" "EMACS_FILE_NAME")) |
95 (args (vms-system-info "LOGICAL" "EMACS_COMMAND_ARGS")) | |
96 (line (vms-system-info "LOGICAL" "EMACS_FILE_LINE"))) | |
97 (if (not args) | |
98 (if file | |
99 (progn (find-file file) | |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
100 (if line (goto-line (string-to-number line))))) |
1174 | 101 (cd (file-name-directory file)) |
102 (vms-command-line-again)))) | |
36 | 103 |
104 (setq suspend-resume-hook 'vms-suspend-resume-hook) | |
105 | |
106 (defun vms-suspend-hook () | |
107 "Don't allow suspending if logical name `DONT_SUSPEND_EMACS' is defined." | |
108 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") | |
109 (error "Can't suspend this emacs")) | |
110 nil) | |
111 | |
112 (setq suspend-hook 'vms-suspend-hook) | |
113 | |
1174 | 114 ;;; |
115 ;;; A kludge that allows reprocessing of the command line. This is mostly | |
116 ;;; to allow a spawned VMS mail process to do something reasonable when | |
117 ;;; used in conjunction with the modifications to sysdep.c that allow | |
118 ;;; Emacs to attach to a "foster" parent. | |
119 ;;; | |
120 (defun vms-command-line-again () | |
121 "Reprocess command line arguments. VMS specific. | |
122 Command line arguments are initialized from the logical EMACS_COMMAND_ARGS | |
123 which is defined by kepteditor.com. On VMS this allows attaching to a | |
124 spawned Emacs and doing things like \"emacs -l myfile.el -f doit\"" | |
125 (let* ((args (downcase (vms-system-info "LOGICAL" "EMACS_COMMAND_ARGS"))) | |
126 (command-line-args (list "emacs")) | |
127 (beg 0) | |
128 (end 0) | |
129 (len (length args)) | |
130 this-char) | |
131 (if args | |
132 (progn | |
133 ;;; replace non-printable stuff with spaces | |
134 (while (< beg (length args)) | |
135 (if (or (> 33 (setq this-char (aref args beg))) | |
136 (< 127 this-char)) | |
137 (aset args beg 32)) | |
138 (setq beg (1+ beg))) | |
139 (setq beg (1- (length args))) | |
140 (while (= 32 (aref args beg)) (setq beg (1- beg))) | |
141 (setq args (substring args 0 (1+ beg))) | |
142 (setq beg 0) | |
143 ;;; now start parsing args | |
144 (while (< beg (length args)) | |
145 (while (and (< beg (length args)) | |
146 (or (> 33 (setq this-char (aref args beg))) | |
147 (< 127 this-char)) | |
148 (setq beg (1+ beg)))) | |
149 (setq end (1+ beg)) | |
150 (while (and (< end (length args)) | |
151 (< 32 (setq this-char (aref args end))) | |
152 (> 127 this-char)) | |
153 (setq end (1+ end))) | |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
154 (setq command-line-args (append |
1174 | 155 command-line-args |
156 (list (substring args beg end)))) | |
157 (setq beg (1+ end))) | |
158 (command-line))))) | |
159 | |
36 | 160 (defun vms-read-directory (dirname switches buffer) |
161 (save-excursion | |
162 (set-buffer buffer) | |
163 (subprocess-command-to-buffer | |
164 (concat "DIRECTORY " switches " " dirname) | |
165 buffer) | |
166 (goto-char (point-min)) | |
167 ;; Remove all the trailing blanks. | |
168 (while (search-forward " \n") | |
169 (forward-char -1) | |
170 (delete-horizontal-space)) | |
171 (goto-char (point-min)))) | |
172 | |
173 (setq dired-listing-switches | |
174 "/SIZE/DATE/OWNER/WIDTH=(FILENAME=32,SIZE=5)") | |
156 | 175 |
176 (setq print-region-function | |
31658
d4105bd038d0
(print-region-function): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
17245
diff
changeset
|
177 (lambda (start end command ign1 ign2 ign3 &rest switches) |
156 | 178 (write-region start end "sys$login:delete-me.txt") |
179 (send-command-to-subprocess | |
180 1 | |
181 (concat command | |
2864
9c3bf565b354
* bibtex.el (bibtex-string): Use \" instead of "" to get a double
Jim Blandy <jimb@redhat.com>
parents:
1174
diff
changeset
|
182 " sys$login:delete-me.txt/name=\"GNUprintbuffer\" " |
156 | 183 (mapconcat 'identity switches " ")) |
184 nil nil nil))) | |
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
156
diff
changeset
|
185 |
1174 | 186 ;;; |
187 ;;; Fuctions for using Emacs as a VMS Mail editor | |
188 ;;; | |
189 (autoload 'vms-pmail-setup "vms-pmail" | |
190 "Set up file assuming use by VMS Mail utility. | |
191 The buffer is put into text-mode, auto-save is turned off and the | |
192 following bindings are established. | |
193 | |
194 \\[vms-pmail-save-and-exit] vms-pmail-save-and-exit | |
195 \\[vms-pmail-abort] vms-pmail-abort | |
196 | |
197 All other Emacs commands are still available." | |
198 t) | |
199 | |
62700
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
200 ;;; |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
201 ;;; 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
|
202 ;;; |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
203 (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
|
204 "\ |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
205 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
|
206 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
|
207 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
|
208 inserting the brace: |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
209 - 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
|
210 - 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
|
211 - 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
|
212 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
|
213 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
|
214 (interactive) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
215 (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
|
216 (= (point) (point-max)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
217 (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
|
218 (cond |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
219 ;; 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
|
220 ((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
|
221 ((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
|
222 (delete-char 1) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
223 (insert ".") |
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 ((= ?. (char-before)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
226 (delete-char -1))) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
227 (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
|
228 (let ((specs '(".." "-")) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
229 (pmax (point-max))) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
230 (while specs |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
231 (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
|
232 (len (length up)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
233 (cut (- (point) len))) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
234 (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
|
235 (= ?. (char-before cut)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
236 (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
|
237 (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
|
238 (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
|
239 (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
|
240 (delete-char -1)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
241 (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
|
242 (setq specs nil))) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
243 (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
|
244 (insert "]")) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
245 |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
246 (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
|
247 "\ |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
248 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
|
249 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
|
250 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
|
251 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
|
252 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
|
253 the old one." |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
254 (interactive) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
255 (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
|
256 (= (point) (point-max)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
257 (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
|
258 (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
|
259 (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
|
260 (insert ":")) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
261 |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
262 (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
|
263 (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
|
264 (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
|
265 (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
|
266 |
93975
1e3a407766b9
Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
92529
diff
changeset
|
267 ;; arch-tag: c178494e-2c37-4d02-99b7-e47e615656cf |
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
156
diff
changeset
|
268 ;;; vms-patch.el ends here |