diff options
| author | Stefan Kangas | 2019-10-18 23:32:30 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2019-10-19 00:17:33 +0200 |
| commit | f60ed6e3e4f580d9d967fac28e345aca911ca04f (patch) | |
| tree | 75abb4592a395979dae69c8c098067b2b38e88c1 | |
| parent | 2afab0d9ce38dbd597ca839e3dd3fb8e3869781e (diff) | |
| download | emacs-f60ed6e3e4f580d9d967fac28e345aca911ca04f.tar.gz emacs-f60ed6e3e4f580d9d967fac28e345aca911ca04f.zip | |
Remove XEmacs compat code from edt-mapper.el
* lisp/emulation/edt-mapper.el (edt-mapper, edt-xserver)
(edt-map-key): Remove XEmacs compat code.
(edt-window-system): Redefine as obsolete variable alias for
'window-system'.
| -rw-r--r-- | lisp/emulation/edt-mapper.el | 89 |
1 files changed, 32 insertions, 57 deletions
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el index 4aad72caf3c..4c80022cfb8 100644 --- a/lisp/emulation/edt-mapper.el +++ b/lisp/emulation/edt-mapper.el | |||
| @@ -55,8 +55,8 @@ | |||
| 55 | 55 | ||
| 56 | ;; Usage: | 56 | ;; Usage: |
| 57 | 57 | ||
| 58 | ;; Simply load this file into emacs (version 19 or higher) | 58 | ;; Simply load this file into emacs and run the function edt-mapper, |
| 59 | ;; and run the function edt-mapper, using the following command. | 59 | ;; using the following command. |
| 60 | 60 | ||
| 61 | ;; emacs -q -l edt-mapper -f edt-mapper | 61 | ;; emacs -q -l edt-mapper -f edt-mapper |
| 62 | 62 | ||
| @@ -96,23 +96,17 @@ | |||
| 96 | ;;; Code: | 96 | ;;; Code: |
| 97 | 97 | ||
| 98 | ;;; | 98 | ;;; |
| 99 | ;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs). | ||
| 100 | ;;; Determine Window System, and X Server Vendor (if appropriate). | 99 | ;;; Determine Window System, and X Server Vendor (if appropriate). |
| 101 | ;;; | 100 | ;;; |
| 102 | (defconst edt-window-system (if (featurep 'xemacs) (console-type) window-system) | 101 | (define-obsolete-variable-alias 'edt-window-system 'window-system "27.1") |
| 103 | "Indicates window system (in GNU Emacs) or console type (in XEmacs).") | ||
| 104 | 102 | ||
| 105 | (declare-function x-server-vendor "xfns.c" (&optional terminal)) | 103 | (defconst edt-xserver (when (eq window-system 'x) |
| 106 | |||
| 107 | (defconst edt-xserver (when (eq edt-window-system 'x) | ||
| 108 | ;; The Cygwin window manager has a `/' in its | 104 | ;; The Cygwin window manager has a `/' in its |
| 109 | ;; name, which breaks the generated file name of | 105 | ;; name, which breaks the generated file name of |
| 110 | ;; the custom key map file. Replace `/' with a | 106 | ;; the custom key map file. Replace `/' with a |
| 111 | ;; `-' to work around that. | 107 | ;; `-' to work around that. |
| 112 | (if (featurep 'xemacs) | 108 | (replace-regexp-in-string "[ /]" "-" |
| 113 | (replace-in-string (x-server-vendor) "[ /]" "-") | 109 | (x-server-vendor))) |
| 114 | (replace-regexp-in-string "[ /]" "-" | ||
| 115 | (x-server-vendor)))) | ||
| 116 | "Indicates X server vendor name, if applicable.") | 110 | "Indicates X server vendor name, if applicable.") |
| 117 | 111 | ||
| 118 | 112 | ||
| @@ -138,40 +132,26 @@ | |||
| 138 | ;;; | 132 | ;;; |
| 139 | (defun edt-map-key (ident descrip) | 133 | (defun edt-map-key (ident descrip) |
| 140 | (interactive) | 134 | (interactive) |
| 141 | (if (featurep 'xemacs) | 135 | (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip))) |
| 142 | (progn | 136 | (cond ((not (equal edt-key edt-return)) |
| 143 | (setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip))) | 137 | (set-buffer "Keys") |
| 144 | (setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]")) | 138 | (insert (if (vectorp edt-key) |
| 145 | (cond ((not (equal edt-key edt-return)) | 139 | (format " (\"%s\" . %s)\n" ident edt-key) |
| 146 | (set-buffer "Keys") | 140 | (format " (\"%s\" . \"%s\")\n" ident edt-key))) |
| 147 | (insert (format " (\"%s\" . %s)\n" ident edt-key)) | 141 | (set-buffer "Directions")) |
| 148 | (set-buffer "Directions")) | 142 | ;; bogosity to get next prompt to come up, if the user hits <CR>! |
| 149 | ;; bogosity to get next prompt to come up, if the user hits <CR>! | 143 | ;; check periodically to see if this is still needed... |
| 150 | ;; check periodically to see if this is still needed... | 144 | (t |
| 151 | (t | 145 | (set-buffer "Keys") |
| 152 | (set-buffer "Keys") | 146 | (insert (format " (\"%s\" . \"\" )\n" ident)) |
| 153 | (insert (format " (\"%s\" . \"\" )\n" ident)) | 147 | (set-buffer "Directions"))) |
| 154 | (set-buffer "Directions")))) | ||
| 155 | (setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip))) | ||
| 156 | (cond ((not (equal edt-key edt-return)) | ||
| 157 | (set-buffer "Keys") | ||
| 158 | (insert (if (vectorp edt-key) | ||
| 159 | (format " (\"%s\" . %s)\n" ident edt-key) | ||
| 160 | (format " (\"%s\" . \"%s\")\n" ident edt-key))) | ||
| 161 | (set-buffer "Directions")) | ||
| 162 | ;; bogosity to get next prompt to come up, if the user hits <CR>! | ||
| 163 | ;; check periodically to see if this is still needed... | ||
| 164 | (t | ||
| 165 | (set-buffer "Keys") | ||
| 166 | (insert (format " (\"%s\" . \"\" )\n" ident)) | ||
| 167 | (set-buffer "Directions")))) | ||
| 168 | edt-key) | 148 | edt-key) |
| 169 | 149 | ||
| 170 | (defun edt-mapper () | 150 | (defun edt-mapper () |
| 171 | (if noninteractive | 151 | (if noninteractive |
| 172 | (user-error "edt-mapper cannot be loaded in batch mode")) | 152 | (user-error "edt-mapper cannot be loaded in batch mode")) |
| 173 | ;; Determine Terminal Type (if appropriate). | 153 | ;; Determine Terminal Type (if appropriate). |
| 174 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | 154 | (if (and window-system (not (eq window-system 'tty))) |
| 175 | (setq edt-term nil) | 155 | (setq edt-term nil) |
| 176 | (setq edt-term (getenv "TERM"))) | 156 | (setq edt-term (getenv "TERM"))) |
| 177 | ;; | 157 | ;; |
| @@ -218,7 +198,7 @@ | |||
| 218 | ;; Make sure the window is big enough to display the instructions, | 198 | ;; Make sure the window is big enough to display the instructions, |
| 219 | ;; except where window cannot be re-sized. | 199 | ;; except where window cannot be re-sized. |
| 220 | ;; | 200 | ;; |
| 221 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | 201 | (if (and window-system (not (eq window-system 'tty))) |
| 222 | (set-frame-size (selected-frame) 80 36)) | 202 | (set-frame-size (selected-frame) 80 36)) |
| 223 | ;; | 203 | ;; |
| 224 | ;; Create buffers - Directions and Keys | 204 | ;; Create buffers - Directions and Keys |
| @@ -242,7 +222,7 @@ | |||
| 242 | ;; Display directions | 222 | ;; Display directions |
| 243 | ;; | 223 | ;; |
| 244 | (switch-to-buffer "Directions") | 224 | (switch-to-buffer "Directions") |
| 245 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | 225 | (if (and window-system (not (eq window-system 'tty))) |
| 246 | (insert " | 226 | (insert " |
| 247 | EDT MAPPER | 227 | EDT MAPPER |
| 248 | 228 | ||
| @@ -289,19 +269,14 @@ | |||
| 289 | ;; | 269 | ;; |
| 290 | ;; Save <CR> for future reference. | 270 | ;; Save <CR> for future reference. |
| 291 | ;; | 271 | ;; |
| 292 | ;; For GNU Emacs, running in a Window System, first hide bindings in | 272 | ;; For Emacs running in a Window System, first hide bindings in |
| 293 | ;; function-key-map. | 273 | ;; function-key-map. |
| 294 | ;; | 274 | ;; |
| 295 | (cond | 275 | (if window-system |
| 296 | ((featurep 'xemacs) | 276 | (progn |
| 297 | (setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue ")) | 277 | (setq edt-save-function-key-map function-key-map) |
| 298 | (setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]"))) | 278 | (setq function-key-map (make-sparse-keymap)))) |
| 299 | (t | 279 | (setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue ")) |
| 300 | (if edt-window-system | ||
| 301 | (progn | ||
| 302 | (setq edt-save-function-key-map function-key-map) | ||
| 303 | (setq function-key-map (make-sparse-keymap)))) | ||
| 304 | (setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue ")))) | ||
| 305 | 280 | ||
| 306 | ;; | 281 | ;; |
| 307 | ;; Remove prefix-key bindings to F1 and F2 in global-map so they can be | 282 | ;; Remove prefix-key bindings to F1 and F2 in global-map so they can be |
| @@ -315,7 +290,7 @@ | |||
| 315 | ;; | 290 | ;; |
| 316 | (set-buffer "Directions") | 291 | (set-buffer "Directions") |
| 317 | (delete-region (point-min) (point-max)) | 292 | (delete-region (point-min) (point-max)) |
| 318 | (if (and edt-window-system (not (eq edt-window-system 'tty))) | 293 | (if (and window-system (not (eq window-system 'tty))) |
| 319 | (insert " | 294 | (insert " |
| 320 | 295 | ||
| 321 | PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. | 296 | PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW. |
| @@ -506,7 +481,7 @@ | |||
| 506 | ;; | 481 | ;; |
| 507 | ;; Restore function-key-map. | 482 | ;; Restore function-key-map. |
| 508 | ;; | 483 | ;; |
| 509 | (if (and edt-window-system (not (featurep 'xemacs))) | 484 | (if window-system |
| 510 | (setq function-key-map edt-save-function-key-map)) | 485 | (setq function-key-map edt-save-function-key-map)) |
| 511 | (setq EDT-key-name "") | 486 | (setq EDT-key-name "") |
| 512 | (while (not | 487 | (while (not |
| @@ -529,10 +504,10 @@ | |||
| 529 | ;; Save the key mapping file | 504 | ;; Save the key mapping file |
| 530 | ;; | 505 | ;; |
| 531 | (let ((file (concat | 506 | (let ((file (concat |
| 532 | "~/.edt-" (if (featurep 'xemacs) "xemacs" "gnu") | 507 | "~/.edt-gnu" |
| 533 | (if edt-term (concat "-" edt-term)) | 508 | (if edt-term (concat "-" edt-term)) |
| 534 | (if edt-xserver (concat "-" edt-xserver)) | 509 | (if edt-xserver (concat "-" edt-xserver)) |
| 535 | (if edt-window-system (concat "-" (upcase (symbol-name edt-window-system)))) | 510 | (if window-system (concat "-" (upcase (symbol-name window-system)))) |
| 536 | "-keys"))) | 511 | "-keys"))) |
| 537 | (set-visited-file-name | 512 | (set-visited-file-name |
| 538 | (read-file-name (format "Save key mapping to file (default %s): " file) nil file))) | 513 | (read-file-name (format "Save key mapping to file (default %s): " file) nil file))) |