;;; xterm.el --- define function key sequences and standard colors for xterm
;; Copyright (C) 1995, 2001, 2002, 2003, 2004, 2005,
-;; 2006, 2007, 2008 Free Software Foundation, Inc.
+;; 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
;; Author: FSF
;; Keywords: terminals
(let ((coding-system-for-read 'binary)
(chr nil)
(str nil))
+ ;; Pending input can be mistakenly returned by the calls to
+ ;; read-event below. Discard it.
+ (discard-input)
;; Try to find out the type of terminal by sending a "Secondary
;; Device Attributes (DA)" query.
(send-string-to-terminal "\e[>0c")
(clear-face-cache)))
(defun xterm-turn-on-modify-other-keys ()
- "Turn on the modifyOtherKeys feature of xterm."
+ "Turn the modifyOtherKeys feature of xterm back on."
(let ((terminal (frame-terminal (selected-frame))))
(when (and (terminal-live-p terminal)
(memq terminal xterm-modify-other-keys-terminal-list))
- (send-string-to-terminal "\e[>4;1m"))))
+ (send-string-to-terminal "\e[>4;1m" terminal))))
(defun xterm-turn-off-modify-other-keys (&optional frame)
- "Turn off the modifyOtherKeys feature of xterm."
+ "Temporarily turn off the modifyOtherKeys feature of xterm."
(let ((terminal (when frame (frame-terminal frame))))
- (when (and (frame-live-p terminal)
+ (when (and (terminal-live-p terminal)
(memq terminal xterm-modify-other-keys-terminal-list))
- (send-string-to-terminal "\e[>4m"))))
+ (send-string-to-terminal "\e[>4m" terminal))))
(defun xterm-remove-modify-other-keys (&optional terminal)
- "Turn off the modifyOtherKeys feature of xterm and remove frame from consideration."
- (setq terminal (and terminal (frame-terminal (selected-frame))))
+ "Turn off the modifyOtherKeys feature of xterm for good."
+ (setq terminal (or terminal (frame-terminal (selected-frame))))
(when (and (terminal-live-p terminal)
(memq terminal xterm-modify-other-keys-terminal-list))
(setq xterm-modify-other-keys-terminal-list
(delq terminal xterm-modify-other-keys-terminal-list))
- (send-string-to-terminal "\e[>4m")))
+ (send-string-to-terminal "\e[>4m" terminal)))
;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a
;;; xterm.el ends here