1 ;;; vt-control.el --- Common VTxxx control functions
3 ;; Copyright (C) 1993, 1994, 2001, 2002, 2003,
4 ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
6 ;; Author: Rob Riepel <riepel@networking.stanford.edu>
7 ;; Maintainer: Rob Riepel <riepel@networking.stanford.edu>
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;; The functions contained in this file send various VT control codes
28 ;; to the terminal where emacs is running. The following functions are
33 ;; vt-wide set wide screen (132 characters)
34 ;; vt-narrow set narrow screen (80 characters)
35 ;; vt-toggle-screen toggle wide/narrow screen
36 ;; vt-keypad-on set applications keypad on
37 ;; vt-keypad-off set applications keypad off
38 ;; vt-numlock toggle applications keypad on/off
42 ;; To use enable these functions, simply load this file.
44 ;; Note: vt-control makes no effort to determine how the terminal is
45 ;; initially set. It assumes the terminal starts with a width
46 ;; of 80 characters and the applications keypad enabled. Nor
47 ;; does vt-control try to restore the terminal when emacs is
48 ;; killed or suspended.
55 (defvar vt-applications-keypad-p t
56 "If non-nil, keypad is in applications mode.")
59 "If non-nil, the screen is 132 characters wide.")
62 ;;; Screen width functions.
65 "Set the screen 132 characters wide."
67 (send-string-to-terminal "\e[?3h")
68 (set-frame-width (selected-frame) 132)
72 "Set the screen 80 characters wide."
74 (send-string-to-terminal "\e[?3l")
75 (set-frame-width (selected-frame) 80)
78 (defun vt-toggle-screen nil
79 "Toggle between 80 and 132 character screen width."
81 (if vt-wide-p
(vt-narrow) (vt-wide)))
84 ;;; Applications keypad functions.
86 (defun vt-keypad-on (&optional tell
)
87 "Turn on the VT applications keypad."
89 (send-string-to-terminal "\e=")
90 (setq vt-applications-keypad-p t
)
91 (if (or tell
(called-interactively-p 'interactive
))
92 (message "Applications keypad enabled.")))
94 (defun vt-keypad-off (&optional tell
)
95 "Turn off the VT applications keypad."
97 (send-string-to-terminal "\e>")
98 (setq vt-applications-keypad-p nil
)
99 (if (or tell
(called-interactively-p 'interactive
))
100 (message "Applications keypad disabled.")))
102 (defun vt-numlock nil
103 "Toggle VT application keypad on and off."
105 (if vt-applications-keypad-p
106 (vt-keypad-off (called-interactively-p 'interactive
))
107 (vt-keypad-on (called-interactively-p 'interactive
))))
109 (provide 'vt-control
)
111 ;; arch-tag: d4fed1bf-2524-4ba1-a4fe-86bca3d928a2
112 ;;; vt-control.el ends here