Mercurial > emacs
annotate lisp/vms-patch.el @ 86170:e6b555f6c76b
(ring-size, ring-p, ring-insert, ring-length, ring-empty-p): Use c[ad]dr.
(ring-plus1): Use `1+'.
(ring-minus1): Use `zerop'.
(ring-remove): Use c[ad]dr. Use `when'.
(ring-copy): Use c[ad]dr. Use `let', not `let*'.
(ring-ref): Use `let', not `let*'.
(ring-insert-at-beginning): Use c[ad]dr. Doc fix.
(ring-insert+extend): Use c[ad]dr. Fix typo in docstring.
(ring-member): Simplify. Doc fix.
(ring-convert-sequence-to-ring): Simplify.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Sat, 17 Nov 2007 02:50:37 +0000 |
parents | e2eac01cf548 |
children | 2c08ad76fc1f 4bc33ffdda1a |
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 | 3 ;; Copyright (C) 1986, 1992, 2001, 2002, 2003, 2004, |
75347 | 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 | 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 | |
78236
9355f9b7bbff
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75347
diff
changeset
|
13 ;; the Free Software Foundation; either version 3, 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 | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64091 | 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
24 ;; Boston, MA 02110-1301, USA. | |
36 | 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 | 29 |
85510
e2eac01cf548
* progmodes/prolog.el: Undo previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
85478
diff
changeset
|
30 (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
|
31 |
17245
12e32a06de22
(auto-mode-alist): Add .com element.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
32 (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
|
33 |
36 | 34 ;;; Functions that need redefinition |
35 | |
36 ;;; VMS file names are upper case, but buffer names are more | |
37 ;;; convenient in lower case. | |
38 | |
39 (defun create-file-buffer (filename) | |
40 "Create a suitably named buffer for visiting FILENAME, and return it. | |
41 FILENAME (sans directory) is used unchanged if that name is free; | |
42 otherwise a string <2> or <3> or ... is appended to get an unused name." | |
43 (generate-new-buffer (downcase (file-name-nondirectory filename)))) | |
44 | |
45 ;;; Given a string FN, return a similar name which is a legal VMS filename. | |
46 ;;; This is used to avoid invalid auto save file names. | |
47 (defun make-legal-file-name (fn) | |
48 (setq fn (copy-sequence fn)) | |
49 (let ((dot nil) (indx 0) (len (length fn)) chr) | |
50 (while (< indx len) | |
51 (setq chr (aref fn indx)) | |
52 (cond | |
53 ((eq chr ?.) (if dot (aset fn indx ?_) (setq dot t))) | |
54 ((not (or (and (>= chr ?a) (<= chr ?z)) (and (>= chr ?A) (<= chr ?Z)) | |
55 (and (>= chr ?0) (<= chr ?9)) | |
56 (eq chr ?$) (eq chr ?_) (and (eq chr ?-) (> indx 0)))) | |
57 (aset fn indx ?_))) | |
58 (setq indx (1+ indx)))) | |
59 fn) | |
60 | |
61 ;;; Auto save filesnames start with _$ and end with $. | |
62 | |
63 (defun make-auto-save-file-name () | |
64 "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
|
65 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
|
66 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
|
67 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
|
68 `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
|
69 See also `auto-save-file-name-p'." |
36 | 70 (if buffer-file-name |
71 (concat (file-name-directory buffer-file-name) | |
72 "_$" | |
73 (file-name-nondirectory buffer-file-name) | |
74 "$") | |
75 (expand-file-name (concat "_$_" (make-legal-file-name (buffer-name)) "$")))) | |
76 | |
77 (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
|
78 "Return t if FILENAME can be yielded by `make-auto-save-file-name'. |
36 | 79 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
|
80 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
|
81 `site-init.el' can redefine it." |
36 | 82 (string-match "^_\\$.*\\$" filename)) |
83 | |
1174 | 84 ;;; |
85 ;;; This goes along with kepteditor.com which defines these logicals | |
86 ;;; If EMACS_COMMAND_ARGS is defined, it supersedes EMACS_FILE_NAME, | |
87 ;;; which is probably set up incorrectly anyway. | |
88 ;;; The function command-line-again is a kludge, but it does the job. | |
89 ;;; | |
36 | 90 (defun vms-suspend-resume-hook () |
91 "When resuming suspended Emacs, check for file to be found. | |
92 If the logical name `EMACS_FILE_NAME' is defined, `find-file' that file." | |
1174 | 93 (let ((file (vms-system-info "LOGICAL" "EMACS_FILE_NAME")) |
94 (args (vms-system-info "LOGICAL" "EMACS_COMMAND_ARGS")) | |
95 (line (vms-system-info "LOGICAL" "EMACS_FILE_LINE"))) | |
96 (if (not args) | |
97 (if file | |
98 (progn (find-file file) | |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
52401
diff
changeset
|
99 (if line (goto-line (string-to-number line))))) |
1174 | 100 (cd (file-name-directory file)) |
101 (vms-command-line-again)))) | |
36 | 102 |
103 (setq suspend-resume-hook 'vms-suspend-resume-hook) | |
104 | |
105 (defun vms-suspend-hook () | |
106 "Don't allow suspending if logical name `DONT_SUSPEND_EMACS' is defined." | |
107 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") | |
108 (error "Can't suspend this emacs")) | |
109 nil) | |
110 | |
111 (setq suspend-hook 'vms-suspend-hook) | |
112 | |
1174 | 113 ;;; |
114 ;;; A kludge that allows reprocessing of the command line. This is mostly | |
115 ;;; to allow a spawned VMS mail process to do something reasonable when | |
116 ;;; used in conjunction with the modifications to sysdep.c that allow | |
117 ;;; Emacs to attach to a "foster" parent. | |
118 ;;; | |
119 (defun vms-command-line-again () | |
120 "Reprocess command line arguments. VMS specific. | |
121 Command line arguments are initialized from the logical EMACS_COMMAND_ARGS | |
122 which is defined by kepteditor.com. On VMS this allows attaching to a | |
123 spawned Emacs and doing things like \"emacs -l myfile.el -f doit\"" | |
124 (let* ((args (downcase (vms-system-info "LOGICAL" "EMACS_COMMAND_ARGS"))) | |
125 (command-line-args (list "emacs")) | |
126 (beg 0) | |
127 (end 0) | |
128 (len (length args)) | |
129 this-char) | |
130 (if args | |
131 (progn | |
132 ;;; replace non-printable stuff with spaces | |
133 (while (< beg (length args)) | |
134 (if (or (> 33 (setq this-char (aref args beg))) | |
135 (< 127 this-char)) | |
136 (aset args beg 32)) | |
137 (setq beg (1+ beg))) | |
138 (setq beg (1- (length args))) | |
139 (while (= 32 (aref args beg)) (setq beg (1- beg))) | |
140 (setq args (substring args 0 (1+ beg))) | |
141 (setq beg 0) | |
142 ;;; now start parsing args | |
143 (while (< beg (length args)) | |
144 (while (and (< beg (length args)) | |
145 (or (> 33 (setq this-char (aref args beg))) | |
146 (< 127 this-char)) | |
147 (setq beg (1+ beg)))) | |
148 (setq end (1+ beg)) | |
149 (while (and (< end (length args)) | |
150 (< 32 (setq this-char (aref args end))) | |
151 (> 127 this-char)) | |
152 (setq end (1+ end))) | |
49597
e88404e8f2cf
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
38412
diff
changeset
|
153 (setq command-line-args (append |
1174 | 154 command-line-args |
155 (list (substring args beg end)))) | |
156 (setq beg (1+ end))) | |
157 (command-line))))) | |
158 | |
36 | 159 (defun vms-read-directory (dirname switches buffer) |
160 (save-excursion | |
161 (set-buffer buffer) | |
162 (subprocess-command-to-buffer | |
163 (concat "DIRECTORY " switches " " dirname) | |
164 buffer) | |
165 (goto-char (point-min)) | |
166 ;; Remove all the trailing blanks. | |
167 (while (search-forward " \n") | |
168 (forward-char -1) | |
169 (delete-horizontal-space)) | |
170 (goto-char (point-min)))) | |
171 | |
172 (setq dired-listing-switches | |
173 "/SIZE/DATE/OWNER/WIDTH=(FILENAME=32,SIZE=5)") | |
156 | 174 |
175 (setq print-region-function | |
31658
d4105bd038d0
(print-region-function): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
17245
diff
changeset
|
176 (lambda (start end command ign1 ign2 ign3 &rest switches) |
156 | 177 (write-region start end "sys$login:delete-me.txt") |
178 (send-command-to-subprocess | |
179 1 | |
180 (concat command | |
2864
9c3bf565b354
* bibtex.el (bibtex-string): Use \" instead of "" to get a double
Jim Blandy <jimb@redhat.com>
parents:
1174
diff
changeset
|
181 " sys$login:delete-me.txt/name=\"GNUprintbuffer\" " |
156 | 182 (mapconcat 'identity switches " ")) |
183 nil nil nil))) | |
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
156
diff
changeset
|
184 |
1174 | 185 ;;; |
186 ;;; Fuctions for using Emacs as a VMS Mail editor | |
187 ;;; | |
188 (autoload 'vms-pmail-setup "vms-pmail" | |
189 "Set up file assuming use by VMS Mail utility. | |
190 The buffer is put into text-mode, auto-save is turned off and the | |
191 following bindings are established. | |
192 | |
193 \\[vms-pmail-save-and-exit] vms-pmail-save-and-exit | |
194 \\[vms-pmail-abort] vms-pmail-abort | |
195 | |
196 All other Emacs commands are still available." | |
197 t) | |
198 | |
62700
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 ;;; 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
|
201 ;;; |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
202 (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
|
203 "\ |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 inserting the brace: |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
208 - 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
|
209 - 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
|
210 - 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
|
211 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
|
212 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
|
213 (interactive) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
214 (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
|
215 (= (point) (point-max)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
216 (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
|
217 (cond |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
218 ;; 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
|
219 ((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
|
220 ((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
|
221 (delete-char 1) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
222 (insert ".") |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
223 (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
|
224 ((= ?. (char-before)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
225 (delete-char -1))) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
226 (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
|
227 (let ((specs '(".." "-")) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
228 (pmax (point-max))) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
229 (while specs |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
230 (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
|
231 (len (length up)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
232 (cut (- (point) len))) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
233 (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
|
234 (= ?. (char-before cut)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
235 (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
|
236 (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
|
237 (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
|
238 (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
|
239 (delete-char -1)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
240 (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
|
241 (setq specs nil))) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
242 (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
|
243 (insert "]")) |
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 (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
|
246 "\ |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
247 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
|
248 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
|
249 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
|
250 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
|
251 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
|
252 the old one." |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
253 (interactive) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
254 (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
|
255 (= (point) (point-max)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
256 (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
|
257 (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
|
258 (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
|
259 (insert ":")) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
260 |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
261 (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
|
262 (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
|
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-colon)) |
11dc1e2caaf0
(vms-magic-right-square-brace, vms-magic-colon): New funcs.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents:
62402
diff
changeset
|
265 |
52401 | 266 ;;; arch-tag: c178494e-2c37-4d02-99b7-e47e615656cf |
657
fec3f9a1e3e5
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
156
diff
changeset
|
267 ;;; vms-patch.el ends here |