diff device-type-hacking.el @ 57:0d4e2fbdb6aa

adopt
author Henry S Thompson <ht@inf.ed.ac.uk>
date Sat, 02 Mar 2024 21:40:24 +0000
parents shared/device-type-hacking.el@107d592c5f4a
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/device-type-hacking.el	Sat Mar 02 21:40:24 2024 +0000
@@ -0,0 +1,63 @@
+
+
+(defconst device-type-hacking-id "$Id: device-type-hacking.el,v 1.1 1996/07/25 22:17:36 rjc Exp $")
+
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+ ;;                                                                  ;;
+ ;; Changes some values depending on device type ttys. have          ;;
+ ;; control-h being delete and zmacs-regions turned off.             ;;
+ ;;                                                                  ;;
+ ;; Since select-frame-hook doesn't seem to be called for tty        ;;
+ ;; devices, we have to cheat and set the tty defaults whenever a    ;;
+ ;; frame is deselected.                                             ;;
+ ;;                                                                  ;;
+ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defvar zmacs-regions-specifier
+  (make-specifier-and-init 'boolean 
+			   '( (global ((tty). nil) ((x) . t)) )
+			   ))
+
+
+(defun device-type-tty-selected ()
+
+  (define-key global-map '(control h) 'backward-delete-char-untabify)
+  )
+
+(defun device-type-x-selected ()
+
+  (define-key global-map '(control h) 'help)
+  )
+
+(defun device-type-select-frame-hook ()
+
+  (setq zmacs-regions 
+	(specifier-instance zmacs-regions-specifier)
+	)
+
+  (if (equal (device-type (selected-device)) "tty")
+      (device-type-tty-selected)
+    (device-type-x-selected)
+    )
+
+  )
+
+(defun device-type-deselect-frame-hook ()
+
+  (setq zmacs-regions 
+	(not (specifier-instance zmacs-regions-specifier))
+	)
+
+  (device-type-tty-selected)
+
+  )
+	
+(setq deselect-frame-hook '(default-deselect-frame-hook))
+(setq select-frame-hook '(default-select-frame-hook))
+
+
+(add-hook 'select-frame-hook (function device-type-select-frame-hook))
+(add-hook 'deselect-frame-hook (function device-type-deselect-frame-hook) t)
+
+
+