summaryrefslogtreecommitdiff
path: root/lisp/term
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2007-07-24 01:25:28 +0000
committerMiles Bader <miles@gnu.org>2007-07-24 01:25:28 +0000
commit492d9f3e3ccd2b640958e840caa451e9e04e86db (patch)
treec87779daf272535b621216ef05179fa48102e57e /lisp/term
parent7eb1e4534e88a32fe5e549e630fdabf3e062be2b (diff)
parent1e8995158740b15936887264a3d7183beb5c51d9 (diff)
downloademacs-492d9f3e3ccd2b640958e840caa451e9e04e86db.tar.gz
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 814-823) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 59-69) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 237-238) - Update from CVS Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-26
Diffstat (limited to 'lisp/term')
-rw-r--r--lisp/term/x-win.el3
-rw-r--r--lisp/term/xterm.el40
2 files changed, 42 insertions, 1 deletions
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index 658911a9e34..5e04ef08e47 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -135,6 +135,9 @@
initial-frame-alist)
x-invocation-args (cdr x-invocation-args)))))))
+(defun x-handle-no-bitmap-icon (switch)
+ (setq default-frame-alist (cons '(icon-type) default-frame-alist)))
+
;; Make -iconic apply only to the initial frame!
(defun x-handle-iconic (switch)
(setq initial-frame-alist
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 9cc4c6b45d6..3308b50a588 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -401,7 +401,37 @@
(xterm-register-default-colors)
;; This recomputes all the default faces given the colors we've just set up.
- (tty-set-up-initial-frame-faces))
+ (tty-set-up-initial-frame-faces)
+
+ ;; Try to turn on the modifyOtherKeys feature on modern xterms.
+ ;; When it is turned on much more key bindings work: things like
+ ;; C-. C-, etc.
+ ;; To do that we need to find out if the current terminal supports
+ ;; modifyOtherKeys. At this time only xterm does.
+ (let ((coding-system-for-read 'binary)
+ (chr nil)
+ (str nil))
+ ;; Try to find out the type of terminal by sending a "Secondary
+ ;; Device Attributes (DA)" query.
+ (send-string-to-terminal "\e[>0c")
+
+ ;; The reply should be of the form: \e [ > NUMBER1 ; NUMBER2 ; NUMBER3 c
+ (when (equal (read-event nil nil 0.1) ?\e)
+ (when (equal (read-event nil nil 0.1) ?\[)
+ (while (not (equal (setq chr (read-event nil nil 0.1)) ?c))
+ (setq str (concat str (string chr))))
+ (when (string-match ">0;\\([0-9]+\\);0" str)
+ ;; NUMBER2 is the xterm version number, look for something
+ ;; greater than 216, the version when modifyOtherKeys was
+ ;; introduced.
+ (when (>= (string-to-number
+ (substring str (match-beginning 1) (match-end 1))) 216)
+ ;; Make sure that the modifyOtherKeys state is restored when
+ ;; 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)
+ (xterm-turn-on-modify-other-keys))))))))
;; Set up colors, for those versions of xterm that support it.
(defvar xterm-standard-colors
@@ -519,5 +549,13 @@ versions of xterm."
;; right colors, so clear them.
(clear-face-cache)))
+(defun xterm-turn-on-modify-other-keys ()
+ "Turn on the modifyOtherKeys feature of xterm."
+ (send-string-to-terminal "\e[>4;1m"))
+
+(defun xterm-turn-off-modify-other-keys ()
+ "Turn off the modifyOtherKeys feature of xterm."
+ (send-string-to-terminal "\e[>4m"))
+
;; arch-tag: 12e7ebdd-1e6c-4b25-b0f9-35ace25e855a
;;; xterm.el ends here