comparison lisp/emulation/viper-ex.el @ 20003:9bc6a4017c8c

new version
author Michael Kifer <kifer@cs.stonybrook.edu>
date Tue, 30 Sep 1997 01:13:53 +0000
parents 9a24e495d968
children f44ff2c52fac
comparison
equal deleted inserted replaced
20002:e89847e2df84 20003:9bc6a4017c8c
105 (defvar ex-token-type nil) 105 (defvar ex-token-type nil)
106 106
107 ;; List of addresses passed to Ex command 107 ;; List of addresses passed to Ex command
108 (defvar ex-addresses nil) 108 (defvar ex-addresses nil)
109 109
110 ;; It seems that this flag is used only for `#', `print', and `list', which 110 ;; This flag is supposed to be set only by `#', `print', and `list',
111 ;; aren't implemented. Check later. 111 ;; none of which is implemented. So, it and the pices of the code it
112 ;; controls are dead weight. We keep it just in case this might be
113 ;; needed in the future.
112 (defvar ex-flag nil) 114 (defvar ex-flag nil)
113 115
114 ;; "buffer" where Ex commands keep deleted data. 116 ;; "buffer" where Ex commands keep deleted data.
115 ;; In Emacs terms, this is a register. 117 ;; In Emacs terms, this is a register.
116 (defvar ex-buffer nil) 118 (defvar ex-buffer nil)
1132 (if del-flag 1134 (if del-flag
1133 (kill-region (point) (mark t)) 1135 (kill-region (point) (mark t))
1134 (copy-region-as-kill (point) (mark t))) 1136 (copy-region-as-kill (point) (mark t)))
1135 (if ex-flag 1137 (if ex-flag
1136 (progn 1138 (progn
1137 (with-output-to-temp-buffer "*copy text*" 1139 (with-output-to-temp-buffer " *copy text*"
1138 (princ 1140 (princ
1139 (if (or del-flag ex-g-flag ex-g-variant) 1141 (if (or del-flag ex-g-flag ex-g-variant)
1140 (current-kill 0) 1142 (current-kill 0)
1141 (buffer-substring (point) (mark t))))) 1143 (buffer-substring (point) (mark t)))))
1142 (condition-case nil 1144 (condition-case nil
1143 (progn 1145 (progn
1144 (read-string "[Hit return to continue] ") 1146 (read-string "[Hit return to confirm] ")
1145 (save-excursion (kill-buffer "*copy text*"))) 1147 (save-excursion (kill-buffer " *copy text*")))
1146 (quit (save-excursion (kill-buffer "*copy text*")) 1148 (quit (save-excursion (kill-buffer " *copy text*"))
1147 (signal 'quit nil)))))) 1149 (signal 'quit nil))))))
1148 (if (= address 0) 1150 (if (= address 0)
1149 (goto-char (point-min)) 1151 (goto-char (point-min))
1150 (goto-char address) 1152 (goto-char address)
1151 (forward-line 1)) 1153 (forward-line 1))
1170 ;; show text to be deleted and ask for confirmation 1172 ;; show text to be deleted and ask for confirmation
1171 (progn 1173 (progn
1172 (with-output-to-temp-buffer " *delete text*" 1174 (with-output-to-temp-buffer " *delete text*"
1173 (princ (buffer-substring (point) (mark t)))) 1175 (princ (buffer-substring (point) (mark t))))
1174 (condition-case nil 1176 (condition-case nil
1175 (read-string "[Hit return to continue] ") 1177 (read-string "[Hit return to confirm] ")
1176 (quit 1178 (quit
1177 (save-excursion (kill-buffer " *delete text*")) 1179 (save-excursion (kill-buffer " *delete text*"))
1178 (error ""))) 1180 (error "")))
1179 (save-excursion (kill-buffer " *delete text*"))) 1181 (save-excursion (kill-buffer " *delete text*")))
1180 (if ex-buffer 1182 (if ex-buffer
1347 (set-mark (point)) 1349 (set-mark (point))
1348 (forward-line ex-count))) 1350 (forward-line ex-count)))
1349 (if ex-flag 1351 (if ex-flag
1350 ;; show text to be joined and ask for confirmation 1352 ;; show text to be joined and ask for confirmation
1351 (progn 1353 (progn
1352 (with-output-to-temp-buffer " *text*" 1354 (with-output-to-temp-buffer " *join text*"
1353 (princ (buffer-substring (point) (mark t)))) 1355 (princ (buffer-substring (point) (mark t))))
1354 (condition-case nil 1356 (condition-case nil
1355 (progn 1357 (progn
1356 (read-string "[Hit return to continue] ") 1358 (read-string "[Hit return to confirm] ")
1357 (ex-line-subr com (point) (mark t))) 1359 (ex-line-subr com (point) (mark t)))
1358 (quit (ding))) 1360 (quit (ding)))
1359 (save-excursion (kill-buffer " *text*"))) 1361 (save-excursion (kill-buffer " *join text*")))
1360 (ex-line-subr com (point) (mark t))) 1362 (ex-line-subr com (point) (mark t)))
1361 (setq point (point))) 1363 (setq point (point)))
1362 (goto-char (1- point)) 1364 (goto-char (1- point))
1363 (beginning-of-line))) 1365 (beginning-of-line)))
1364 1366
2113 (if (< (+ 1 (length info) (length file)) 2115 (if (< (+ 1 (length info) (length file))
2114 (window-width (minibuffer-window))) 2116 (window-width (minibuffer-window)))
2115 (message (concat file " " info)) 2117 (message (concat file " " info))
2116 (save-window-excursion 2118 (save-window-excursion
2117 (with-output-to-temp-buffer " *viper-info*" 2119 (with-output-to-temp-buffer " *viper-info*"
2118 (princ (concat "\n" 2120 (princ (concat "\n" file "\n\n\t" info "\n\n")))
2119 file "\n\n\t" info 2121 (let ((inhibit-quit t))
2120 "\n\n\nPress any key to continue...\n\n"))) 2122 (viper-set-unread-command-events (viper-read-event)))
2121 (viper-read-event)
2122 (kill-buffer " *viper-info*"))) 2123 (kill-buffer " *viper-info*")))
2123 )) 2124 ))
2124 2125
2125 ;; display all variables set through :set 2126 ;; display all variables set through :set
2126 (defun ex-show-vars () 2127 (defun ex-show-vars ()