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'.
This commit is contained in:
Stefan Kangas 2019-10-18 23:32:30 +02:00
parent 2afab0d9ce
commit f60ed6e3e4

View file

@ -55,8 +55,8 @@
;; Usage:
;; Simply load this file into emacs (version 19 or higher)
;; and run the function edt-mapper, using the following command.
;; Simply load this file into emacs and run the function edt-mapper,
;; using the following command.
;; emacs -q -l edt-mapper -f edt-mapper
@ -96,23 +96,17 @@
;;; Code:
;;;
;;; Decide Emacs Variant, GNU Emacs or XEmacs (aka Lucid Emacs).
;;; Determine Window System, and X Server Vendor (if appropriate).
;;;
(defconst edt-window-system (if (featurep 'xemacs) (console-type) window-system)
"Indicates window system (in GNU Emacs) or console type (in XEmacs).")
(define-obsolete-variable-alias 'edt-window-system 'window-system "27.1")
(declare-function x-server-vendor "xfns.c" (&optional terminal))
(defconst edt-xserver (when (eq edt-window-system 'x)
(defconst edt-xserver (when (eq window-system 'x)
;; The Cygwin window manager has a `/' in its
;; name, which breaks the generated file name of
;; the custom key map file. Replace `/' with a
;; `-' to work around that.
(if (featurep 'xemacs)
(replace-in-string (x-server-vendor) "[ /]" "-")
(replace-regexp-in-string "[ /]" "-"
(x-server-vendor))))
(replace-regexp-in-string "[ /]" "-"
(x-server-vendor)))
"Indicates X server vendor name, if applicable.")
@ -138,40 +132,26 @@
;;;
(defun edt-map-key (ident descrip)
(interactive)
(if (featurep 'xemacs)
(progn
(setq edt-key-seq (read-key-sequence (format "Press %s%s: " ident descrip)))
(setq edt-key (concat "[" (format "%s" (event-key (aref edt-key-seq 0))) "]"))
(cond ((not (equal edt-key edt-return))
(set-buffer "Keys")
(insert (format " (\"%s\" . %s)\n" ident edt-key))
(set-buffer "Directions"))
;; bogosity to get next prompt to come up, if the user hits <CR>!
;; check periodically to see if this is still needed...
(t
(set-buffer "Keys")
(insert (format " (\"%s\" . \"\" )\n" ident))
(set-buffer "Directions"))))
(setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip)))
(cond ((not (equal edt-key edt-return))
(set-buffer "Keys")
(insert (if (vectorp edt-key)
(format " (\"%s\" . %s)\n" ident edt-key)
(format " (\"%s\" . \"%s\")\n" ident edt-key)))
(set-buffer "Directions"))
;; bogosity to get next prompt to come up, if the user hits <CR>!
;; check periodically to see if this is still needed...
(t
(set-buffer "Keys")
(insert (format " (\"%s\" . \"\" )\n" ident))
(set-buffer "Directions"))))
(setq edt-key (read-key-sequence (format "Press %s%s: " ident descrip)))
(cond ((not (equal edt-key edt-return))
(set-buffer "Keys")
(insert (if (vectorp edt-key)
(format " (\"%s\" . %s)\n" ident edt-key)
(format " (\"%s\" . \"%s\")\n" ident edt-key)))
(set-buffer "Directions"))
;; bogosity to get next prompt to come up, if the user hits <CR>!
;; check periodically to see if this is still needed...
(t
(set-buffer "Keys")
(insert (format " (\"%s\" . \"\" )\n" ident))
(set-buffer "Directions")))
edt-key)
(defun edt-mapper ()
(if noninteractive
(user-error "edt-mapper cannot be loaded in batch mode"))
;; Determine Terminal Type (if appropriate).
(if (and edt-window-system (not (eq edt-window-system 'tty)))
(if (and window-system (not (eq window-system 'tty)))
(setq edt-term nil)
(setq edt-term (getenv "TERM")))
;;
@ -218,7 +198,7 @@
;; Make sure the window is big enough to display the instructions,
;; except where window cannot be re-sized.
;;
(if (and edt-window-system (not (eq edt-window-system 'tty)))
(if (and window-system (not (eq window-system 'tty)))
(set-frame-size (selected-frame) 80 36))
;;
;; Create buffers - Directions and Keys
@ -242,7 +222,7 @@
;; Display directions
;;
(switch-to-buffer "Directions")
(if (and edt-window-system (not (eq edt-window-system 'tty)))
(if (and window-system (not (eq window-system 'tty)))
(insert "
EDT MAPPER
@ -289,19 +269,14 @@
;;
;; Save <CR> for future reference.
;;
;; For GNU Emacs, running in a Window System, first hide bindings in
;; For Emacs running in a Window System, first hide bindings in
;; function-key-map.
;;
(cond
((featurep 'xemacs)
(setq edt-return-seq (read-key-sequence "Hit carriage-return <CR> to continue "))
(setq edt-return (concat "[" (format "%s" (event-key (aref edt-return-seq 0))) "]")))
(t
(if edt-window-system
(progn
(setq edt-save-function-key-map function-key-map)
(setq function-key-map (make-sparse-keymap))))
(setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue "))))
(if window-system
(progn
(setq edt-save-function-key-map function-key-map)
(setq function-key-map (make-sparse-keymap))))
(setq edt-return (read-key-sequence "Hit carriage-return <CR> to continue "))
;;
;; Remove prefix-key bindings to F1 and F2 in global-map so they can be
@ -315,7 +290,7 @@
;;
(set-buffer "Directions")
(delete-region (point-min) (point-max))
(if (and edt-window-system (not (eq edt-window-system 'tty)))
(if (and window-system (not (eq window-system 'tty)))
(insert "
PRESS THE KEY SPECIFIED IN THE MINIBUFFER BELOW.
@ -506,7 +481,7 @@
;;
;; Restore function-key-map.
;;
(if (and edt-window-system (not (featurep 'xemacs)))
(if window-system
(setq function-key-map edt-save-function-key-map))
(setq EDT-key-name "")
(while (not
@ -529,10 +504,10 @@
;; Save the key mapping file
;;
(let ((file (concat
"~/.edt-" (if (featurep 'xemacs) "xemacs" "gnu")
"~/.edt-gnu"
(if edt-term (concat "-" edt-term))
(if edt-xserver (concat "-" edt-xserver))
(if edt-window-system (concat "-" (upcase (symbol-name edt-window-system))))
(if window-system (concat "-" (upcase (symbol-name window-system))))
"-keys")))
(set-visited-file-name
(read-file-name (format "Save key mapping to file (default %s): " file) nil file)))