aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emulation
diff options
context:
space:
mode:
authorStefan Kangas2019-10-09 20:10:09 +0200
committerStefan Kangas2019-10-09 20:10:09 +0200
commitc548a2af9b81ac892c8afbf1e9bd7018574153bf (patch)
tree43618bd9e438ddbd3fb05173b3bf84249860fffa /lisp/emulation
parentb16f19626c468647de570e43c9b18db5bd5e7638 (diff)
downloademacs-c548a2af9b81ac892c8afbf1e9bd7018574153bf.tar.gz
emacs-c548a2af9b81ac892c8afbf1e9bd7018574153bf.zip
Remove XEmacs compat code from edt.el (Bug#37621)
* lisp/emulation/edt.el (top-level, edt-emacs-variant) (edt-window-system, edt-xserver, edt-page-backward) (edt-beginning-of-line, edt-end-of-line-forward) (edt-end-of-line-backward, edt-one-word-forward) (edt-one-word-backward, edt-character, edt-line-forward) (edt-next-line, edt-previous-line, edt-top, edt-find-forward) (edt-find-backward, edt-find-next-forward) (edt-find-next-backward, edt-reset, edt-advance, edt-backup) (edt-define-key, edt-bottom-check, edt-sentence-forward) (edt-sentence-backward, edt-paragraph-forward) (edt-paragraph-backward, edt-restore-key, edt-window-top) (edt-window-bottom, edt-scroll-window-backward-line) (edt-line-to-bottom-of-window, edt-line-to-middle-of-window) (edt-goto-percentage, edt-display-the-time, edt-remember) (edt-split-window, edt-load-keys, edt-emulation-on) (edt-emulation-off, edt-default-emulation-setup) (edt-user-emulation-setup, edt-select-default-global-map) (edt-select-user-global-map): Remove XEmacs compat code.
Diffstat (limited to 'lisp/emulation')
-rw-r--r--lisp/emulation/edt.el211
1 files changed, 64 insertions, 147 deletions
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index dcc327dbd4d..b8c835ce2ce 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -106,10 +106,7 @@
106;; customization file, edt-user.el, to do this. 106;; customization file, edt-user.el, to do this.
107;; See Info node `edt' for more details. 107;; See Info node `edt' for more details.
108 108
109;; 3. EDT Emulation now also works in XEmacs, including the 109;; 3. If you access a workstation using an X Server, observe that
110;; highlighting of selected text.
111
112;; 4. If you access a workstation using an X Server, observe that
113;; the initialization file generated by edt-mapper.el will now 110;; the initialization file generated by edt-mapper.el will now
114;; contain the name of the X Server vendor. This is a 111;; contain the name of the X Server vendor. This is a
115;; convenience for those who have access to their Unix account 112;; convenience for those who have access to their Unix account
@@ -120,7 +117,7 @@
120;; names. Then, the correct initialization file for the 117;; names. Then, the correct initialization file for the
121;; particular X server in use is loaded correctly automatically. 118;; particular X server in use is loaded correctly automatically.
122 119
123;; 5. Also, edt-mapper.el is now capable of binding an ASCII key 120;; 4. Also, edt-mapper.el is now capable of binding an ASCII key
124;; sequence, providing the ASCII key sequence prefix is already 121;; sequence, providing the ASCII key sequence prefix is already
125;; known by Emacs to be a prefix. As a result of providing this 122;; known by Emacs to be a prefix. As a result of providing this
126;; support, some terminal/keyboard/window system configurations, 123;; support, some terminal/keyboard/window system configurations,
@@ -140,7 +137,7 @@
140;; your terminal OR a bug in the terminal emulation software you 137;; your terminal OR a bug in the terminal emulation software you
141;; are using.) 138;; are using.)
142 139
143;; 6. The edt-quit function (bound to GOLD-q by default) has been 140;; 5. The edt-quit function (bound to GOLD-q by default) has been
144;; modified to warn the user when file-related buffer 141;; modified to warn the user when file-related buffer
145;; modifications exist. It now cautions the user that those 142;; modifications exist. It now cautions the user that those
146;; modifications will be lost if the user quits without saving 143;; modifications will be lost if the user quits without saving
@@ -180,8 +177,6 @@
180(defvar edt-rect-start-point) 177(defvar edt-rect-start-point)
181(defvar edt-user-global-map) 178(defvar edt-user-global-map)
182(defvar rect-start-point) 179(defvar rect-start-point)
183(defvar time-string)
184(defvar zmacs-region-stays)
185 180
186;;; 181;;;
187;;; Version Information 182;;; Version Information
@@ -310,23 +305,13 @@ This means that an edt-user.el file was found in the user's `load-path'.")
310;;; 305;;;
311;;; o edt-emulation-on o edt-load-keys 306;;; o edt-emulation-on o edt-load-keys
312;;; 307;;;
313(defconst edt-emacs-variant (if (featurep 'emacs) "gnu" "xemacs") 308(defconst edt-xserver (when (eq window-system 'x)
314 "Indicates Emacs variant: GNU Emacs or XEmacs (aka Lucid Emacs).")
315
316(defconst edt-window-system (if (featurep 'emacs) window-system (console-type))
317 "Indicates window system (in GNU Emacs) or console type (in XEmacs).")
318
319(declare-function x-server-vendor "xfns.c" (&optional terminal))
320
321(defconst edt-xserver (when (eq edt-window-system 'x)
322 ;; The Cygwin window manager has a `/' in its 309 ;; The Cygwin window manager has a `/' in its
323 ;; name, which breaks the generated file name of 310 ;; name, which breaks the generated file name of
324 ;; the custom key map file. Replace `/' with a 311 ;; the custom key map file. Replace `/' with a
325 ;; `-' to work around that. 312 ;; `-' to work around that.
326 (if (featurep 'xemacs) 313 (replace-regexp-in-string "[ /]" "-"
327 (replace-in-string (x-server-vendor) "[ /]" "-") 314 (x-server-vendor)))
328 (replace-regexp-in-string "[ /]" "-"
329 (x-server-vendor))))
330 "Indicates X server vendor name, if applicable.") 315 "Indicates X server vendor name, if applicable.")
331 316
332(defvar edt-keys-file nil 317(defvar edt-keys-file nil
@@ -388,8 +373,7 @@ Argument NUM is the number of page delimiters to move."
388 (error "Beginning of buffer") 373 (error "Beginning of buffer")
389 (progn 374 (progn
390 (backward-page num) 375 (backward-page num)
391 (edt-line-to-top-of-window) 376 (edt-line-to-top-of-window))))
392 (if (featurep 'xemacs) (setq zmacs-region-stays t)))))
393 377
394(defun edt-page (num) 378(defun edt-page (num)
395 "Move in current direction to next page delimiter. 379 "Move in current direction to next page delimiter.
@@ -449,8 +433,7 @@ Argument NUM is the number of BOL marks to move."
449 (progn 433 (progn
450 (setq num (1- num)) 434 (setq num (1- num))
451 (forward-line (* -1 num)))) 435 (forward-line (* -1 num))))
452 (edt-top-check beg num)) 436 (edt-top-check beg num)))
453 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
454 437
455 438
456;;; 439;;;
@@ -465,8 +448,7 @@ Argument NUM is the number of EOL marks to move."
465 (let ((beg (edt-current-line))) 448 (let ((beg (edt-current-line)))
466 (forward-char) 449 (forward-char)
467 (end-of-line num) 450 (end-of-line num)
468 (edt-bottom-check beg num)) 451 (edt-bottom-check beg num)))
469 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
470 452
471 453
472(defun edt-end-of-line-backward (num) 454(defun edt-end-of-line-backward (num)
@@ -476,8 +458,7 @@ Argument NUM is the number of EOL marks to move."
476 (edt-check-prefix num) 458 (edt-check-prefix num)
477 (let ((beg (edt-current-line))) 459 (let ((beg (edt-current-line)))
478 (end-of-line (1- num)) 460 (end-of-line (1- num))
479 (edt-top-check beg num)) 461 (edt-top-check beg num)))
480 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
481 462
482 463
483(defun edt-end-of-line (num) 464(defun edt-end-of-line (num)
@@ -521,8 +502,7 @@ Argument NUM is the number of EOL marks to move."
521 (not (eobp)) 502 (not (eobp))
522 (eq ?\ (char-syntax (following-char))) 503 (eq ?\ (char-syntax (following-char)))
523 (not (memq (following-char) edt-word-entities))) 504 (not (memq (following-char) edt-word-entities)))
524 (forward-char)))) 505 (forward-char)))))
525 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
526 506
527(defun edt-one-word-backward () 507(defun edt-one-word-backward ()
528 "Move backward to first character of previous word." 508 "Move backward to first character of previous word."
@@ -545,8 +525,7 @@ Argument NUM is the number of EOL marks to move."
545 (not (bobp)) 525 (not (bobp))
546 (not (eq ?\ (char-syntax (preceding-char)))) 526 (not (eq ?\ (char-syntax (preceding-char))))
547 (not (memq (preceding-char) edt-word-entities))) 527 (not (memq (preceding-char) edt-word-entities)))
548 (backward-char))))) 528 (backward-char))))))
549 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
550 529
551(defun edt-word-forward (num) 530(defun edt-word-forward (num)
552 "Move forward to first character of next word. 531 "Move forward to first character of next word.
@@ -585,8 +564,7 @@ Argument NUM is the number of characters to move."
585 (edt-check-prefix num) 564 (edt-check-prefix num)
586 (if (equal edt-direction-string edt-forward-string) 565 (if (equal edt-direction-string edt-forward-string)
587 (forward-char num) 566 (forward-char num)
588 (backward-char num)) 567 (backward-char num)))
589 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
590 568
591;;; 569;;;
592;;; LINE 570;;; LINE
@@ -608,8 +586,7 @@ Argument NUM is the number of BOL marks to move."
608 (edt-check-prefix num) 586 (edt-check-prefix num)
609 (let ((beg (edt-current-line))) 587 (let ((beg (edt-current-line)))
610 (forward-line num) 588 (forward-line num)
611 (edt-bottom-check beg num)) 589 (edt-bottom-check beg num)))
612 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
613 590
614(defun edt-line (num) 591(defun edt-line (num)
615 "Move in current direction to next beginning of line mark. 592 "Move in current direction to next beginning of line mark.
@@ -631,8 +608,7 @@ Argument NUM is the number of lines to move."
631 (let ((beg (edt-current-line))) 608 (let ((beg (edt-current-line)))
632 ;; We're deliberately using next-line instead of forward-line. 609 ;; We're deliberately using next-line instead of forward-line.
633 (with-no-warnings (next-line num)) 610 (with-no-warnings (next-line num))
634 (edt-bottom-check beg num)) 611 (edt-bottom-check beg num)))
635 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
636 612
637(defun edt-previous-line (num) 613(defun edt-previous-line (num)
638 "Move cursor up one line. 614 "Move cursor up one line.
@@ -642,8 +618,7 @@ Argument NUM is the number of lines to move."
642 (let ((beg (edt-current-line))) 618 (let ((beg (edt-current-line)))
643 ;; We're deliberately using previous-line instead of forward-line. 619 ;; We're deliberately using previous-line instead of forward-line.
644 (with-no-warnings (previous-line num)) 620 (with-no-warnings (previous-line num))
645 (edt-top-check beg num)) 621 (edt-top-check beg num)))
646 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
647 622
648 623
649;;; 624;;;
@@ -653,8 +628,7 @@ Argument NUM is the number of lines to move."
653(defun edt-top () 628(defun edt-top ()
654 "Move cursor to the beginning of buffer." 629 "Move cursor to the beginning of buffer."
655 (interactive) 630 (interactive)
656 (goto-char (point-min)) 631 (goto-char (point-min)))
657 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
658 632
659;;; 633;;;
660;;; BOTTOM 634;;; BOTTOM
@@ -703,8 +677,7 @@ Optional argument FIND is t is this function is called from `edt-find'."
703 (if (zerop (setq left (save-excursion (forward-line height)))) 677 (if (zerop (setq left (save-excursion (forward-line height))))
704 (recenter top-margin) 678 (recenter top-margin)
705 (recenter (- left bottom-up-margin))) 679 (recenter (- left bottom-up-margin)))
706 (and (> (point) bottom) (recenter bottom-margin))))) 680 (and (> (point) bottom) (recenter bottom-margin))))))
707 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
708 681
709(defun edt-find-backward (&optional find) 682(defun edt-find-backward (&optional find)
710 "Find first occurrence of a string in the backward direction and save it. 683 "Find first occurrence of a string in the backward direction and save it.
@@ -715,8 +688,7 @@ Optional argument FIND is t if this function is called from `edt-find'."
715 (edt-with-position 688 (edt-with-position
716 (if (search-backward edt-find-last-text) 689 (if (search-backward edt-find-last-text)
717 (edt-set-match)) 690 (edt-set-match))
718 (and (< (point) top) (recenter (min beg top-margin)))) 691 (and (< (point) top) (recenter (min beg top-margin)))))
719 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
720 692
721(defun edt-find () 693(defun edt-find ()
722 "Find first occurrence of string in current direction and save it." 694 "Find first occurrence of string in current direction and save it."
@@ -746,8 +718,7 @@ Optional argument FIND is t if this function is called from `edt-find'."
746 (recenter (- left bottom-up-margin))) 718 (recenter (- left bottom-up-margin)))
747 (and (> (point) bottom) (recenter bottom-margin)))) 719 (and (> (point) bottom) (recenter bottom-margin))))
748 (backward-char 1) 720 (backward-char 1)
749 (error "Search failed: \"%s\"" edt-find-last-text))) 721 (error "Search failed: \"%s\"" edt-find-last-text))))
750 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
751 722
752(defun edt-find-next-backward () 723(defun edt-find-next-backward ()
753 "Find next occurrence of a string in backward direction." 724 "Find next occurrence of a string in backward direction."
@@ -756,8 +727,7 @@ Optional argument FIND is t if this function is called from `edt-find'."
756 (if (not (search-backward edt-find-last-text nil t)) 727 (if (not (search-backward edt-find-last-text nil t))
757 (error "Search failed: \"%s\"" edt-find-last-text) 728 (error "Search failed: \"%s\"" edt-find-last-text)
758 (edt-set-match) 729 (edt-set-match)
759 (and (< (point) top) (recenter (min beg top-margin))))) 730 (and (< (point) top) (recenter (min beg top-margin))))))
760 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
761 731
762(defun edt-find-next () 732(defun edt-find-next ()
763 "Find next occurrence of a string in current direction." 733 "Find next occurrence of a string in current direction."
@@ -834,9 +804,7 @@ In select mode, selected text is highlighted."
834(defun edt-reset () 804(defun edt-reset ()
835 "Cancel text selection." 805 "Cancel text selection."
836 (interactive) 806 (interactive)
837 (if (featurep 'emacs) 807 (deactivate-mark))
838 (deactivate-mark)
839 (zmacs-deactivate-region)))
840 808
841;;; 809;;;
842;;; CUT 810;;; CUT
@@ -1050,8 +1018,7 @@ Also, execute command specified if in Minibuffer."
1050 (force-mode-line-update) 1018 (force-mode-line-update)
1051 (if (string-equal " *Minibuf" 1019 (if (string-equal " *Minibuf"
1052 (substring (buffer-name) 0 (min (length (buffer-name)) 9))) 1020 (substring (buffer-name) 0 (min (length (buffer-name)) 9)))
1053 (exit-minibuffer)) 1021 (exit-minibuffer)))
1054 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1055 1022
1056 1023
1057;;; 1024;;;
@@ -1066,8 +1033,7 @@ Also, execute command specified if in Minibuffer."
1066 (force-mode-line-update) 1033 (force-mode-line-update)
1067 (if (string-equal " *Minibuf" 1034 (if (string-equal " *Minibuf"
1068 (substring (buffer-name) 0 (min (length (buffer-name)) 9))) 1035 (substring (buffer-name) 0 (min (length (buffer-name)) 9)))
1069 (exit-minibuffer)) 1036 (exit-minibuffer)))
1070 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1071 1037
1072 1038
1073;;; 1039;;;
@@ -1117,14 +1083,11 @@ Argument NUM is the numbers of consecutive characters to change."
1117The current key definition is saved in `edt-last-replaced-key-definition'. 1083The current key definition is saved in `edt-last-replaced-key-definition'.
1118Use `edt-restore-key' to restore last replaced key definition." 1084Use `edt-restore-key' to restore last replaced key definition."
1119 (interactive) 1085 (interactive)
1120 (if (featurep 'xemacs) (setq zmacs-region-stays t))
1121 (let (edt-function 1086 (let (edt-function
1122 edt-key-definition) 1087 edt-key-definition)
1123 (setq edt-key-definition 1088 (setq edt-key-definition
1124 (read-key-sequence "Press the key to be defined: ")) 1089 (read-key-sequence "Press the key to be defined: "))
1125 (if (if (featurep 'emacs) 1090 (if (string-equal "\C-m" edt-key-definition)
1126 (string-equal "\C-m" edt-key-definition)
1127 (string-equal "\C-m" (events-to-keys edt-key-definition)))
1128 (message "Key not defined") 1091 (message "Key not defined")
1129 (progn 1092 (progn
1130 (setq edt-function (read-command "Enter command name: ")) 1093 (setq edt-function (read-command "Enter command name: "))
@@ -1202,8 +1165,6 @@ Argument LINES is the number of lines the cursor moved toward the bottom."
1202 ;; subtract 1 from height because it includes mode line 1165 ;; subtract 1 from height because it includes mode line
1203 (difference (- height margin 1))) 1166 (difference (- height margin 1)))
1204 (cond ((> beg difference) (recenter beg)) 1167 (cond ((> beg difference) (recenter beg))
1205 ((and (featurep 'xemacs) (> (+ beg lines 1) difference))
1206 (recenter (- margin)))
1207 ((> (+ beg lines) difference) (recenter (- margin)))))) 1168 ((> (+ beg lines) difference) (recenter (- margin))))))
1208 1169
1209(defun edt-current-line nil 1170(defun edt-current-line nil
@@ -1289,8 +1250,7 @@ Argument NUM is the positive number of sentences to move."
1289 (if (zerop (setq left (save-excursion (forward-line height)))) 1250 (if (zerop (setq left (save-excursion (forward-line height))))
1290 (recenter top-margin) 1251 (recenter top-margin)
1291 (recenter (- left bottom-up-margin))) 1252 (recenter (- left bottom-up-margin)))
1292 (and (> (point) bottom) (recenter bottom-margin)))) 1253 (and (> (point) bottom) (recenter bottom-margin)))))
1293 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1294 1254
1295(defun edt-sentence-backward (num) 1255(defun edt-sentence-backward (num)
1296 "Move backward to next sentence beginning. 1256 "Move backward to next sentence beginning.
@@ -1301,8 +1261,7 @@ Argument NUM is the positive number of sentences to move."
1301 (if (eobp) 1261 (if (eobp)
1302 (error "End of buffer") 1262 (error "End of buffer")
1303 (backward-sentence num)) 1263 (backward-sentence num))
1304 (and (< (point) top) (recenter (min beg top-margin)))) 1264 (and (< (point) top) (recenter (min beg top-margin)))))
1305 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1306 1265
1307(defun edt-sentence (num) 1266(defun edt-sentence (num)
1308 "Move in current direction to next sentence. 1267 "Move in current direction to next sentence.
@@ -1332,8 +1291,7 @@ Argument NUM is the positive number of paragraphs to move."
1332 (if (zerop (setq left (save-excursion (forward-line height)))) 1291 (if (zerop (setq left (save-excursion (forward-line height))))
1333 (recenter top-margin) 1292 (recenter top-margin)
1334 (recenter (- left bottom-up-margin))) 1293 (recenter (- left bottom-up-margin)))
1335 (and (> (point) bottom) (recenter bottom-margin)))) 1294 (and (> (point) bottom) (recenter bottom-margin)))))
1336 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1337 1295
1338(defun edt-paragraph-backward (num) 1296(defun edt-paragraph-backward (num)
1339 "Move backward to beginning of paragraph. 1297 "Move backward to beginning of paragraph.
@@ -1344,8 +1302,7 @@ Argument NUM is the positive number of paragraphs to move."
1344 (while (> num 0) 1302 (while (> num 0)
1345 (start-of-paragraph-text) 1303 (start-of-paragraph-text)
1346 (setq num (1- num))) 1304 (setq num (1- num)))
1347 (and (< (point) top) (recenter (min beg top-margin)))) 1305 (and (< (point) top) (recenter (min beg top-margin)))))
1348 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1349 1306
1350(defun edt-paragraph (num) 1307(defun edt-paragraph (num)
1351 "Move in current direction to next paragraph. 1308 "Move in current direction to next paragraph.
@@ -1363,24 +1320,18 @@ Argument NUM is the positive number of paragraphs to move."
1363 "Restore last replaced key definition. 1320 "Restore last replaced key definition.
1364Definition is stored in `edt-last-replaced-key-definition'." 1321Definition is stored in `edt-last-replaced-key-definition'."
1365 (interactive) 1322 (interactive)
1366 (if (featurep 'xemacs) (setq zmacs-region-stays t))
1367 (if edt-last-replaced-key-definition 1323 (if edt-last-replaced-key-definition
1368 (progn 1324 (progn
1369 (let (edt-key-definition) 1325 (let (edt-key-definition)
1370 (set 'edt-key-definition 1326 (set 'edt-key-definition
1371 (read-key-sequence "Press the key to be restored: ")) 1327 (read-key-sequence "Press the key to be restored: "))
1372 (if (if (featurep 'emacs) 1328 (if (string-equal "\C-m" edt-key-definition)
1373 (string-equal "\C-m" edt-key-definition)
1374 (string-equal "\C-m" (events-to-keys edt-key-definition)))
1375 (message "Key not restored") 1329 (message "Key not restored")
1376 (progn 1330 (progn
1377 (define-key (current-global-map) 1331 (define-key (current-global-map)
1378 edt-key-definition edt-last-replaced-key-definition) 1332 edt-key-definition edt-last-replaced-key-definition)
1379 (if (featurep 'emacs) 1333 (message "Key definition for %s has been restored."
1380 (message "Key definition for %s has been restored." 1334 edt-key-definition)))))
1381 edt-key-definition)
1382 (message "Key definition for %s has been restored."
1383 (events-to-keys edt-key-definition)))))))
1384 (error "No replaced key definition to restore!"))) 1335 (error "No replaced key definition to restore!")))
1385 1336
1386;;; 1337;;;
@@ -1392,8 +1343,7 @@ Definition is stored in `edt-last-replaced-key-definition'."
1392 (interactive) 1343 (interactive)
1393 (let ((start-column (current-column))) 1344 (let ((start-column (current-column)))
1394 (move-to-window-line 0) 1345 (move-to-window-line 0)
1395 (move-to-column start-column)) 1346 (move-to-column start-column)))
1396 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1397 1347
1398;;; 1348;;;
1399;;; WINDOW BOTTOM 1349;;; WINDOW BOTTOM
@@ -1404,8 +1354,7 @@ Definition is stored in `edt-last-replaced-key-definition'."
1404 (interactive) 1354 (interactive)
1405 (let ((start-column (current-column))) 1355 (let ((start-column (current-column)))
1406 (move-to-window-line (- (window-height) 2)) 1356 (move-to-window-line (- (window-height) 2))
1407 (move-to-column start-column)) 1357 (move-to-column start-column)))
1408 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1409 1358
1410;;; 1359;;;
1411;;; SCROLL WINDOW LINE 1360;;; SCROLL WINDOW LINE
@@ -1414,14 +1363,12 @@ Definition is stored in `edt-last-replaced-key-definition'."
1414(defun edt-scroll-window-forward-line () 1363(defun edt-scroll-window-forward-line ()
1415 "Move window forward one line leaving cursor at position in window." 1364 "Move window forward one line leaving cursor at position in window."
1416 (interactive) 1365 (interactive)
1417 (scroll-up 1) 1366 (scroll-up 1))
1418 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1419 1367
1420(defun edt-scroll-window-backward-line () 1368(defun edt-scroll-window-backward-line ()
1421 "Move window backward one line leaving cursor at position in window." 1369 "Move window backward one line leaving cursor at position in window."
1422 (interactive) 1370 (interactive)
1423 (scroll-down 1) 1371 (scroll-down 1))
1424 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1425 1372
1426(defun edt-scroll-line () 1373(defun edt-scroll-line ()
1427 "Move window one line in current direction." 1374 "Move window one line in current direction."
@@ -1467,8 +1414,7 @@ Argument NUM is the positive number of windows to move."
1467(defun edt-line-to-bottom-of-window () 1414(defun edt-line-to-bottom-of-window ()
1468 "Move the current line to the bottom of the window." 1415 "Move the current line to the bottom of the window."
1469 (interactive) 1416 (interactive)
1470 (recenter -1) 1417 (recenter -1))
1471 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1472 1418
1473;;; 1419;;;
1474;;; LINE TO TOP OF WINDOW 1420;;; LINE TO TOP OF WINDOW
@@ -1477,8 +1423,7 @@ Argument NUM is the positive number of windows to move."
1477(defun edt-line-to-top-of-window () 1423(defun edt-line-to-top-of-window ()
1478 "Move the current line to the top of the window." 1424 "Move the current line to the top of the window."
1479 (interactive) 1425 (interactive)
1480 (recenter 0) 1426 (recenter 0))
1481 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1482 1427
1483;;; 1428;;;
1484;;; LINE TO MIDDLE OF WINDOW 1429;;; LINE TO MIDDLE OF WINDOW
@@ -1487,8 +1432,7 @@ Argument NUM is the positive number of windows to move."
1487(defun edt-line-to-middle-of-window () 1432(defun edt-line-to-middle-of-window ()
1488 "Move window so line with cursor is in the middle of the window." 1433 "Move window so line with cursor is in the middle of the window."
1489 (interactive) 1434 (interactive)
1490 (recenter '(4)) 1435 (recenter '(4)))
1491 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1492 1436
1493;;; 1437;;;
1494;;; GOTO PERCENTAGE 1438;;; GOTO PERCENTAGE
@@ -1500,8 +1444,7 @@ Argument NUM is the percentage into the buffer to move."
1500 (interactive "NGoto-percentage: ") 1444 (interactive "NGoto-percentage: ")
1501 (if (or (> num 100) (< num 0)) 1445 (if (or (> num 100) (< num 0))
1502 (error "Percentage %d out of range 0 < percent < 100" num) 1446 (error "Percentage %d out of range 0 < percent < 100" num)
1503 (goto-char (/ (* (point-max) num) 100))) 1447 (goto-char (/ (* (point-max) num) 100))))
1504 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1505 1448
1506;;; 1449;;;
1507;;; FILL REGION 1450;;; FILL REGION
@@ -1673,7 +1616,6 @@ Argument NUM is the number of times to duplicate the line."
1673(defun edt-display-the-time () 1616(defun edt-display-the-time ()
1674 "Display the current time." 1617 "Display the current time."
1675 (interactive) 1618 (interactive)
1676 (if (featurep 'xemacs) (setq zmacs-region-stays t))
1677 (message "%s" (current-time-string))) 1619 (message "%s" (current-time-string)))
1678 1620
1679;;; 1621;;;
@@ -1701,9 +1643,7 @@ Argument NUM is the number of times to duplicate the line."
1701 (let (edt-key-definition) 1643 (let (edt-key-definition)
1702 (set 'edt-key-definition 1644 (set 'edt-key-definition
1703 (read-key-sequence "Enter key for binding: ")) 1645 (read-key-sequence "Enter key for binding: "))
1704 (if (if (featurep 'emacs) 1646 (if (string-equal "\C-m" edt-key-definition)
1705 (string-equal "\C-m" edt-key-definition)
1706 (string-equal "\C-m" (events-to-keys edt-key-definition)))
1707 (message "Key sequence not remembered") 1647 (message "Key sequence not remembered")
1708 (progn 1648 (progn
1709 (set 'edt-learn-macro-count (+ edt-learn-macro-count 1)) 1649 (set 'edt-learn-macro-count (+ edt-learn-macro-count 1))
@@ -1753,8 +1693,7 @@ Warn user that modifications will be lost."
1753 "Split current window and place cursor in the new window." 1693 "Split current window and place cursor in the new window."
1754 (interactive) 1694 (interactive)
1755 (split-window) 1695 (split-window)
1756 (other-window 1) 1696 (other-window 1))
1757 (if (featurep 'xemacs) (setq zmacs-region-stays t)))
1758 1697
1759;;; 1698;;;
1760;;; COPY RECTANGLE 1699;;; COPY RECTANGLE
@@ -1935,9 +1874,8 @@ Optional argument NOT-YES changes the default to negative."
1935(defun edt-load-keys (file) 1874(defun edt-load-keys (file)
1936 "Load the LK-201 key mapping FILE generated by edt-mapper.el. 1875 "Load the LK-201 key mapping FILE generated by edt-mapper.el.
1937If FILE is nil, which is the normal case, try to load a default file. 1876If FILE is nil, which is the normal case, try to load a default file.
1938The default file names are based upon the window system, terminal 1877The default file names are based upon the window system and terminal
1939type, and version of Emacs in use: GNU Emacs or XEmacs (aka Lucid 1878type. If a default file does not exist, ask user if one should be
1940Emacs). If a default file does not exist, ask user if one should be
1941created." 1879created."
1942 (interactive "fKey definition file: ") 1880 (interactive "fKey definition file: ")
1943 (cond (file 1881 (cond (file
@@ -1948,11 +1886,11 @@ created."
1948 (setq file 1886 (setq file
1949 (expand-file-name 1887 (expand-file-name
1950 (concat 1888 (concat
1951 "~/.edt-" edt-emacs-variant 1889 "~/.edt-gnu"
1952 (if edt-term (concat "-" edt-term)) 1890 (if edt-term (concat "-" edt-term))
1953 (if edt-xserver (concat "-" edt-xserver)) 1891 (if edt-xserver (concat "-" edt-xserver))
1954 (if edt-window-system 1892 (if window-system
1955 (concat "-" (upcase (symbol-name edt-window-system)))) 1893 (concat "-" (upcase (symbol-name window-system))))
1956 "-keys"))))) 1894 "-keys")))))
1957 (cond ((file-readable-p file) 1895 (cond ((file-readable-p file)
1958 (load-file file)) 1896 (load-file file))
@@ -2002,15 +1940,14 @@ created."
2002 "Turn on EDT Emulation." 1940 "Turn on EDT Emulation."
2003 (interactive) 1941 (interactive)
2004 ;; If using pc window system (MS-DOS), set terminal type to pc. 1942 ;; If using pc window system (MS-DOS), set terminal type to pc.
2005 ;; If not a window system (GNU) or a tty window system (XEmacs), 1943 ;; If not a window system, get terminal type.
2006 ;; get terminal type. 1944 (if (eq window-system 'pc)
2007 (if (eq edt-window-system 'pc)
2008 (setq edt-term "pc") 1945 (setq edt-term "pc")
2009 (if (or (not edt-window-system) (eq edt-window-system 'tty)) 1946 (if (not window-system)
2010 (setq edt-term (getenv "TERM")))) 1947 (setq edt-term (getenv "TERM"))))
2011 ;; Look for a terminal configuration file for this terminal type. 1948 ;; Look for a terminal configuration file for this terminal type.
2012 ;; Otherwise, load the user's custom configuration file. 1949 ;; Otherwise, load the user's custom configuration file.
2013 (if (or (not edt-window-system) (memq edt-window-system '(pc tty))) 1950 (if (or (not window-system) (memq window-system '(pc tty)))
2014 (progn 1951 (progn
2015 ;; Load terminal-specific configuration file, if it exists for this 1952 ;; Load terminal-specific configuration file, if it exists for this
2016 ;; terminal type. Note: All DEC VT series terminals are supported 1953 ;; terminal type. Note: All DEC VT series terminals are supported
@@ -2037,27 +1974,14 @@ created."
2037 (setq edt-term term)))) 1974 (setq edt-term term))))
2038 (edt-load-keys nil)) 1975 (edt-load-keys nil))
2039 ;; Make highlighting of selected text work properly for EDT commands. 1976 ;; Make highlighting of selected text work properly for EDT commands.
2040 (if (featurep 'emacs) 1977 (setq edt-orig-transient-mark-mode
2041 (progn 1978 (default-value 'transient-mark-mode))
2042 (setq edt-orig-transient-mark-mode 1979 (add-hook 'activate-mark-hook
2043 (default-value 'transient-mark-mode)) 1980 (lambda ()
2044 (add-hook 'activate-mark-hook 1981 (edt-select-mode t)))
2045 (function 1982 (add-hook 'deactivate-mark-hook
2046 (lambda () 1983 (lambda ()
2047 (edt-select-mode t)))) 1984 (edt-select-mode nil)))
2048 (add-hook 'deactivate-mark-hook
2049 (function
2050 (lambda ()
2051 (edt-select-mode nil)))))
2052 (progn
2053 (add-hook 'zmacs-activate-region-hook
2054 (function
2055 (lambda ()
2056 (edt-select-mode t))))
2057 (add-hook 'zmacs-deactivate-region-hook
2058 (function
2059 (lambda ()
2060 (edt-select-mode nil))))))
2061 ;; Load user's EDT custom key bindings file, if it exists. 1985 ;; Load user's EDT custom key bindings file, if it exists.
2062 ;; Otherwise, use the default bindings. 1986 ;; Otherwise, use the default bindings.
2063 (if (load "edt-user" t t) 1987 (if (load "edt-user" t t)
@@ -2074,8 +1998,7 @@ created."
2074 (setq edt-select-mode-current nil) 1998 (setq edt-select-mode-current nil)
2075 (edt-reset) 1999 (edt-reset)
2076 (force-mode-line-update t) 2000 (force-mode-line-update t)
2077 (if (featurep 'emacs) 2001 (setq-default transient-mark-mode edt-orig-transient-mark-mode)
2078 (setq-default transient-mark-mode edt-orig-transient-mark-mode))
2079 (message "Original key bindings restored; EDT Emulation disabled")) 2002 (message "Original key bindings restored; EDT Emulation disabled"))
2080 2003
2081(defun edt-default-menu-bar-update-buffers () 2004(defun edt-default-menu-bar-update-buffers ()
@@ -2103,9 +2026,7 @@ Optional argument USER-SETUP non-nil means called from function
2103 ;; disturbing the original bindings in global-map. 2026 ;; disturbing the original bindings in global-map.
2104 (fset 'edt-default-ESC-prefix (copy-keymap 'ESC-prefix)) 2027 (fset 'edt-default-ESC-prefix (copy-keymap 'ESC-prefix))
2105 (setq edt-default-global-map (copy-keymap (current-global-map))) 2028 (setq edt-default-global-map (copy-keymap (current-global-map)))
2106 (if (featurep 'emacs) 2029 (define-key edt-default-global-map "\e" 'edt-default-ESC-prefix)
2107 (define-key edt-default-global-map "\e" 'edt-default-ESC-prefix)
2108 (define-key edt-default-global-map [escape] 'edt-default-ESC-prefix))
2109 (define-prefix-command 'edt-default-gold-map) 2030 (define-prefix-command 'edt-default-gold-map)
2110 (edt-setup-default-bindings) 2031 (edt-setup-default-bindings)
2111 ;; If terminal has additional function keys, the terminal-specific 2032 ;; If terminal has additional function keys, the terminal-specific
@@ -2141,9 +2062,7 @@ Optional argument USER-SETUP non-nil means called from function
2141 ;; Setup user EDT global map by copying default EDT global map bindings. 2062 ;; Setup user EDT global map by copying default EDT global map bindings.
2142 (fset 'edt-user-ESC-prefix (copy-keymap 'edt-default-ESC-prefix)) 2063 (fset 'edt-user-ESC-prefix (copy-keymap 'edt-default-ESC-prefix))
2143 (setq edt-user-global-map (copy-keymap edt-default-global-map)) 2064 (setq edt-user-global-map (copy-keymap edt-default-global-map))
2144 (if (featurep 'emacs) 2065 (define-key edt-user-global-map "\e" 'edt-user-ESC-prefix)
2145 (define-key edt-user-global-map "\e" 'edt-user-ESC-prefix)
2146 (define-key edt-user-global-map [escape] 'edt-user-ESC-prefix))
2147 ;; If terminal has additional function keys, the user's initialization 2066 ;; If terminal has additional function keys, the user's initialization
2148 ;; file can assign bindings to them via the optional 2067 ;; file can assign bindings to them via the optional
2149 ;; function edt-setup-extra-default-bindings. 2068 ;; function edt-setup-extra-default-bindings.
@@ -2160,8 +2079,7 @@ Optional argument USER-SETUP non-nil means called from function
2160(defun edt-select-default-global-map() 2079(defun edt-select-default-global-map()
2161 "Select default EDT emulation key bindings." 2080 "Select default EDT emulation key bindings."
2162 (interactive) 2081 (interactive)
2163 (if (featurep 'emacs) 2082 (transient-mark-mode 1)
2164 (transient-mark-mode 1))
2165 (use-global-map edt-default-global-map) 2083 (use-global-map edt-default-global-map)
2166 (if (not edt-keep-current-page-delimiter) 2084 (if (not edt-keep-current-page-delimiter)
2167 (progn 2085 (progn
@@ -2178,8 +2096,7 @@ Optional argument USER-SETUP non-nil means called from function
2178 (interactive) 2096 (interactive)
2179 (if edt-user-map-configured 2097 (if edt-user-map-configured
2180 (progn 2098 (progn
2181 (if (featurep 'emacs) 2099 (transient-mark-mode 1)
2182 (transient-mark-mode 1))
2183 (use-global-map edt-user-global-map) 2100 (use-global-map edt-user-global-map)
2184 (if (not edt-keep-current-page-delimiter) 2101 (if (not edt-keep-current-page-delimiter)
2185 (progn 2102 (progn