]> git.eshelyaron.com Git - emacs.git/commitdiff
(xterm-modify-other-keys-terminal-list): New
authorDan Nicolaescu <dann@ics.uci.edu>
Sun, 2 Sep 2007 18:22:41 +0000 (18:22 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Sun, 2 Sep 2007 18:22:41 +0000 (18:22 +0000)
variable.
(xterm-turn-on-modify-other-keys): Only turn on modify-other-keys
if the selected frames is in
xterm-modify-other-keys-terminal-list.
(xterm-turn-off-modify-other-keys): Add an optional frame
parameter. Only turn off modify-other-keys if FRAME is in
xterm-modify-other-keys-terminal-list.
(xterm-remove-modify-other-keys): New function.
(terminal-init-xterm): Use it. Deal with delete-frame hook. Add
the selected frame to xterm-modify-other-keys-terminal-list.

lisp/ChangeLog
lisp/term/xterm.el

index f69b4fa6ae92ba1c9c5f06c2cf42cf787a81b4bd..14dddab6752f5246841835162b51232f5dddbb31 100644 (file)
@@ -1,3 +1,17 @@
+2007-09-02  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * term/xterm.el (xterm-modify-other-keys-terminal-list): New
+       variable.
+       (xterm-turn-on-modify-other-keys): Only turn on modify-other-keys
+       if the selected frames is in
+       xterm-modify-other-keys-terminal-list.
+       (xterm-turn-off-modify-other-keys): Add an optional frame
+       parameter. Only turn off modify-other-keys if FRAME is in
+       xterm-modify-other-keys-terminal-list.
+       (xterm-remove-modify-other-keys): New function.
+       (terminal-init-xterm): Use it. Deal with delete-frame hook. Add
+       the selected frame to xterm-modify-other-keys-terminal-list.
+
 2007-09-02  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * term/x-win.el (x-gtk-stock-map): Map diropen to system-file-manager.
index 22f83f2f96d483e0834057bf305b4f1f9a3518b9..5b4bd05c5423f6eac452865c7ad2438fdce76a7c 100644 (file)
 (define-key xterm-function-map "\e[13~" [f3])
 (define-key xterm-function-map "\e[14~" [f4])
 
+;; List of terminals for which modify-other-keys has been turned on.
+(defvar xterm-modify-other-keys-terminal-list nil)
+
 (defun terminal-init-xterm ()
   "Terminal initialization function for xterm."
   ;; rxvt terminals sometimes set the TERM variable to "xterm", but
              ;; suspending, resuming and exiting.
              (add-hook 'suspend-hook 'xterm-turn-off-modify-other-keys)
              (add-hook 'suspend-resume-hook 'xterm-turn-on-modify-other-keys)
-             (add-hook 'kill-emacs-hook 'xterm-turn-off-modify-other-keys)
+             (add-hook 'kill-emacs-hook 'xterm-remove-modify-other-keys)
+             (add-hook 'delete-frame-hook 'xterm-remove-modify-other-keys)
+             ;; Add the selected frame to the list of frames that
+             ;; need to deal with modify-other-keys.
+             (push (frame-terminal (selected-frame)) 
+                   xterm-modify-other-keys-terminal-list)
              (xterm-turn-on-modify-other-keys)))))))
 
 ;; Set up colors, for those versions of xterm that support it.
@@ -551,11 +559,27 @@ versions of xterm."
 
 (defun xterm-turn-on-modify-other-keys ()
   "Turn on the modifyOtherKeys feature of xterm."
-  (send-string-to-terminal "\e[>4;1m"))
+  (let ((frame (selected-frame)))
+    (when (and (frame-live-p frame)
+              (memq frame xterm-modify-other-keys-terminal-list))
+      (send-string-to-terminal "\e[>4;1m"))))
 
-(defun xterm-turn-off-modify-other-keys ()
+(defun xterm-turn-off-modify-other-keys (&optional frame)
   "Turn off the modifyOtherKeys feature of xterm."
-  (send-string-to-terminal "\e[>4m"))
+  (setq frame (and frame (selected-frame)))
+  (when (and (frame-live-p frame)
+            (memq frame xterm-modify-other-keys-terminal-list))
+    (send-string-to-terminal "\e[>4m")))
+
+(defun xterm-remove-modify-other-keys (&optional frame)
+  "Turn off the modifyOtherKeys feature of xterm and remove frame from consideration."
+  (setq frame (and frame (selected-frame)))
+  (when (and (frame-live-p frame)
+            (memq frame xterm-modify-other-keys-terminal-list))
+    (setq xterm-modify-other-keys-terminal-list 
+         (delq (frame-terminal frame) 
+               xterm-modify-other-keys-terminal-list))
+    (send-string-to-terminal "\e[>4m")))
 
 ;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a
 ;;; xterm.el ends here