Mercurial > emacs
comparison lisp/emulation/tpu-edt.el @ 11546:66db15ec8ad8
Don't turn on tpu-edt mode.
(tpu-gnu-emacs19-p): Function deleted. Callers changed.
(tpu-load-xkeys): Use file name .tpu-keys by default.
(tpu-gnu-emacs18-p): Function deleted.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 25 Apr 1995 00:37:27 +0000 |
parents | ad36865ac28e |
children | 11a7257fc6fa |
comparison
equal
deleted
inserted
replaced
11545:a91fcb58e8d2 | 11546:66db15ec8ad8 |
---|---|
57 ;;; o tpu-string-prompt o tpu-regexp-prompt | 57 ;;; o tpu-string-prompt o tpu-regexp-prompt |
58 ;;; o tpu-edt-on o tpu-load-xkeys | 58 ;;; o tpu-edt-on o tpu-load-xkeys |
59 ;;; o tpu-update-mode-line o mode line section | 59 ;;; o tpu-update-mode-line o mode line section |
60 ;;; | 60 ;;; |
61 (defconst tpu-emacs19-p (not (string-lessp emacs-version "19")) | 61 (defconst tpu-emacs19-p (not (string-lessp emacs-version "19")) |
62 "Non-NIL if we are running Lucid or GNU Emacs version 19.") | 62 "Non-nil if we are running Lucid Emacs or version 19.") |
63 | |
64 (defconst tpu-gnu-emacs18-p (not tpu-emacs19-p) | |
65 "Non-NIL if we are running GNU Emacs version 18.") | |
66 | 63 |
67 (defconst tpu-lucid-emacs19-p | 64 (defconst tpu-lucid-emacs19-p |
68 (and tpu-emacs19-p (string-match "Lucid" emacs-version)) | 65 (and tpu-emacs19-p (string-match "Lucid" emacs-version)) |
69 "Non-NIL if we are running Lucid Emacs version 19.") | 66 "Non-nil if we are running Lucid Emacs version 19.") |
70 | |
71 (defconst tpu-gnu-emacs19-p (and tpu-emacs19-p (not tpu-lucid-emacs19-p)) | |
72 "Non-NIL if we are running GNU Emacs version 19.") | |
73 | 67 |
74 | 68 |
75 ;;; | 69 ;;; |
76 ;;; Global Keymaps | 70 ;;; Global Keymaps |
77 ;;; | 71 ;;; |
97 (defvar tpu-original-global-map (copy-keymap global-map) | 91 (defvar tpu-original-global-map (copy-keymap global-map) |
98 "Original global keymap.") | 92 "Original global keymap.") |
99 | 93 |
100 (and tpu-lucid-emacs19-p | 94 (and tpu-lucid-emacs19-p |
101 (defvar minibuffer-local-ns-map (make-sparse-keymap) | 95 (defvar minibuffer-local-ns-map (make-sparse-keymap) |
102 "Hack to give Lucid emacs the same maps as GNU emacs.")) | 96 "Hack to give Lucid Emacs the same maps as ordinary Emacs.")) |
103 | 97 |
104 | 98 |
105 ;;; | 99 ;;; |
106 ;;; Global Variables | 100 ;;; Global Variables |
107 ;;; | 101 ;;; |
222 "Make sure mode-line in the current buffer reflects all changes." | 216 "Make sure mode-line in the current buffer reflects all changes." |
223 (setq tpu-mark-flag (if (tpu-mark) "M" " ")) | 217 (setq tpu-mark-flag (if (tpu-mark) "M" " ")) |
224 (cond (tpu-emacs19-p (force-mode-line-update)) | 218 (cond (tpu-emacs19-p (force-mode-line-update)) |
225 (t (set-buffer-modified-p (buffer-modified-p)) (sit-for 0)))) | 219 (t (set-buffer-modified-p (buffer-modified-p)) (sit-for 0)))) |
226 | 220 |
227 (cond (tpu-gnu-emacs19-p | 221 (cond (tpu-lucid-emacs19-p |
222 (add-hook 'zmacs-deactivate-region-hook 'tpu-update-mode-line) | |
223 (add-hook 'zmacs-activate-region-hook 'tpu-update-mode-line)) | |
224 (tpu-emacs19-p | |
228 (add-hook 'activate-mark-hook 'tpu-update-mode-line) | 225 (add-hook 'activate-mark-hook 'tpu-update-mode-line) |
229 (add-hook 'deactivate-mark-hook 'tpu-update-mode-line)) | 226 (add-hook 'deactivate-mark-hook 'tpu-update-mode-line))) |
230 (tpu-lucid-emacs19-p | |
231 (add-hook 'zmacs-deactivate-region-hook 'tpu-update-mode-line) | |
232 (add-hook 'zmacs-activate-region-hook 'tpu-update-mode-line))) | |
233 | 227 |
234 | 228 |
235 ;;; | 229 ;;; |
236 ;;; Match Markers - | 230 ;;; Match Markers - |
237 ;;; | 231 ;;; |
301 (defun tpu-cadr (thingy) (car (cdr thingy))) | 295 (defun tpu-cadr (thingy) (car (cdr thingy))) |
302 | 296 |
303 (defun tpu-mark nil | 297 (defun tpu-mark nil |
304 "TPU-edt version of the mark function. | 298 "TPU-edt version of the mark function. |
305 Return the appropriate value of the mark for the current | 299 Return the appropriate value of the mark for the current |
306 version of emacs." | 300 version of Emacs." |
307 (cond (tpu-lucid-emacs19-p (mark (not zmacs-regions))) | 301 (cond (tpu-lucid-emacs19-p (mark (not zmacs-regions))) |
308 (tpu-gnu-emacs19-p (and mark-active (mark (not transient-mark-mode)))) | 302 (tpu-emacs19-p (and mark-active (mark (not transient-mark-mode)))) |
309 (t (mark)))) | 303 (t (mark)))) |
310 | 304 |
311 (defun tpu-set-mark (pos) | 305 (defun tpu-set-mark (pos) |
312 "TPU-edt verion of the set-mark function. | 306 "TPU-edt verion of the `set-mark' function. |
313 Sets the mark at POS and activates the region acording to the | 307 Sets the mark at POS and activates the region acording to the |
314 current version of emacs." | 308 current version of Emacs." |
315 (set-mark pos) | 309 (set-mark pos) |
316 (and tpu-lucid-emacs19-p pos (zmacs-activate-region))) | 310 (and tpu-lucid-emacs19-p pos (zmacs-activate-region))) |
317 | 311 |
318 (defun tpu-string-prompt (prompt history-symbol) | 312 (defun tpu-string-prompt (prompt history-symbol) |
319 "Read a string with PROMPT." | 313 "Read a string with PROMPT." |
324 (defvar tpu-last-answer nil "Most recent response to tpu-y-or-n-p.") | 318 (defvar tpu-last-answer nil "Most recent response to tpu-y-or-n-p.") |
325 | 319 |
326 (defun tpu-y-or-n-p (prompt &optional not-yes) | 320 (defun tpu-y-or-n-p (prompt &optional not-yes) |
327 "Prompt for a y or n answer with positive default. | 321 "Prompt for a y or n answer with positive default. |
328 Optional second argument NOT-YES changes default to negative. | 322 Optional second argument NOT-YES changes default to negative. |
329 Like emacs y-or-n-p, also accepts space as y and DEL as n." | 323 Like Emacs `y-or-n-p', but also accepts space as y and DEL as n." |
330 (message (format "%s[%s]" prompt (if not-yes "n" "y"))) | 324 (message (format "%s[%s]" prompt (if not-yes "n" "y"))) |
331 (let ((doit t)) | 325 (let ((doit t)) |
332 (while doit | 326 (while doit |
333 (setq doit nil) | 327 (setq doit nil) |
334 (let ((ans (read-char))) | 328 (let ((ans (read-char))) |
2087 ;;; Emacs version 19 X-windows key definition support | 2081 ;;; Emacs version 19 X-windows key definition support |
2088 ;;; | 2082 ;;; |
2089 (defun tpu-load-xkeys (file) | 2083 (defun tpu-load-xkeys (file) |
2090 "Load the TPU-edt X-windows key definitions FILE. | 2084 "Load the TPU-edt X-windows key definitions FILE. |
2091 If FILE is nil, try to load a default file. The default file names are | 2085 If FILE is nil, try to load a default file. The default file names are |
2092 ~/.tpu-lucid-keys for Lucid emacs, and ~/.tpu-gnu-keys for GNU emacs." | 2086 `~/.tpu-lucid-keys' for Lucid emacs, and `~/.tpu-keys' for Emacs." |
2093 (interactive "fX key definition file: ") | 2087 (interactive "fX key definition file: ") |
2094 (cond (file | 2088 (cond (file |
2095 (setq file (expand-file-name file))) | 2089 (setq file (expand-file-name file))) |
2096 (tpu-xkeys-file | 2090 (tpu-xkeys-file |
2097 (setq file (expand-file-name tpu-xkeys-file))) | 2091 (setq file (expand-file-name tpu-xkeys-file))) |
2098 (tpu-gnu-emacs19-p | |
2099 (setq file (expand-file-name "~/.tpu-gnu-keys"))) | |
2100 (tpu-lucid-emacs19-p | 2092 (tpu-lucid-emacs19-p |
2101 (setq file (expand-file-name "~/.tpu-lucid-keys")))) | 2093 (setq file (expand-file-name "~/.tpu-lucid-keys"))) |
2094 (tpu-emacs19-p | |
2095 (setq file (expand-file-name "~/.tpu-keys")))) | |
2102 (cond ((file-readable-p file) | 2096 (cond ((file-readable-p file) |
2103 (load-file file)) | 2097 (load-file file)) |
2104 (t | 2098 (t |
2105 (switch-to-buffer "*scratch*") | 2099 (switch-to-buffer "*scratch*") |
2106 (erase-buffer) | 2100 (erase-buffer) |
2173 (setq scroll-step 0) | 2167 (setq scroll-step 0) |
2174 (setq global-map (copy-keymap tpu-original-global-map)) | 2168 (setq global-map (copy-keymap tpu-original-global-map)) |
2175 (use-global-map global-map) | 2169 (use-global-map global-map) |
2176 (setq tpu-edt-mode nil)))) | 2170 (setq tpu-edt-mode nil)))) |
2177 | 2171 |
2178 | |
2179 ;;; | |
2180 ;;; Turn on TPU-edt and announce it as a feature | |
2181 ;;; | |
2182 (tpu-edt-mode) | |
2183 | |
2184 (provide 'tpu-edt) | 2172 (provide 'tpu-edt) |
2185 | 2173 |
2186 ;;; tpu-edt.el ends here | 2174 ;;; tpu-edt.el ends here |