diff options
| author | Gerd Moellmann | 2001-01-08 13:18:43 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-01-08 13:18:43 +0000 |
| commit | f3e03a42c6b3791d517a7bd3fce6f075c264dffb (patch) | |
| tree | c33c5a154728f8b24c2ec1e7608181a4b6a3746c | |
| parent | 90b6fe58c8a9a44f2d0dd09262875af901500312 (diff) | |
| download | emacs-f3e03a42c6b3791d517a7bd3fce6f075c264dffb.tar.gz emacs-f3e03a42c6b3791d517a7bd3fce6f075c264dffb.zip | |
Update to version 4.0. Provide support for
EDT scroll margins at top and bottom of the window. Provide an
emulation of the EDT SUBS command (bound to GOLD-Enter, by
default). Enhance edt-quit, bound to GOLD-q by default, to warn
user when file-related buffer modifications exist. Provide
support for running EDT Emulation in XEmacs. Provide customize
access to some user updatable variables. Add Commentary section
to file header. Fixed a few minor bugs and cleaned up some code.
| -rw-r--r-- | lisp/emulation/edt.el | 2022 |
1 files changed, 1376 insertions, 646 deletions
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el index 856dffc6bb3..2912da5df28 100644 --- a/lisp/emulation/edt.el +++ b/lisp/emulation/edt.el | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | ;;; edt.el --- Enhanced EDT Keypad Mode Emulation for GNU Emacs 19 | 1 | ;;; edt.el --- Enhanced EDT Keypad Mode Emulation for GNU Emacs 19 |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1986, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1986, 1992, 1993, 1994, 1995, 2000, 2001 |
| 4 | ;; Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | ;; Author: Kevin Gallagher <kevingal@onramp.net> | 6 | ;; Author: Kevin Gallagher <kevingal@onramp.net> |
| 6 | ;; Maintainer: Kevin Gallagher <kevingal@onramp.net> | 7 | ;; Maintainer: Kevin Gallagher <kevingal@onramp.net> |
| @@ -9,28 +10,155 @@ | |||
| 9 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 10 | 11 | ||
| 11 | ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 | ;; GNU Emacs is free software; you can redistribute it and/or modify |
| 12 | ;; it under the terms of the GNU General Public License as published by | 13 | ;; it under the terms of the GNU General Public License as published |
| 13 | ;; the Free Software Foundation; either version 2, or (at your option) | 14 | ;; by the Free Software Foundation; either version 2, or (at your |
| 14 | ;; any later version. | 15 | ;; option) any later version. |
| 15 | 16 | ||
| 16 | ;; GNU Emacs is distributed in the hope that it will be useful, | 17 | ;; GNU Emacs is distributed in the hope that it will be useful, but |
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | ;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 19 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | ;; GNU General Public License for more details. | 20 | ;; General Public License for more details. |
| 20 | 21 | ||
| 21 | ;; You should have received a copy of the GNU General Public License | 22 | ;; You should have received a copy of the GNU General Public License |
| 22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | 23 | ;; along with GNU Emacs; see the file COPYING. If not, write to the |
| 23 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 24 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 24 | ;; Boston, MA 02111-1307, USA. | 25 | ;; Boston, MA 02111-1307, USA. |
| 25 | 26 | ||
| 26 | ;;; Usage: | ||
| 27 | 27 | ||
| 28 | ;; See edt-user.doc in the Emacs etc directory. | 28 | |
| 29 | ;;; Commentary: | ||
| 30 | ;; | ||
| 31 | |||
| 32 | ;; This is Version 4.0 of the EDT Emulation for Emacs 19 and above. | ||
| 33 | ;; It comes with special functions which replicate nearly all of EDT's | ||
| 34 | ;; keypad mode behavior. It sets up default keypad and function key | ||
| 35 | ;; bindings which closely match those found in EDT. Support is | ||
| 36 | ;; provided so that users may reconfigure most keypad and function key | ||
| 37 | ;; bindings to their own liking. | ||
| 38 | |||
| 39 | ;; NOTE: Version 4.0 contains several enhancements. See the | ||
| 40 | ;; Enhancement section below for the details. | ||
| 41 | |||
| 42 | ;; Getting Started: | ||
| 43 | |||
| 44 | ;; To start the EDT Emulation, first start Emacs and then enter | ||
| 45 | ;; | ||
| 46 | ;; M-x edt-emulation-on | ||
| 47 | ;; | ||
| 48 | ;; to begin the emulation. After initialization is complete, the | ||
| 49 | ;; following message will appear below the status line informing you | ||
| 50 | ;; that the emulation has been enabled: "Default EDT keymap active". | ||
| 51 | |||
| 52 | ;; You can have the EDT Emulation start up automatically, each time | ||
| 53 | ;; you initiate a GNU Emacs session, by adding the following line to | ||
| 54 | ;; your .emacs file: | ||
| 55 | ;; | ||
| 56 | ;; (add-hook term-setup-hook 'edt-emulation-on) | ||
| 57 | |||
| 58 | ;; IMPORTANT: Be sure to read the file, edt-user.doc, located in the | ||
| 59 | ;; Emacs "etc" directory. It contains very helpful user information. | ||
| 60 | |||
| 61 | ;; The EDT emulation consists of the following files: | ||
| 62 | ;; | ||
| 63 | ;; edt-user.doc - User Instructions and Sample Customization File | ||
| 64 | ;; edt.el - EDT Emulation Functions and Default Configuration | ||
| 65 | ;; edt-lk201.el - Built-in support for DEC LK-201 Keyboards | ||
| 66 | ;; edt-vt100.el - Built-in support for DEC VT-100 (and above) terminals | ||
| 67 | ;; edt-pc.el - Built-in support for PC 101 Keyboards under MS-DOS | ||
| 68 | ;; edt-mapper.el - Create an EDT LK-201 Map File for Keyboards Without | ||
| 69 | ;; Built-in Support | ||
| 70 | |||
| 71 | ;; Enhancements: | ||
| 72 | |||
| 73 | ;; Version 4.0 contains the following enhancements: | ||
| 74 | |||
| 75 | ;; 1. Scroll margins at the top and bottom of the window are now | ||
| 76 | ;; supported. (The design was copied from tpu-extras.el.) By | ||
| 77 | ;; default, this feature is enabled, with the top margin set to | ||
| 78 | ;; 10% of the window and the bottom margin set to 15% of the | ||
| 79 | ;; window. To change these settings, you can invoke the function | ||
| 80 | ;; edt-set-scroll-margins in your .emacs file. For example, the | ||
| 81 | ;; following line | ||
| 82 | ;; | ||
| 83 | ;; (edt-set-scroll-margins "20%" "25%") | ||
| 84 | ;; | ||
| 85 | ;; sets the top margin to 20% of the window and the bottom margin | ||
| 86 | ;; to 25% of the window. To disable this feature, set each | ||
| 87 | ;; margin to 0%. You can also invoke edt-set-scroll-margins | ||
| 88 | ;; interactively while EDT Emulation is active to change the | ||
| 89 | ;; settings for that session. | ||
| 90 | ;; | ||
| 91 | ;; NOTE: Another way to set the scroll margins is to use the | ||
| 92 | ;; Emacs customization feature (not available in Emacs 19) to set | ||
| 93 | ;; the following two variables directly: | ||
| 94 | ;; | ||
| 95 | ;; edt-top-scroll-margin and edt-bottom-scroll-margin | ||
| 96 | ;; | ||
| 97 | ;; Enter the Emacs `customize' command. First select the Editing | ||
| 98 | ;; group and then select the Emulations group. Finally, select | ||
| 99 | ;; the Edt group and follow the directions. | ||
| 100 | ;; | ||
| 101 | ;; 2. The SUBS command is now supported and bound to GOLD-Enter by | ||
| 102 | ;; default. (This design was copied from tpu-edt.el.) Note, in | ||
| 103 | ;; earlier versions of EDT Emulation, GOLD-Enter was assigned to | ||
| 104 | ;; the Emacs function `query-replace'. The binding of | ||
| 105 | ;; `query-replace' has been moved to GOLD-/. If you prefer to | ||
| 106 | ;; restore `query-replace' to GOLD-Enter, then use an EDT user | ||
| 107 | ;; customization file, edt-user.el, to do this. See edt-user.doc | ||
| 108 | ;; for details. | ||
| 109 | |||
| 110 | ;; 3. EDT Emulation now also works in XEmacs, including the | ||
| 111 | ;; highlighting of selected text. | ||
| 112 | |||
| 113 | ;; 4. If you access a workstation using an X Server, observe that | ||
| 114 | ;; the initialization file generated by edt-mapper.el will now | ||
| 115 | ;; contain the name of the X Server vendor. This is a | ||
| 116 | ;; convenience for those who have access to their Unix account | ||
| 117 | ;; from more than one type of X Server. Since different X | ||
| 118 | ;; Servers typically require different EDT emulation | ||
| 119 | ;; initialization files, edt-mapper.el will now generate these | ||
| 120 | ;; different initialization files and save them with different | ||
| 121 | ;; names. Then, the correct initialization file for the | ||
| 122 | ;; particular X server in use is loaded correctly automatically. | ||
| 123 | |||
| 124 | ;; 5. Also, edt-mapper.el is now capable of binding an ASCII key | ||
| 125 | ;; sequence, providing the ASCII key sequence prefix is already | ||
| 126 | ;; known by Emacs to be a prefix. As a result of providing this | ||
| 127 | ;; support, some terminal/keyboard/window system configurations, | ||
| 128 | ;; which don't have a complete set of sensible function key | ||
| 129 | ;; bindings built into Emacs in `function-key-map', can still be | ||
| 130 | ;; configured for use with EDT Emulation. (Note: In a few rare | ||
| 131 | ;; circumstances this does not work properly. In particular, it | ||
| 132 | ;; does not work if a subset of the leading ASCII characters in a | ||
| 133 | ;; key sequence are recognized by Emacs as having an existing | ||
| 134 | ;; binding. For example, if the keypad 7 (KP-7) key generates | ||
| 135 | ;; the sequence \"<ESC>Ow\" and \"<ESC>O\" is already bound to a | ||
| 136 | ;; function, pressing KP-7 when told to do so by edt-mapper.el | ||
| 137 | ;; will result in edt-mapper.el incorrectly mapping \"<ESC>O\" to | ||
| 138 | ;; KP-7 and \"w\" to KP-8. If something like this happens to | ||
| 139 | ;; you, it is probably a bug in the support for your keyboard | ||
| 140 | ;; within Emacs OR a bug in the Unix termcap/terminfo support for | ||
| 141 | ;; your terminal OR a bug in the terminal emulation software you | ||
| 142 | ;; are using.) | ||
| 143 | |||
| 144 | ;; 6. The edt-quit function (bound to GOLD-q by default) has been | ||
| 145 | ;; modified to warn the user when file-related buffer | ||
| 146 | ;; modifications exist. It now cautions the user that those | ||
| 147 | ;; modifications will be lost if the user quits without saving | ||
| 148 | ;; those buffers. | ||
| 149 | |||
| 150 | |||
| 151 | ;;; History: | ||
| 152 | ;; | ||
| 153 | ;; Version 4.0 2000 Added New Features and Fixed a Few Bugs | ||
| 154 | ;; | ||
| 29 | 155 | ||
| 30 | ;; ==================================================================== | ||
| 31 | 156 | ||
| 157 | ;;; Code: | ||
| 158 | |||
| 32 | ;;; Electric Help functions are used for keypad help displays. A few | 159 | ;;; Electric Help functions are used for keypad help displays. A few |
| 33 | ;;; picture functions are used in rectangular cut and paste commands. | 160 | ;;; picture functions are used in rectangular cut and paste commands. |
| 161 | |||
| 34 | (require 'ehelp) | 162 | (require 'ehelp) |
| 35 | (require 'picture) | 163 | (require 'picture) |
| 36 | 164 | ||
| @@ -38,17 +166,155 @@ | |||
| 38 | ;;;; VARIABLES and CONSTANTS | 166 | ;;;; VARIABLES and CONSTANTS |
| 39 | ;;;; | 167 | ;;;; |
| 40 | 168 | ||
| 169 | ;; For backward compatibility to Emacs 19, skip this if defgroup is | ||
| 170 | ;; not defined. | ||
| 171 | (if (fboundp 'defgroup) | ||
| 172 | (defgroup edt nil | ||
| 173 | "Emacs emulating EDT." | ||
| 174 | :prefix "edt-" | ||
| 175 | :group 'emulations)) | ||
| 176 | |||
| 177 | ;;; | ||
| 178 | ;;; Version Information | ||
| 179 | ;;; | ||
| 180 | (defconst edt-version "4.0" "EDT Emulation version number.") | ||
| 181 | |||
| 182 | ;;; | ||
| 183 | ;;; User Configurable Variables | ||
| 184 | ;;; | ||
| 185 | |||
| 186 | ;; For backward compatibility to Emacs 19, use defvar if defcustom is | ||
| 187 | ;; not defined. | ||
| 188 | (if (fboundp 'defcustom) | ||
| 189 | (progn | ||
| 190 | (defcustom edt-keep-current-page-delimiter nil | ||
| 191 | "*Emacs MUST be restarted for a change in value to take effect! | ||
| 192 | Non-nil leaves Emacs value of `page-delimiter' unchanged within EDT | ||
| 193 | Emulation. If set to nil (the default), the `page-delimiter' variable | ||
| 194 | is set to \"\\f\" when edt-emulation-on is first invoked. This | ||
| 195 | setting replicates EDT's page delimiter behavior. The original value | ||
| 196 | is restored when edt-emulation-off is called." | ||
| 197 | :type 'boolean | ||
| 198 | :group 'edt) | ||
| 199 | |||
| 200 | (defcustom edt-use-EDT-control-key-bindings nil | ||
| 201 | "*Emacs MUST be restarted for a change in value to take effect! | ||
| 202 | Non-nil causes the control key bindings to be replaced with EDT | ||
| 203 | bindings. If set to nil (the default), EDT control key bindings are | ||
| 204 | not used and the current Emacs control key bindings are retained for | ||
| 205 | use within the EDT emulation." | ||
| 206 | :type 'boolean | ||
| 207 | :group 'edt) | ||
| 208 | |||
| 209 | (defcustom edt-word-entities '(?\t) | ||
| 210 | "*Specifies the list of EDT word entity characters. | ||
| 211 | The default list, (\?\\t), contains just the TAB character, which | ||
| 212 | emulates EDT. Characters are specified in the list using their | ||
| 213 | decimal ASCII values. A question mark, followed by the actual | ||
| 214 | character, can be used to indicate the numerical value of the | ||
| 215 | character, instead of the actual decimal value. So, ?A means the | ||
| 216 | numerical value for the letter A, \?/ means the numerical value for /, | ||
| 217 | etc. Several unprintable and special characters have special | ||
| 218 | representations, which you can also use: | ||
| 219 | |||
| 220 | \?\\b specifies BS, C-h | ||
| 221 | \?\\t specifies TAB, C-i | ||
| 222 | \?\\n specifies LFD, C-j | ||
| 223 | \?\\v specifies VTAB, C-k | ||
| 224 | \?\\f specifies FF, C-l | ||
| 225 | \?\\r specifies CR, C-m | ||
| 226 | \?\\e specifies ESC, C-[ | ||
| 227 | \?\\\\ specifies \\ | ||
| 228 | |||
| 229 | In EDT Emulation movement-by-word commands, each character in the list | ||
| 230 | will be treated as if it were a separate word." | ||
| 231 | :type '(repeat integer) | ||
| 232 | :group 'edt) | ||
| 233 | |||
| 234 | (defcustom edt-top-scroll-margin 10 | ||
| 235 | "*Scroll margin at the top of the screen. | ||
| 236 | Interpreted as a percent of the current window size with a default | ||
| 237 | setting of 10%. If set to 0, top scroll margin is disabled." | ||
| 238 | :type 'integer | ||
| 239 | :group 'edt) | ||
| 240 | |||
| 241 | (defcustom edt-bottom-scroll-margin 15 | ||
| 242 | "*Scroll margin at the bottom of the screen. | ||
| 243 | Interpreted as a percent of the current window size with a default | ||
| 244 | setting of 15%. If set to 0, bottom scroll margin is disabled." | ||
| 245 | :type 'integer | ||
| 246 | :group 'edt)) | ||
| 247 | (progn | ||
| 248 | (defvar edt-keep-current-page-delimiter nil | ||
| 249 | "*Non-nil leaves Emacs value of `page-delimiter' unchanged within EDT | ||
| 250 | Emulation. If set to nil (the default), the `page-delimiter' variable | ||
| 251 | is set to \"\\f\" when edt-emulation-on is first invoked. This | ||
| 252 | setting replicates EDT's page delimiter behavior. The original value | ||
| 253 | is restored when edt-emulation-off is called.") | ||
| 254 | |||
| 255 | (defvar edt-use-EDT-control-key-bindings nil | ||
| 256 | "*Non-nil causes the control key bindings to be replaced with EDT | ||
| 257 | bindings. If set to nil (the default), EDT control key bindings are | ||
| 258 | not used and the current Emacs control key bindings are retained for | ||
| 259 | use within the EDT emulation.") | ||
| 260 | |||
| 261 | (defvar edt-word-entities '(?\t) | ||
| 262 | "*Specifies the list of EDT word entity characters. | ||
| 263 | The default list, (\?\\t), contains just the TAB character, which | ||
| 264 | emulates EDT. Characters are specified in the list using their | ||
| 265 | decimal ASCII values. A question mark, followed by the actual | ||
| 266 | character, can be used to indicate the numerical value of the | ||
| 267 | character, instead of the actual decimal value. So, ?A means the | ||
| 268 | numerical value for the letter A, \?/ means the numerical value for /, | ||
| 269 | etc. Several unprintable and special characters have special | ||
| 270 | representations, which you can also use: | ||
| 271 | |||
| 272 | \?\\b specifies BS, C-h | ||
| 273 | \?\\t specifies TAB, C-i | ||
| 274 | \?\\n specifies LFD, C-j | ||
| 275 | \?\\v specifies VTAB, C-k | ||
| 276 | \?\\f specifies FF, C-l | ||
| 277 | \?\\r specifies CR, C-m | ||
| 278 | \?\\e specifies ESC, C-[ | ||
| 279 | \?\\\\ specifies \\ | ||
| 280 | |||
| 281 | In EDT Emulation movement-by-word commands, each character in the list | ||
| 282 | will be treated as if it were a separate word.") | ||
| 283 | |||
| 284 | (defvar edt-top-scroll-margin 10 | ||
| 285 | "*Scroll margin at the top of the screen. | ||
| 286 | Interpreted as a percent of the current window size with a default | ||
| 287 | setting of 10%. If set to 0, top scroll margin is disabled.") | ||
| 288 | |||
| 289 | (defvar edt-bottom-scroll-margin 15 | ||
| 290 | "*Scroll margin at the bottom of the screen. | ||
| 291 | Interpreted as a percent of the current window size with a default | ||
| 292 | setting of 15%. If set to 0, bottom scroll margin is disabled."))) | ||
| 293 | |||
| 294 | ;;; | ||
| 295 | ;;; Internal Variables | ||
| 296 | ;;; | ||
| 297 | |||
| 41 | (defvar edt-last-deleted-lines "" | 298 | (defvar edt-last-deleted-lines "" |
| 42 | "Last text deleted by an EDT emulation line delete command.") | 299 | "Last text deleted by the EDT emulation DEL L command.") |
| 43 | 300 | ||
| 44 | (defvar edt-last-deleted-words "" | 301 | (defvar edt-last-deleted-words "" |
| 45 | "Last text deleted by an EDT emulation word delete command.") | 302 | "Last text deleted by the EDT emulation DEL W command.") |
| 46 | 303 | ||
| 47 | (defvar edt-last-deleted-chars "" | 304 | (defvar edt-last-deleted-chars "" |
| 48 | "Last text deleted by an EDT emulation character delete command.") | 305 | "Last text deleted by the EDT emulation DEL C command.") |
| 306 | |||
| 307 | (defvar edt-find-last-text "" | ||
| 308 | "Last text found by the EDT emulation FIND command.") | ||
| 49 | 309 | ||
| 50 | (defvar edt-last-replaced-key-definition "" | 310 | (defvar edt-match-beginning-mark (make-marker) |
| 51 | "Key definition replaced with edt-define-key or edt-learn command.") | 311 | "Used internally by the EDT emulation SUBS command.") |
| 312 | |||
| 313 | (defvar edt-match-end-mark (make-marker) | ||
| 314 | "Used internally by the EDT emulation SUBS command.") | ||
| 315 | |||
| 316 | (defvar edt-last-replaced-key-definition nil | ||
| 317 | "Key definition replaced with `edt-define-key' or `edt-learn' command.") | ||
| 52 | 318 | ||
| 53 | (defvar edt-direction-string "" | 319 | (defvar edt-direction-string "" |
| 54 | "String indicating current direction of movement.") | 320 | "String indicating current direction of movement.") |
| @@ -56,11 +322,12 @@ | |||
| 56 | (defvar edt-select-mode nil | 322 | (defvar edt-select-mode nil |
| 57 | "Non-nil means select mode is active.") | 323 | "Non-nil means select mode is active.") |
| 58 | 324 | ||
| 59 | (defvar edt-select-mode-text "" | 325 | (defvar edt-select-mode-current "" |
| 60 | "Text displayed in mode line when select mode is active.") | 326 | "Text displayed in mode line to indicate the state of EDT select mode. |
| 327 | When select mode is inactive, it is set to an empty string.") | ||
| 61 | 328 | ||
| 62 | (defconst edt-select-mode-string " Select" | 329 | (defconst edt-select-mode-string " Select" |
| 63 | "String to indicate select mode is active.") | 330 | "Used in mode line to indicate select mode is active.") |
| 64 | 331 | ||
| 65 | (defconst edt-forward-string " ADVANCE" | 332 | (defconst edt-forward-string " ADVANCE" |
| 66 | "Direction string in mode line to indicate forward movement.") | 333 | "Direction string in mode line to indicate forward movement.") |
| @@ -74,57 +341,54 @@ Nil means user-defined custom bindings are active.") | |||
| 74 | 341 | ||
| 75 | (defvar edt-user-map-configured nil | 342 | (defvar edt-user-map-configured nil |
| 76 | "Non-nil indicates that user custom EDT key bindings are configured. | 343 | "Non-nil indicates that user custom EDT key bindings are configured. |
| 77 | This means that an edt-user.el file was found in the user's load-path.") | 344 | This means that an edt-user.el file was found in the user's `load-path'.") |
| 78 | |||
| 79 | (defvar edt-keep-current-page-delimiter nil | ||
| 80 | "Non-nil leaves current value of page-delimiter unchanged. | ||
| 81 | Nil causes the page-delimiter variable to be set to to \"\\f\" | ||
| 82 | when edt-emulation-on is first invoked. Original value is restored | ||
| 83 | when edt-emulation-off is called.") | ||
| 84 | |||
| 85 | (defvar edt-use-EDT-control-key-bindings nil | ||
| 86 | "Non-nil causes the control key bindings to be replaced with EDT bindings. | ||
| 87 | Nil (the default) means EDT control key bindings are not used and the current | ||
| 88 | control key bindings are retained for use in the EDT emulation.") | ||
| 89 | 345 | ||
| 90 | (defvar edt-word-entities '(?\t) | 346 | (defvar edt-term nil |
| 91 | "*Specifies the list of EDT word entity characters.") | 347 | "Specifies the terminal type, if applicable.") |
| 92 | 348 | ||
| 93 | ;;; | 349 | ;;; |
| 94 | ;;; Emacs version identifiers - currently referenced by | 350 | ;;; Emacs version identifiers - currently referenced by |
| 95 | ;;; | 351 | ;;; |
| 96 | ;;; o edt-emulation-on o edt-load-xkeys | 352 | ;;; o edt-emulation-on o edt-load-keys |
| 97 | ;;; | 353 | ;;; |
| 98 | (defconst edt-emacs19-p (not (string-lessp emacs-version "19")) | 354 | (defconst edt-emacs19-p (not (string-lessp emacs-version "19")) |
| 99 | "Non-nil if we are running Lucid or GNU Emacs version 19.") | 355 | "Non-nil if we are running GNU Emacs or XEmacs version 19, or higher.") |
| 100 | 356 | ||
| 101 | (defconst edt-lucid-emacs19-p | 357 | (defconst edt-x-emacs19-p |
| 102 | (and edt-emacs19-p (string-match "Lucid" emacs-version)) | 358 | (and edt-emacs19-p (string-match "XEmacs" emacs-version)) |
| 103 | "Non-nil if we are running Lucid Emacs version 19.") | 359 | "Non-nil if we are running XEmacs version 19, or higher.") |
| 104 | 360 | ||
| 105 | (defconst edt-gnu-emacs19-p (and edt-emacs19-p (not edt-lucid-emacs19-p)) | 361 | (defconst edt-gnu-emacs19-p (and edt-emacs19-p (not edt-x-emacs19-p)) |
| 106 | "Non-nil if we are running GNU Emacs version 19.") | 362 | "Non-nil if we are running GNU Emacs version 19, or higher.") |
| 107 | 363 | ||
| 108 | (defvar edt-xkeys-file nil | 364 | (defconst edt-emacs-variant (if edt-gnu-emacs19-p "gnu" "xemacs") |
| 109 | "File mapping X function keys to LK-201 keyboard function and keypad keys.") | 365 | "Indicates Emacs variant: GNU Emacs or XEmacs \(aka Lucid Emacs\).") |
| 366 | |||
| 367 | (defconst edt-window-system (if edt-gnu-emacs19-p window-system (console-type)) | ||
| 368 | "Indicates window system \(in GNU Emacs\) or console type \(in XEmacs\).") | ||
| 369 | |||
| 370 | (defconst edt-xserver (if (eq edt-window-system 'x) | ||
| 371 | (if edt-x-emacs19-p | ||
| 372 | (replace-in-string (x-server-vendor) "[ _]" "-") | ||
| 373 | (subst-char-in-string ? ?- (x-server-vendor))) | ||
| 374 | nil) | ||
| 375 | "Indicates X server vendor name, if applicable.") | ||
| 376 | |||
| 377 | (defvar edt-keys-file nil | ||
| 378 | "User's custom keypad and function keys mappings to emulate LK-201 keyboard.") | ||
| 110 | 379 | ||
| 111 | ;;;; | 380 | ;;;; |
| 112 | ;;;; EDT Emulation Commands | 381 | ;;;; EDT Emulation Commands |
| 113 | ;;;; | 382 | ;;;; |
| 114 | 383 | ||
| 115 | ;;; Almost all of EDT's keypad mode commands have equivalent | 384 | ;;; Almost all of EDT's keypad mode commands have equivalent Emacs |
| 116 | ;;; counterparts in Emacs. Some behave the same way in Emacs as they | 385 | ;;; function counterparts. But many of these counterparts behave |
| 117 | ;;; do in EDT, but most do not. | 386 | ;;; somewhat differently in Emacs. |
| 118 | ;;; | 387 | ;;; |
| 119 | ;;; The following Emacs functions emulate, where practical, the exact | 388 | ;;; So, the following Emacs functions emulate, where practical, the |
| 120 | ;;; behavior of the corresponding EDT keypad mode commands. In a few | 389 | ;;; exact behavior of the corresponding EDT keypad mode commands. In |
| 121 | ;;; cases, the emulation is not exact, but it is close enough for most | 390 | ;;; a few cases, the emulation is not exact, but it should be close |
| 122 | ;;; EDT die-hards. | 391 | ;;; enough for most EDT die-hards. |
| 123 | ;;; | ||
| 124 | ;;; In a very few cases, we chose to use the superior Emacs way of | ||
| 125 | ;;; handling things. For example, we do not emulate the EDT SUBS | ||
| 126 | ;;; command. Instead, we chose to use the superior Emacs | ||
| 127 | ;;; query-replace function. | ||
| 128 | ;;; | 392 | ;;; |
| 129 | 393 | ||
| 130 | ;;; | 394 | ;;; |
| @@ -145,67 +409,69 @@ control key bindings are retained for use in the EDT emulation.") | |||
| 145 | 409 | ||
| 146 | (defun edt-page-forward (num) | 410 | (defun edt-page-forward (num) |
| 147 | "Move forward to just after next page delimiter. | 411 | "Move forward to just after next page delimiter. |
| 148 | Accepts a positive prefix argument for the number of page delimiters to move." | 412 | Argument NUM is the number of page delimiters to move." |
| 149 | (interactive "p") | 413 | (interactive "p") |
| 150 | (edt-check-prefix num) | 414 | (edt-check-prefix num) |
| 151 | (if (eobp) | 415 | (if (eobp) |
| 152 | (error "End of buffer") | 416 | (error "End of buffer") |
| 153 | (progn | 417 | (progn |
| 154 | (forward-page num) | 418 | (forward-page num) |
| 155 | (if (eobp) | 419 | (if (eobp) |
| 156 | (edt-line-to-bottom-of-window) | 420 | (edt-line-to-bottom-of-window) |
| 157 | (edt-line-to-top-of-window))))) | 421 | (edt-line-to-top-of-window))))) |
| 158 | 422 | ||
| 159 | (defun edt-page-backward (num) | 423 | (defun edt-page-backward (num) |
| 160 | "Move backward to just after previous page delimiter. | 424 | "Move backward to just after previous page delimiter. |
| 161 | Accepts a positive prefix argument for the number of page delimiters to move." | 425 | Argument NUM is the number of page delimiters to move." |
| 162 | (interactive "p") | 426 | (interactive "p") |
| 163 | (edt-check-prefix num) | 427 | (edt-check-prefix num) |
| 164 | (if (bobp) | 428 | (if (bobp) |
| 165 | (error "Beginning of buffer") | 429 | (error "Beginning of buffer") |
| 166 | (progn | 430 | (progn |
| 167 | (backward-page num) | 431 | (backward-page num) |
| 168 | (edt-line-to-top-of-window)))) | 432 | (edt-line-to-top-of-window) |
| 433 | (if edt-x-emacs19-p (setq zmacs-region-stays t))))) | ||
| 169 | 434 | ||
| 170 | (defun edt-page (num) | 435 | (defun edt-page (num) |
| 171 | "Move in current direction to next page delimiter. | 436 | "Move in current direction to next page delimiter. |
| 172 | Accepts a positive prefix argument for the number of page delimiters to move." | 437 | Argument NUM is the number of page delimiters to move." |
| 173 | (interactive "p") | 438 | (interactive "p") |
| 174 | (if (equal edt-direction-string edt-forward-string) | 439 | (if (equal edt-direction-string edt-forward-string) |
| 175 | (edt-page-forward num) | 440 | (edt-page-forward num) |
| 176 | (edt-page-backward num))) | 441 | (edt-page-backward num))) |
| 177 | 442 | ||
| 178 | ;;; | 443 | ;;; |
| 179 | ;;; SECT | 444 | ;;; SECT |
| 180 | ;;; | 445 | ;;; |
| 181 | ;;; EDT defaults a section size to be 16 lines of its one and only | 446 | ;;; EDT defaults a section size to be 16 lines of its one and only |
| 182 | ;;; 24-line window. That's two-thirds of the window at a time. The | 447 | ;;; 24-line window. That's two-thirds of the window at a time. The |
| 183 | ;;; EDT SECT commands moves the cursor, not the window. | 448 | ;;; EDT SECT commands moves the cursor, not the window. |
| 184 | ;;; | 449 | ;;; |
| 185 | ;;; This emulation of EDT's SECT moves the cursor approximately two-thirds | 450 | ;;; This emulation of EDT's SECT moves the cursor approximately |
| 186 | ;;; of the current window at a time. | 451 | ;;; two-thirds of the current window at a time. |
| 187 | 452 | ||
| 188 | (defun edt-sect-forward (num) | 453 | (defun edt-sect-forward (num) |
| 189 | "Move cursor forward two-thirds of a window. | 454 | "Move cursor forward two-thirds of a window's number of lines. |
| 190 | Accepts a positive prefix argument for the number of sections to move." | 455 | Argument NUM is the number of sections to move." |
| 191 | (interactive "p") | 456 | (interactive "p") |
| 192 | (edt-check-prefix num) | 457 | (edt-check-prefix num) |
| 193 | (edt-line-forward (* (* (/ (- (window-height) 1) 3) 2) num))) | 458 | (edt-line-forward (* (* (/ (- (window-height) 1) 3) 2) num))) |
| 194 | 459 | ||
| 460 | |||
| 195 | (defun edt-sect-backward (num) | 461 | (defun edt-sect-backward (num) |
| 196 | "Move cursor backward two-thirds of a window. | 462 | "Move cursor backward two-thirds of a window. |
| 197 | Accepts a positive prefix argument for the number of sections to move." | 463 | Argument NUM is the number of sections to move." |
| 198 | (interactive "p") | 464 | (interactive "p") |
| 199 | (edt-check-prefix num) | 465 | (edt-check-prefix num) |
| 200 | (edt-line-backward (* (* (/ (- (window-height) 1) 3) 2) num))) | 466 | (edt-line-backward (* (* (/ (- (window-height) 1) 3) 2) num))) |
| 201 | 467 | ||
| 202 | (defun edt-sect (num) | 468 | (defun edt-sect (num) |
| 203 | "Move in current direction a full window. | 469 | "Move in current direction a full window. |
| 204 | Accepts a positive prefix argument for the number windows to move." | 470 | Argument NUM is the number of sections to move." |
| 205 | (interactive "p") | 471 | (interactive "p") |
| 206 | (if (equal edt-direction-string edt-forward-string) | 472 | (if (equal edt-direction-string edt-forward-string) |
| 207 | (edt-sect-forward num) | 473 | (edt-sect-forward num) |
| 208 | (edt-sect-backward num))) | 474 | (edt-sect-backward num))) |
| 209 | 475 | ||
| 210 | ;;; | 476 | ;;; |
| 211 | ;;; BEGINNING OF LINE | 477 | ;;; BEGINNING OF LINE |
| @@ -215,14 +481,18 @@ Accepts a positive prefix argument for the number windows to move." | |||
| 215 | 481 | ||
| 216 | (defun edt-beginning-of-line (num) | 482 | (defun edt-beginning-of-line (num) |
| 217 | "Move backward to next beginning of line mark. | 483 | "Move backward to next beginning of line mark. |
| 218 | Accepts a positive prefix argument for the number of BOL marks to move." | 484 | Argument NUM is the number of BOL marks to move." |
| 219 | (interactive "p") | 485 | (interactive "p") |
| 220 | (edt-check-prefix num) | 486 | (edt-check-prefix num) |
| 221 | (if (bolp) | 487 | (let ((beg (edt-current-line))) |
| 222 | (forward-line (* -1 num)) | 488 | (if (bolp) |
| 489 | (forward-line (* -1 num)) | ||
| 223 | (progn | 490 | (progn |
| 224 | (setq num (1- num)) | 491 | (setq num (1- num)) |
| 225 | (forward-line (* -1 num))))) | 492 | (forward-line (* -1 num)))) |
| 493 | (edt-top-check beg num)) | ||
| 494 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 495 | |||
| 226 | 496 | ||
| 227 | ;;; | 497 | ;;; |
| 228 | ;;; EOL (End of Line) | 498 | ;;; EOL (End of Line) |
| @@ -230,37 +500,45 @@ Accepts a positive prefix argument for the number of BOL marks to move." | |||
| 230 | 500 | ||
| 231 | (defun edt-end-of-line-forward (num) | 501 | (defun edt-end-of-line-forward (num) |
| 232 | "Move forward to next end of line mark. | 502 | "Move forward to next end of line mark. |
| 233 | Accepts a positive prefix argument for the number of EOL marks to move." | 503 | Argument NUM is the number of EOL marks to move." |
| 234 | (interactive "p") | 504 | (interactive "p") |
| 235 | (edt-check-prefix num) | 505 | (edt-check-prefix num) |
| 236 | (forward-char) | 506 | (let ((beg (edt-current-line))) |
| 237 | (end-of-line num)) | 507 | (forward-char) |
| 508 | (end-of-line num) | ||
| 509 | (edt-bottom-check beg num)) | ||
| 510 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 511 | |||
| 238 | 512 | ||
| 239 | (defun edt-end-of-line-backward (num) | 513 | (defun edt-end-of-line-backward (num) |
| 240 | "Move backward to next end of line mark. | 514 | "Move backward to next end of line mark. |
| 241 | Accepts a positive prefix argument for the number of EOL marks to move." | 515 | Argument NUM is the number of EOL marks to move." |
| 242 | (interactive "p") | 516 | (interactive "p") |
| 243 | (edt-check-prefix num) | 517 | (edt-check-prefix num) |
| 244 | (end-of-line (1- num))) | 518 | (let ((beg (edt-current-line))) |
| 519 | (end-of-line (1- num)) | ||
| 520 | (edt-top-check beg num)) | ||
| 521 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 522 | |||
| 245 | 523 | ||
| 246 | (defun edt-end-of-line (num) | 524 | (defun edt-end-of-line (num) |
| 247 | "Move in current direction to next end of line mark. | 525 | "Move in current direction to next end of line mark. |
| 248 | Accepts a positive prefix argument for the number of EOL marks to move." | 526 | Argument NUM is the number of EOL marks to move." |
| 249 | (interactive "p") | 527 | (interactive "p") |
| 250 | (if (equal edt-direction-string edt-forward-string) | 528 | (if (equal edt-direction-string edt-forward-string) |
| 251 | (edt-end-of-line-forward num) | 529 | (edt-end-of-line-forward num) |
| 252 | (edt-end-of-line-backward num))) | 530 | (edt-end-of-line-backward num))) |
| 253 | 531 | ||
| 254 | ;;; | 532 | ;;; |
| 255 | ;;; WORD | 533 | ;;; WORD |
| 256 | ;;; | 534 | ;;; |
| 257 | ;;; This one is a tad messy. To emulate EDT's behavior everywhere in | 535 | ;;; This one is a tad messy. To emulate EDT's behavior everywhere in |
| 258 | ;;; the file (beginning of file, end of file, beginning of line, end | 536 | ;;; the file (beginning of file, end of file, beginning of line, end |
| 259 | ;;; of line, etc.) it takes a bit of special handling. | 537 | ;;; of line, etc.) it takes a bit of special handling. |
| 260 | ;;; | 538 | ;;; |
| 261 | ;;; The variable edt-word-entities contains a list of characters which | 539 | ;;; The variable edt-word-entities contains a list of characters which |
| 262 | ;;; are to be viewed as distinct words where ever they appear in the | 540 | ;;; are to be viewed as distinct words where ever they appear in the |
| 263 | ;;; buffer. This emulates the EDT line mode command SET ENTITY WORD. | 541 | ;;; buffer. This emulates the EDT line mode command SET ENTITY WORD. |
| 264 | 542 | ||
| 265 | 543 | ||
| 266 | (defun edt-one-word-forward () | 544 | (defun edt-one-word-forward () |
| @@ -270,21 +548,22 @@ Accepts a positive prefix argument for the number of EOL marks to move." | |||
| 270 | (error "End of buffer")) | 548 | (error "End of buffer")) |
| 271 | (if (eolp) | 549 | (if (eolp) |
| 272 | (forward-char) | 550 | (forward-char) |
| 273 | (progn | 551 | (progn |
| 274 | (if (memq (following-char) edt-word-entities) | 552 | (if (memq (following-char) edt-word-entities) |
| 275 | (forward-char) | 553 | (forward-char) |
| 276 | (while (and | 554 | (while (and |
| 277 | (not (eolp)) | 555 | (not (eolp)) |
| 278 | (not (eobp)) | 556 | (not (eobp)) |
| 279 | (not (eq ?\ (char-syntax (following-char)))) | 557 | (not (eq ?\ (char-syntax (following-char)))) |
| 280 | (not (memq (following-char) edt-word-entities))) | 558 | (not (memq (following-char) edt-word-entities))) |
| 281 | (forward-char))) | 559 | (forward-char))) |
| 282 | (while (and | 560 | (while (and |
| 283 | (not (eolp)) | 561 | (not (eolp)) |
| 284 | (not (eobp)) | 562 | (not (eobp)) |
| 285 | (eq ?\ (char-syntax (following-char))) | 563 | (eq ?\ (char-syntax (following-char))) |
| 286 | (not (memq (following-char) edt-word-entities))) | 564 | (not (memq (following-char) edt-word-entities))) |
| 287 | (forward-char))))) | 565 | (forward-char)))) |
| 566 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 288 | 567 | ||
| 289 | (defun edt-one-word-backward () | 568 | (defun edt-one-word-backward () |
| 290 | "Move backward to first character of previous word." | 569 | "Move backward to first character of previous word." |
| @@ -293,25 +572,26 @@ Accepts a positive prefix argument for the number of EOL marks to move." | |||
| 293 | (error "Beginning of buffer")) | 572 | (error "Beginning of buffer")) |
| 294 | (if (bolp) | 573 | (if (bolp) |
| 295 | (backward-char) | 574 | (backward-char) |
| 296 | (progn | 575 | (progn |
| 297 | (backward-char) | 576 | (backward-char) |
| 298 | (while (and | 577 | (while (and |
| 299 | (not (bolp)) | 578 | (not (bolp)) |
| 300 | (not (bobp)) | 579 | (not (bobp)) |
| 301 | (eq ?\ (char-syntax (following-char))) | 580 | (eq ?\ (char-syntax (following-char))) |
| 302 | (not (memq (following-char) edt-word-entities))) | 581 | (not (memq (following-char) edt-word-entities))) |
| 303 | (backward-char)) | 582 | (backward-char)) |
| 304 | (if (not (memq (following-char) edt-word-entities)) | 583 | (if (not (memq (following-char) edt-word-entities)) |
| 305 | (while (and | 584 | (while (and |
| 306 | (not (bolp)) | 585 | (not (bolp)) |
| 307 | (not (bobp)) | 586 | (not (bobp)) |
| 308 | (not (eq ?\ (char-syntax (preceding-char)))) | 587 | (not (eq ?\ (char-syntax (preceding-char)))) |
| 309 | (not (memq (preceding-char) edt-word-entities))) | 588 | (not (memq (preceding-char) edt-word-entities))) |
| 310 | (backward-char)))))) | 589 | (backward-char))))) |
| 590 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 311 | 591 | ||
| 312 | (defun edt-word-forward (num) | 592 | (defun edt-word-forward (num) |
| 313 | "Move forward to first character of next word. | 593 | "Move forward to first character of next word. |
| 314 | Accepts a positive prefix argument for the number of words to move." | 594 | Argument NUM is the number of words to move." |
| 315 | (interactive "p") | 595 | (interactive "p") |
| 316 | (edt-check-prefix num) | 596 | (edt-check-prefix num) |
| 317 | (while (> num 0) | 597 | (while (> num 0) |
| @@ -320,7 +600,7 @@ Accepts a positive prefix argument for the number of words to move." | |||
| 320 | 600 | ||
| 321 | (defun edt-word-backward (num) | 601 | (defun edt-word-backward (num) |
| 322 | "Move backward to first character of previous word. | 602 | "Move backward to first character of previous word. |
| 323 | Accepts a positive prefix argument for the number of words to move." | 603 | Argument NUM is the number of words to move." |
| 324 | (interactive "p") | 604 | (interactive "p") |
| 325 | (edt-check-prefix num) | 605 | (edt-check-prefix num) |
| 326 | (while (> num 0) | 606 | (while (> num 0) |
| @@ -329,11 +609,11 @@ Accepts a positive prefix argument for the number of words to move." | |||
| 329 | 609 | ||
| 330 | (defun edt-word (num) | 610 | (defun edt-word (num) |
| 331 | "Move in current direction to first character of next word. | 611 | "Move in current direction to first character of next word. |
| 332 | Accepts a positive prefix argument for the number of words to move." | 612 | Argument NUM is the number of words to move." |
| 333 | (interactive "p") | 613 | (interactive "p") |
| 334 | (if (equal edt-direction-string edt-forward-string) | 614 | (if (equal edt-direction-string edt-forward-string) |
| 335 | (edt-word-forward num) | 615 | (edt-word-forward num) |
| 336 | (edt-word-backward num))) | 616 | (edt-word-backward num))) |
| 337 | 617 | ||
| 338 | ;;; | 618 | ;;; |
| 339 | ;;; CHAR | 619 | ;;; CHAR |
| @@ -341,12 +621,13 @@ Accepts a positive prefix argument for the number of words to move." | |||
| 341 | 621 | ||
| 342 | (defun edt-character (num) | 622 | (defun edt-character (num) |
| 343 | "Move in current direction to next character. | 623 | "Move in current direction to next character. |
| 344 | Accepts a positive prefix argument for the number of characters to move." | 624 | Argument NUM is the number of characters to move." |
| 345 | (interactive "p") | 625 | (interactive "p") |
| 346 | (edt-check-prefix num) | 626 | (edt-check-prefix num) |
| 347 | (if (equal edt-direction-string edt-forward-string) | 627 | (if (equal edt-direction-string edt-forward-string) |
| 348 | (forward-char num) | 628 | (forward-char num) |
| 349 | (backward-char num))) | 629 | (backward-char num)) |
| 630 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 350 | 631 | ||
| 351 | ;;; | 632 | ;;; |
| 352 | ;;; LINE | 633 | ;;; LINE |
| @@ -357,24 +638,52 @@ Accepts a positive prefix argument for the number of characters to move." | |||
| 357 | 638 | ||
| 358 | (defun edt-line-backward (num) | 639 | (defun edt-line-backward (num) |
| 359 | "Move backward to next beginning of line mark. | 640 | "Move backward to next beginning of line mark. |
| 360 | Accepts a positive prefix argument for the number of BOL marks to move." | 641 | Argument NUM is the number of BOL marks to move." |
| 361 | (interactive "p") | 642 | (interactive "p") |
| 362 | (edt-beginning-of-line num)) | 643 | (edt-beginning-of-line num)) |
| 363 | 644 | ||
| 364 | (defun edt-line-forward (num) | 645 | (defun edt-line-forward (num) |
| 365 | "Move forward to next beginning of line mark. | 646 | "Move forward to next beginning of line mark. |
| 366 | Accepts a positive prefix argument for the number of BOL marks to move." | 647 | Argument NUM is the number of BOL marks to move." |
| 367 | (interactive "p") | 648 | (interactive "p") |
| 368 | (edt-check-prefix num) | 649 | (edt-check-prefix num) |
| 369 | (forward-line num)) | 650 | (let ((beg (edt-current-line))) |
| 651 | (forward-line num) | ||
| 652 | (edt-bottom-check beg num)) | ||
| 653 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 370 | 654 | ||
| 371 | (defun edt-line (num) | 655 | (defun edt-line (num) |
| 372 | "Move in current direction to next beginning of line mark. | 656 | "Move in current direction to next beginning of line mark. |
| 373 | Accepts a positive prefix argument for the number of BOL marks to move." | 657 | Argument NUM is the number of BOL marks to move." |
| 374 | (interactive "p") | 658 | (interactive "p") |
| 375 | (if (equal edt-direction-string edt-forward-string) | 659 | (if (equal edt-direction-string edt-forward-string) |
| 376 | (edt-line-forward num) | 660 | (edt-line-forward num) |
| 377 | (edt-line-backward num))) | 661 | (edt-line-backward num))) |
| 662 | |||
| 663 | ;;; | ||
| 664 | ;;; UP and DOWN Arrows | ||
| 665 | ;;; | ||
| 666 | |||
| 667 | (defun edt-next-line (num) | ||
| 668 | "Move cursor down one line. | ||
| 669 | Argument NUM is the number of lines to move." | ||
| 670 | (interactive "p") | ||
| 671 | (edt-check-prefix num) | ||
| 672 | (let ((beg (edt-current-line))) | ||
| 673 | (next-line num) | ||
| 674 | (edt-bottom-check beg num)) | ||
| 675 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 676 | |||
| 677 | (defun edt-previous-line (num) | ||
| 678 | "Move cursor up one line. | ||
| 679 | Argument NUM is the number of lines to move." | ||
| 680 | (interactive "p") | ||
| 681 | (edt-check-prefix num) | ||
| 682 | (let ((beg (edt-current-line))) | ||
| 683 | (previous-line num) | ||
| 684 | (edt-top-check beg num)) | ||
| 685 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 686 | |||
| 378 | 687 | ||
| 379 | ;;; | 688 | ;;; |
| 380 | ;;; TOP | 689 | ;;; TOP |
| @@ -383,7 +692,8 @@ Accepts a positive prefix argument for the number of BOL marks to move." | |||
| 383 | (defun edt-top () | 692 | (defun edt-top () |
| 384 | "Move cursor to the beginning of buffer." | 693 | "Move cursor to the beginning of buffer." |
| 385 | (interactive) | 694 | (interactive) |
| 386 | (goto-char (point-min))) | 695 | (goto-char (point-min)) |
| 696 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 387 | 697 | ||
| 388 | ;;; | 698 | ;;; |
| 389 | ;;; BOTTOM | 699 | ;;; BOTTOM |
| @@ -400,24 +710,66 @@ Accepts a positive prefix argument for the number of BOL marks to move." | |||
| 400 | ;;; | 710 | ;;; |
| 401 | 711 | ||
| 402 | (defun edt-find-forward (&optional find) | 712 | (defun edt-find-forward (&optional find) |
| 403 | "Find first occurrence of a string in forward direction and save it." | 713 | "Find first occurrence of a string in forward direction and save it. |
| 714 | Optional argument FIND is t is this function is called from `edt-find'." | ||
| 404 | (interactive) | 715 | (interactive) |
| 405 | (if (not find) | 716 | (if (not find) |
| 406 | (set 'search-last-string (read-string "Search forward: "))) | 717 | (set 'edt-find-last-text (read-string "Search forward: "))) |
| 407 | (if (search-forward search-last-string) | 718 | (let* ((left nil) |
| 408 | (search-backward search-last-string))) | 719 | (beg (edt-current-line)) |
| 720 | (height (window-height)) | ||
| 721 | (top-percent | ||
| 722 | (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin)) | ||
| 723 | (bottom-percent | ||
| 724 | (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin)) | ||
| 725 | (top-margin (/ (* height top-percent) 100)) | ||
| 726 | (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100))) | ||
| 727 | (bottom-margin (max beg (- height bottom-up-margin 1))) | ||
| 728 | (top (save-excursion (move-to-window-line top-margin) (point))) | ||
| 729 | (bottom (save-excursion (move-to-window-line bottom-margin) (point))) | ||
| 730 | (far (save-excursion | ||
| 731 | (goto-char bottom) (forward-line (- height 2)) (point)))) | ||
| 732 | (if (search-forward edt-find-last-text) | ||
| 733 | (progn | ||
| 734 | (search-backward edt-find-last-text) | ||
| 735 | (edt-set-match) | ||
| 736 | (cond((> (point) far) | ||
| 737 | (setq left (save-excursion (forward-line height))) | ||
| 738 | (if (= 0 left) (recenter top-margin) | ||
| 739 | (recenter (- left bottom-up-margin)))) | ||
| 740 | (t | ||
| 741 | (and (> (point) bottom) (recenter bottom-margin))))))) | ||
| 742 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 409 | 743 | ||
| 410 | (defun edt-find-backward (&optional find) | 744 | (defun edt-find-backward (&optional find) |
| 411 | "Find first occurrence of a string in the backward direction and save it." | 745 | "Find first occurrence of a string in the backward direction and save it. |
| 746 | Optional argument FIND is t if this function is called from `edt-find'." | ||
| 412 | (interactive) | 747 | (interactive) |
| 413 | (if (not find) | 748 | (if (not find) |
| 414 | (set 'search-last-string (read-string "Search backward: "))) | 749 | (set 'edt-find-last-text (read-string "Search backward: "))) |
| 415 | (search-backward search-last-string)) | 750 | (let* ((left nil) |
| 751 | (beg (edt-current-line)) | ||
| 752 | (height (window-height)) | ||
| 753 | (top-percent | ||
| 754 | (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin)) | ||
| 755 | (bottom-percent | ||
| 756 | (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin)) | ||
| 757 | (top-margin (/ (* height top-percent) 100)) | ||
| 758 | (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100))) | ||
| 759 | (bottom-margin (max beg (- height bottom-up-margin 1))) | ||
| 760 | (top (save-excursion (move-to-window-line top-margin) (point))) | ||
| 761 | (bottom (save-excursion (move-to-window-line bottom-margin) (point))) | ||
| 762 | (far (save-excursion | ||
| 763 | (goto-char bottom) (forward-line (- height 2)) (point)))) | ||
| 764 | (if (search-backward edt-find-last-text) | ||
| 765 | (edt-set-match)) | ||
| 766 | (and (< (point) top) (recenter (min beg top-margin)))) | ||
| 767 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 416 | 768 | ||
| 417 | (defun edt-find () | 769 | (defun edt-find () |
| 418 | "Find first occurrence of string in current direction and save it." | 770 | "Find first occurrence of string in current direction and save it." |
| 419 | (interactive) | 771 | (interactive) |
| 420 | (set 'search-last-string (read-string "Search: ")) | 772 | (set 'edt-find-last-text (read-string "Search: ")) |
| 421 | (if (equal edt-direction-string edt-forward-string) | 773 | (if (equal edt-direction-string edt-forward-string) |
| 422 | (edt-find-forward t) | 774 | (edt-find-forward t) |
| 423 | (edt-find-backward t))) | 775 | (edt-find-backward t))) |
| @@ -430,26 +782,66 @@ Accepts a positive prefix argument for the number of BOL marks to move." | |||
| 430 | (defun edt-find-next-forward () | 782 | (defun edt-find-next-forward () |
| 431 | "Find next occurrence of a string in forward direction." | 783 | "Find next occurrence of a string in forward direction." |
| 432 | (interactive) | 784 | (interactive) |
| 433 | (forward-char 1) | 785 | (let* ((left nil) |
| 434 | (if (search-forward search-last-string nil t) | 786 | (beg (edt-current-line)) |
| 435 | (search-backward search-last-string) | 787 | (height (window-height)) |
| 788 | (top-percent | ||
| 789 | (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin)) | ||
| 790 | (bottom-percent | ||
| 791 | (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin)) | ||
| 792 | (top-margin (/ (* height top-percent) 100)) | ||
| 793 | (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100))) | ||
| 794 | (bottom-margin (max beg (- height bottom-up-margin 1))) | ||
| 795 | (top (save-excursion (move-to-window-line top-margin) (point))) | ||
| 796 | (bottom (save-excursion (move-to-window-line bottom-margin) (point))) | ||
| 797 | (far (save-excursion | ||
| 798 | (goto-char bottom) (forward-line (- height 2)) (point)))) | ||
| 799 | (forward-char 1) | ||
| 800 | (if (search-forward edt-find-last-text nil t) | ||
| 801 | (progn | ||
| 802 | (search-backward edt-find-last-text) | ||
| 803 | (edt-set-match) | ||
| 804 | (cond((> (point) far) | ||
| 805 | (setq left (save-excursion (forward-line height))) | ||
| 806 | (if (= 0 left) (recenter top-margin) | ||
| 807 | (recenter (- left bottom-up-margin)))) | ||
| 808 | (t | ||
| 809 | (and (> (point) bottom) (recenter bottom-margin))))) | ||
| 436 | (progn | 810 | (progn |
| 437 | (backward-char 1) | 811 | (backward-char 1) |
| 438 | (error "Search failed: \"%s\"." search-last-string)))) | 812 | (error "Search failed: \"%s\"" edt-find-last-text)))) |
| 813 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 439 | 814 | ||
| 440 | (defun edt-find-next-backward () | 815 | (defun edt-find-next-backward () |
| 441 | "Find next occurrence of a string in backward direction." | 816 | "Find next occurrence of a string in backward direction." |
| 442 | (interactive) | 817 | (interactive) |
| 443 | (if (eq (search-backward search-last-string nil t) nil) | 818 | (let* ((left nil) |
| 819 | (beg (edt-current-line)) | ||
| 820 | (height (window-height)) | ||
| 821 | (top-percent | ||
| 822 | (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin)) | ||
| 823 | (bottom-percent | ||
| 824 | (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin)) | ||
| 825 | (top-margin (/ (* height top-percent) 100)) | ||
| 826 | (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100))) | ||
| 827 | (bottom-margin (max beg (- height bottom-up-margin 1))) | ||
| 828 | (top (save-excursion (move-to-window-line top-margin) (point))) | ||
| 829 | (bottom (save-excursion (move-to-window-line bottom-margin) (point))) | ||
| 830 | (far (save-excursion | ||
| 831 | (goto-char bottom) (forward-line (- height 2)) (point)))) | ||
| 832 | (if (not (search-backward edt-find-last-text nil t)) | ||
| 833 | (error "Search failed: \"%s\"" edt-find-last-text) | ||
| 444 | (progn | 834 | (progn |
| 445 | (error "Search failed: \"%s\"." search-last-string)))) | 835 | (edt-set-match) |
| 836 | (and (< (point) top) (recenter (min beg top-margin)))))) | ||
| 837 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 446 | 838 | ||
| 447 | (defun edt-find-next () | 839 | (defun edt-find-next () |
| 448 | "Find next occurrence of a string in current direction." | 840 | "Find next occurrence of a string in current direction." |
| 449 | (interactive) | 841 | (interactive) |
| 450 | (if (equal edt-direction-string edt-forward-string) | 842 | (if (equal edt-direction-string edt-forward-string) |
| 451 | (edt-find-next-forward) | 843 | (edt-find-next-forward) |
| 452 | (edt-find-next-backward))) | 844 | (edt-find-next-backward))) |
| 453 | 845 | ||
| 454 | ;;; | 846 | ;;; |
| 455 | ;;; APPEND | 847 | ;;; APPEND |
| @@ -469,7 +861,7 @@ Accepts a positive prefix argument for the number of BOL marks to move." | |||
| 469 | 861 | ||
| 470 | (defun edt-delete-line (num) | 862 | (defun edt-delete-line (num) |
| 471 | "Delete from cursor up to and including the end of line mark. | 863 | "Delete from cursor up to and including the end of line mark. |
| 472 | Accepts a positive prefix argument for the number of lines to delete." | 864 | Argument NUM is the number of lines to delete." |
| 473 | (interactive "*p") | 865 | (interactive "*p") |
| 474 | (edt-check-prefix num) | 866 | (edt-check-prefix num) |
| 475 | (let ((beg (point))) | 867 | (let ((beg (point))) |
| @@ -486,7 +878,7 @@ Accepts a positive prefix argument for the number of lines to delete." | |||
| 486 | 878 | ||
| 487 | (defun edt-delete-to-end-of-line (num) | 879 | (defun edt-delete-to-end-of-line (num) |
| 488 | "Delete from cursor up to but excluding the end of line mark. | 880 | "Delete from cursor up to but excluding the end of line mark. |
| 489 | Accepts a positive prefix argument for the number of lines to delete." | 881 | Argument NUM is the number of lines to delete." |
| 490 | (interactive "*p") | 882 | (interactive "*p") |
| 491 | (edt-check-prefix num) | 883 | (edt-check-prefix num) |
| 492 | (let ((beg (point))) | 884 | (let ((beg (point))) |
| @@ -506,7 +898,7 @@ In select mode, selected text is highlighted." | |||
| 506 | (if arg | 898 | (if arg |
| 507 | (progn | 899 | (progn |
| 508 | (make-local-variable 'edt-select-mode) | 900 | (make-local-variable 'edt-select-mode) |
| 509 | (setq edt-select-mode 'edt-select-mode-text) | 901 | (setq edt-select-mode 'edt-select-mode-current) |
| 510 | (setq rect-start-point (window-point))) | 902 | (setq rect-start-point (window-point))) |
| 511 | (progn | 903 | (progn |
| 512 | (kill-local-variable 'edt-select-mode))) | 904 | (kill-local-variable 'edt-select-mode))) |
| @@ -514,13 +906,15 @@ In select mode, selected text is highlighted." | |||
| 514 | 906 | ||
| 515 | (defun edt-select () | 907 | (defun edt-select () |
| 516 | "Set mark at cursor and start text selection." | 908 | "Set mark at cursor and start text selection." |
| 517 | (interactive) | 909 | (interactive) |
| 518 | (set-mark-command nil)) | 910 | (set-mark-command nil)) |
| 519 | 911 | ||
| 520 | (defun edt-reset () | 912 | (defun edt-reset () |
| 521 | "Cancel text selection." | 913 | "Cancel text selection." |
| 522 | (interactive) | 914 | (interactive) |
| 523 | (deactivate-mark)) | 915 | (if edt-gnu-emacs19-p |
| 916 | (deactivate-mark) | ||
| 917 | (zmacs-deactivate-region))) | ||
| 524 | 918 | ||
| 525 | ;;; | 919 | ;;; |
| 526 | ;;; CUT | 920 | ;;; CUT |
| @@ -539,7 +933,7 @@ In select mode, selected text is highlighted." | |||
| 539 | 933 | ||
| 540 | (defun edt-delete-to-beginning-of-line (num) | 934 | (defun edt-delete-to-beginning-of-line (num) |
| 541 | "Delete from cursor to beginning of line. | 935 | "Delete from cursor to beginning of line. |
| 542 | Accepts a positive prefix argument for the number of lines to delete." | 936 | Argument NUM is the number of lines to delete." |
| 543 | (interactive "*p") | 937 | (interactive "*p") |
| 544 | (edt-check-prefix num) | 938 | (edt-check-prefix num) |
| 545 | (let ((beg (point))) | 939 | (let ((beg (point))) |
| @@ -554,7 +948,7 @@ Accepts a positive prefix argument for the number of lines to delete." | |||
| 554 | 948 | ||
| 555 | (defun edt-delete-word (num) | 949 | (defun edt-delete-word (num) |
| 556 | "Delete from cursor up to but excluding first character of next word. | 950 | "Delete from cursor up to but excluding first character of next word. |
| 557 | Accepts a positive prefix argument for the number of words to delete." | 951 | Argument NUM is the number of words to delete." |
| 558 | (interactive "*p") | 952 | (interactive "*p") |
| 559 | (edt-check-prefix num) | 953 | (edt-check-prefix num) |
| 560 | (let ((beg (point))) | 954 | (let ((beg (point))) |
| @@ -568,7 +962,7 @@ Accepts a positive prefix argument for the number of words to delete." | |||
| 568 | 962 | ||
| 569 | (defun edt-delete-to-beginning-of-word (num) | 963 | (defun edt-delete-to-beginning-of-word (num) |
| 570 | "Delete from cursor to beginning of word. | 964 | "Delete from cursor to beginning of word. |
| 571 | Accepts a positive prefix argument for the number of words to delete." | 965 | Argument NUM is the number of words to delete." |
| 572 | (interactive "*p") | 966 | (interactive "*p") |
| 573 | (edt-check-prefix num) | 967 | (edt-check-prefix num) |
| 574 | (let ((beg (point))) | 968 | (let ((beg (point))) |
| @@ -582,7 +976,7 @@ Accepts a positive prefix argument for the number of words to delete." | |||
| 582 | 976 | ||
| 583 | (defun edt-delete-character (num) | 977 | (defun edt-delete-character (num) |
| 584 | "Delete character under cursor. | 978 | "Delete character under cursor. |
| 585 | Accepts a positive prefix argument for the number of characters to delete." | 979 | Argument NUM is the number of characters to delete." |
| 586 | (interactive "*p") | 980 | (interactive "*p") |
| 587 | (edt-check-prefix num) | 981 | (edt-check-prefix num) |
| 588 | (setq edt-last-deleted-chars | 982 | (setq edt-last-deleted-chars |
| @@ -595,7 +989,7 @@ Accepts a positive prefix argument for the number of characters to delete." | |||
| 595 | 989 | ||
| 596 | (defun edt-delete-previous-character (num) | 990 | (defun edt-delete-previous-character (num) |
| 597 | "Delete character in front of cursor. | 991 | "Delete character in front of cursor. |
| 598 | Accepts a positive prefix argument for the number of characters to delete." | 992 | Argument NUM is the number of characters to delete." |
| 599 | (interactive "*p") | 993 | (interactive "*p") |
| 600 | (edt-check-prefix num) | 994 | (edt-check-prefix num) |
| 601 | (setq edt-last-deleted-chars | 995 | (setq edt-last-deleted-chars |
| @@ -642,11 +1036,85 @@ Accepts a positive prefix argument for the number of characters to delete." | |||
| 642 | (defun edt-replace () | 1036 | (defun edt-replace () |
| 643 | "Replace marked section with last CUT (killed) text." | 1037 | "Replace marked section with last CUT (killed) text." |
| 644 | (interactive "*") | 1038 | (interactive "*") |
| 645 | (exchange-point-and-mark) | 1039 | (if (edt-check-match) |
| 646 | (let ((beg (point))) | 1040 | (replace-match (car kill-ring-yank-pointer)) |
| 647 | (exchange-point-and-mark) | 1041 | (progn |
| 648 | (delete-region beg (point))) | 1042 | (exchange-point-and-mark) |
| 649 | (yank)) | 1043 | (let ((beg (point))) |
| 1044 | (exchange-point-and-mark) | ||
| 1045 | (delete-region beg (point))) | ||
| 1046 | (yank)))) | ||
| 1047 | |||
| 1048 | ;;; | ||
| 1049 | ;;; SUBS | ||
| 1050 | ;;; | ||
| 1051 | |||
| 1052 | (defun edt-substitute (num) | ||
| 1053 | "Replace the selected region with the contents of the CUT buffer and. | ||
| 1054 | Repeat the most recent FIND command. (The Emacs kill ring is used as | ||
| 1055 | the CUT buffer.) | ||
| 1056 | Argument NUM is the repeat count. A positive value indicates the of times | ||
| 1057 | to repeat the substitution. A negative argument means replace all occurances | ||
| 1058 | of the search text." | ||
| 1059 | (interactive "p") | ||
| 1060 | (cond ((or edt-select-mode (edt-check-match)) | ||
| 1061 | (while (and (not (= num 0)) (or edt-select-mode (edt-check-match))) | ||
| 1062 | (edt-replace) | ||
| 1063 | (edt-find-next) | ||
| 1064 | (setq num (1- num)))) | ||
| 1065 | (t | ||
| 1066 | (error "No selection active")))) | ||
| 1067 | |||
| 1068 | (defun edt-set-match nil | ||
| 1069 | "Set markers at match beginning and end." | ||
| 1070 | ;; Add one to beginning mark so it stays with the first character of | ||
| 1071 | ;; the string even if characters are added just before the string. | ||
| 1072 | (setq edt-match-beginning-mark (copy-marker (1+ (match-beginning 0)))) | ||
| 1073 | (setq edt-match-end-mark (copy-marker (match-end 0)))) | ||
| 1074 | |||
| 1075 | (defun edt-unset-match nil | ||
| 1076 | "Unset match beginning and end markers." | ||
| 1077 | (set-marker edt-match-beginning-mark nil) | ||
| 1078 | (set-marker edt-match-end-mark nil)) | ||
| 1079 | |||
| 1080 | (defun edt-match-beginning nil | ||
| 1081 | "Return the location of the last match beginning." | ||
| 1082 | (1- (marker-position edt-match-beginning-mark))) | ||
| 1083 | |||
| 1084 | (defun edt-match-end nil | ||
| 1085 | "Return the location of the last match end." | ||
| 1086 | (marker-position edt-match-end-mark)) | ||
| 1087 | |||
| 1088 | (defun edt-check-match nil | ||
| 1089 | "Return t if point is between edt-match markers. | ||
| 1090 | Otherwise sets the edt-match markers to nil and returns nil." | ||
| 1091 | ;; make sure 1- marker is in this buffer | ||
| 1092 | ;; 2- point is at or after beginning marker | ||
| 1093 | ;; 3- point is before ending marker, or in the case of | ||
| 1094 | ;; zero length regions (like bol, or eol) that the | ||
| 1095 | ;; beginning, end, and point are equal. | ||
| 1096 | (cond ((and | ||
| 1097 | (equal (marker-buffer edt-match-beginning-mark) (current-buffer)) | ||
| 1098 | (>= (point) (1- (marker-position edt-match-beginning-mark))) | ||
| 1099 | (or | ||
| 1100 | (< (point) (marker-position edt-match-end-mark)) | ||
| 1101 | (and (= (1- (marker-position edt-match-beginning-mark)) | ||
| 1102 | (marker-position edt-match-end-mark)) | ||
| 1103 | (= (marker-position edt-match-end-mark) (point))))) t) | ||
| 1104 | (t | ||
| 1105 | (edt-unset-match) nil))) | ||
| 1106 | |||
| 1107 | (defun edt-show-match-markers nil | ||
| 1108 | "Show the values of the match markers." | ||
| 1109 | (interactive) | ||
| 1110 | (if (markerp edt-match-beginning-mark) | ||
| 1111 | (let ((beg (marker-position edt-match-beginning-mark))) | ||
| 1112 | (message "(%s, %s) in %s -- current %s in %s" | ||
| 1113 | (if beg (1- beg) nil) | ||
| 1114 | (marker-position edt-match-end-mark) | ||
| 1115 | (marker-buffer edt-match-end-mark) | ||
| 1116 | (point) (current-buffer))))) | ||
| 1117 | |||
| 650 | 1118 | ||
| 651 | ;;; | 1119 | ;;; |
| 652 | ;;; ADVANCE | 1120 | ;;; ADVANCE |
| @@ -658,9 +1126,11 @@ Also, execute command specified if in Minibuffer." | |||
| 658 | (interactive) | 1126 | (interactive) |
| 659 | (setq edt-direction-string edt-forward-string) | 1127 | (setq edt-direction-string edt-forward-string) |
| 660 | (force-mode-line-update) | 1128 | (force-mode-line-update) |
| 661 | (if (string-equal " *Minibuf" | 1129 | (if (string-equal " *Minibuf" |
| 662 | (substring (buffer-name) 0 (min (length (buffer-name)) 9))) | 1130 | (substring (buffer-name) 0 (min (length (buffer-name)) 9))) |
| 663 | (exit-minibuffer))) | 1131 | (exit-minibuffer)) |
| 1132 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 1133 | |||
| 664 | 1134 | ||
| 665 | ;;; | 1135 | ;;; |
| 666 | ;;; BACKUP | 1136 | ;;; BACKUP |
| @@ -672,14 +1142,16 @@ Also, execute command specified if in Minibuffer." | |||
| 672 | (interactive) | 1142 | (interactive) |
| 673 | (setq edt-direction-string edt-backward-string) | 1143 | (setq edt-direction-string edt-backward-string) |
| 674 | (force-mode-line-update) | 1144 | (force-mode-line-update) |
| 675 | (if (string-equal " *Minibuf" | 1145 | (if (string-equal " *Minibuf" |
| 676 | (substring (buffer-name) 0 (min (length (buffer-name)) 9))) | 1146 | (substring (buffer-name) 0 (min (length (buffer-name)) 9))) |
| 677 | (exit-minibuffer))) | 1147 | (exit-minibuffer)) |
| 1148 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 1149 | |||
| 678 | 1150 | ||
| 679 | ;;; | 1151 | ;;; |
| 680 | ;;; CHNGCASE | 1152 | ;;; CHNGCASE |
| 681 | ;;; | 1153 | ;;; |
| 682 | ;; This function is based upon Jeff Kowalski's case-flip function in his | 1154 | ;; This function is based upon Jeff Kowalski's case-flip function in his |
| 683 | ;; tpu.el. | 1155 | ;; tpu.el. |
| 684 | 1156 | ||
| 685 | (defun edt-change-case (num) | 1157 | (defun edt-change-case (num) |
| @@ -690,7 +1162,8 @@ current direction is ADVANCE, then the prefix number of character(s) under and | |||
| 690 | following cursor are changed. Second, if the current direction is BACKUP, then | 1162 | following cursor are changed. Second, if the current direction is BACKUP, then |
| 691 | the prefix number of character(s) before the cursor are changed. Accepts a | 1163 | the prefix number of character(s) before the cursor are changed. Accepts a |
| 692 | positive prefix for the number of characters to change, but the prefix is | 1164 | positive prefix for the number of characters to change, but the prefix is |
| 693 | ignored if text selection is active." | 1165 | ignored if text selection is active. |
| 1166 | Argument NUM is the numbers of consecutive characters to change." | ||
| 694 | (interactive "*p") | 1167 | (interactive "*p") |
| 695 | (edt-check-prefix num) | 1168 | (edt-check-prefix num) |
| 696 | (if edt-select-mode | 1169 | (if edt-select-mode |
| @@ -703,15 +1176,15 @@ ignored if text selection is active." | |||
| 703 | (point) (1+ (point))) | 1176 | (point) (1+ (point))) |
| 704 | (forward-char 1)) | 1177 | (forward-char 1)) |
| 705 | (goto-char point-save)) | 1178 | (goto-char point-save)) |
| 706 | (progn | 1179 | (progn |
| 707 | (if (string= edt-direction-string edt-backward-string) | 1180 | (if (string= edt-direction-string edt-backward-string) |
| 708 | (backward-char num)) | 1181 | (backward-char num)) |
| 709 | (while (> num 0) | 1182 | (while (> num 0) |
| 710 | (funcall (if (<= ?a (following-char)) | 1183 | (funcall (if (<= ?a (following-char)) |
| 711 | 'upcase-region 'downcase-region) | 1184 | 'upcase-region 'downcase-region) |
| 712 | (point) (1+ (point))) | 1185 | (point) (1+ (point))) |
| 713 | (forward-char 1) | 1186 | (forward-char 1) |
| 714 | (setq num (1- num)))))) | 1187 | (setq num (1- num)))))) |
| 715 | 1188 | ||
| 716 | ;;; | 1189 | ;;; |
| 717 | ;;; DEFINE KEY | 1190 | ;;; DEFINE KEY |
| @@ -719,24 +1192,27 @@ ignored if text selection is active." | |||
| 719 | 1192 | ||
| 720 | (defun edt-define-key () | 1193 | (defun edt-define-key () |
| 721 | "Assign an interactively-callable function to a specified key sequence. | 1194 | "Assign an interactively-callable function to a specified key sequence. |
| 722 | The current key definition is saved in edt-last-replaced-key-definition. | 1195 | The current key definition is saved in `edt-last-replaced-key-definition'. |
| 723 | Use edt-restore-key to restore last replaced key definition." | 1196 | Use `edt-restore-key' to restore last replaced key definition." |
| 724 | (interactive) | 1197 | (interactive) |
| 1198 | (if edt-x-emacs19-p (setq zmacs-region-stays t)) | ||
| 725 | (let (edt-function | 1199 | (let (edt-function |
| 726 | edt-key-definition-string) | 1200 | edt-key-definition) |
| 727 | (setq edt-key-definition-string | 1201 | (setq edt-key-definition |
| 728 | (read-key-sequence "Press the key to be defined: ")) | 1202 | (read-key-sequence "Press the key to be defined: ")) |
| 729 | (if (string-equal "\C-m" edt-key-definition-string) | 1203 | (if (if edt-gnu-emacs19-p |
| 730 | (message "Key not defined") | 1204 | (string-equal "\C-m" edt-key-definition) |
| 731 | (progn | 1205 | (string-equal "\C-m" (events-to-keys edt-key-definition))) |
| 732 | (setq edt-function (read-command "Enter command name: ")) | 1206 | (message "Key not defined") |
| 733 | (if (string-equal "" edt-function) | 1207 | (progn |
| 734 | (message "Key not defined") | 1208 | (setq edt-function (read-command "Enter command name: ")) |
| 735 | (progn | 1209 | (if (string-equal "" edt-function) |
| 736 | (setq edt-last-replaced-key-definition | 1210 | (message "Key not defined") |
| 737 | (lookup-key (current-global-map) edt-key-definition-string)) | 1211 | (progn |
| 738 | (define-key (current-global-map) | 1212 | (setq edt-last-replaced-key-definition |
| 739 | edt-key-definition-string edt-function))))))) | 1213 | (lookup-key (current-global-map) edt-key-definition)) |
| 1214 | (define-key (current-global-map) | ||
| 1215 | edt-key-definition edt-function))))))) | ||
| 740 | 1216 | ||
| 741 | ;;; | 1217 | ;;; |
| 742 | ;;; FORM FEED INSERT | 1218 | ;;; FORM FEED INSERT |
| @@ -744,7 +1220,7 @@ Use edt-restore-key to restore last replaced key definition." | |||
| 744 | 1220 | ||
| 745 | (defun edt-form-feed-insert (num) | 1221 | (defun edt-form-feed-insert (num) |
| 746 | "Insert form feed character at cursor position. | 1222 | "Insert form feed character at cursor position. |
| 747 | Accepts a positive prefix argument for the number of form feeds to insert." | 1223 | Argument NUM is the number of form feeds to insert." |
| 748 | (interactive "*p") | 1224 | (interactive "*p") |
| 749 | (edt-check-prefix num) | 1225 | (edt-check-prefix num) |
| 750 | (while (> num 0) | 1226 | (while (> num 0) |
| @@ -757,7 +1233,7 @@ Accepts a positive prefix argument for the number of form feeds to insert." | |||
| 757 | 1233 | ||
| 758 | (defun edt-tab-insert (num) | 1234 | (defun edt-tab-insert (num) |
| 759 | "Insert tab character at cursor position. | 1235 | "Insert tab character at cursor position. |
| 760 | Accepts a positive prefix argument for the number of tabs to insert." | 1236 | Argument NUM is the the number of tabs to insert." |
| 761 | (interactive "*p") | 1237 | (interactive "*p") |
| 762 | (edt-check-prefix num) | 1238 | (edt-check-prefix num) |
| 763 | (while (> num 0) | 1239 | (while (> num 0) |
| @@ -769,7 +1245,8 @@ Accepts a positive prefix argument for the number of tabs to insert." | |||
| 769 | ;;; | 1245 | ;;; |
| 770 | 1246 | ||
| 771 | (defun edt-check-prefix (num) | 1247 | (defun edt-check-prefix (num) |
| 772 | "Indicate error if prefix is not positive." | 1248 | "Indicate error if prefix is not positive. |
| 1249 | Argument NUM is the prefix value tested." | ||
| 773 | (if (<= num 0) | 1250 | (if (<= num 0) |
| 774 | (error "Prefix must be positive"))) | 1251 | (error "Prefix must be positive"))) |
| 775 | 1252 | ||
| @@ -781,6 +1258,64 @@ Accepts a positive prefix argument for the number of tabs to insert." | |||
| 781 | "Indicate error if EDT selection is not active." | 1258 | "Indicate error if EDT selection is not active." |
| 782 | (if (not edt-select-mode) | 1259 | (if (not edt-select-mode) |
| 783 | (error "Selection NOT active"))) | 1260 | (error "Selection NOT active"))) |
| 1261 | |||
| 1262 | ;;; | ||
| 1263 | ;;; Scroll Margins | ||
| 1264 | ;;; | ||
| 1265 | |||
| 1266 | (defun edt-top-check (beg lines) | ||
| 1267 | "Enforce scroll margin at the top of screen. | ||
| 1268 | Argument BEG is the starting line number before cursor was moved. | ||
| 1269 | Argument LINES is the number of lines the cursor moved toward the top." | ||
| 1270 | (let ((margin (/ (* (window-height) edt-top-scroll-margin) 100))) | ||
| 1271 | (cond ((< beg margin) (recenter beg)) | ||
| 1272 | ((< (- beg lines) margin) (recenter margin))))) | ||
| 1273 | |||
| 1274 | (defun edt-bottom-check (beg lines) | ||
| 1275 | "Enforce scroll margin at the bottom of screen. | ||
| 1276 | Argument BEG is the starting line number before cursor was moved. | ||
| 1277 | Argument LINES is the number of lines the cursor moved toward the bottom." | ||
| 1278 | (let* ((height (window-height)) | ||
| 1279 | (margin (+ 1 (/ (* height edt-bottom-scroll-margin) 100))) | ||
| 1280 | ;; subtract 1 from height because it includes mode line | ||
| 1281 | (difference (- height margin 1))) | ||
| 1282 | (cond ((> beg difference) (recenter beg)) | ||
| 1283 | ((and edt-x-emacs19-p (> (+ beg lines 1) difference)) | ||
| 1284 | (recenter (- margin))) | ||
| 1285 | ((> (+ beg lines) difference) (recenter (- margin)))))) | ||
| 1286 | |||
| 1287 | (defun edt-current-line nil | ||
| 1288 | "Return the vertical position of point in the selected window. | ||
| 1289 | Top line is 0. Counts each text line only once, even if it wraps." | ||
| 1290 | (+ (count-lines (window-start) (point)) (if (= (current-column) 0) 1 0) -1)) | ||
| 1291 | |||
| 1292 | ;;;###autoload | ||
| 1293 | (defun edt-set-scroll-margins (top bottom) | ||
| 1294 | "Set scroll margins. | ||
| 1295 | Argument TOP is the top margin in number of lines or percent of window. | ||
| 1296 | Argument BOTTOM is the bottom margin in number of lines or percent of window." | ||
| 1297 | (interactive | ||
| 1298 | "sEnter top scroll margin (N lines or N%% or RETURN for current value): \ | ||
| 1299 | \nsEnter bottom scroll margin (N lines or N%% or RETURN for current value): ") | ||
| 1300 | ;; set top scroll margin | ||
| 1301 | (or (string= top "") | ||
| 1302 | (if (string= "%" (substring top -1)) | ||
| 1303 | (setq edt-top-scroll-margin (string-to-int top)) | ||
| 1304 | (setq edt-top-scroll-margin | ||
| 1305 | (/ (1- (+ (* (string-to-int top) 100) (window-height))) | ||
| 1306 | (window-height))))) | ||
| 1307 | ;; set bottom scroll margin | ||
| 1308 | (or (string= bottom "") | ||
| 1309 | (if (string= "%" (substring bottom -1)) | ||
| 1310 | (setq edt-bottom-scroll-margin (string-to-int bottom)) | ||
| 1311 | (setq edt-bottom-scroll-margin | ||
| 1312 | (/ (1- (+ (* (string-to-int bottom) 100) (window-height))) | ||
| 1313 | (window-height))))) | ||
| 1314 | ;; report scroll margin settings if running interactively | ||
| 1315 | (and (interactive-p) | ||
| 1316 | (message "Scroll margins set. Top = %s%%, Bottom = %s%%" | ||
| 1317 | edt-top-scroll-margin edt-bottom-scroll-margin))) | ||
| 1318 | |||
| 784 | 1319 | ||
| 785 | ;;;; | 1320 | ;;;; |
| 786 | ;;;; ENHANCEMENTS AND ADDITIONS FOR EDT KEYPAD MODE | 1321 | ;;;; ENHANCEMENTS AND ADDITIONS FOR EDT KEYPAD MODE |
| @@ -798,9 +1333,9 @@ Accepts a positive prefix argument for the number of tabs to insert." | |||
| 798 | (defun edt-change-direction () | 1333 | (defun edt-change-direction () |
| 799 | "Toggle movement direction." | 1334 | "Toggle movement direction." |
| 800 | (interactive) | 1335 | (interactive) |
| 801 | (if (equal edt-direction-string edt-forward-string) | 1336 | (if (equal edt-direction-string edt-forward-string) |
| 802 | (edt-backup) | 1337 | (edt-backup) |
| 803 | (edt-advance))) | 1338 | (edt-advance))) |
| 804 | 1339 | ||
| 805 | ;;; | 1340 | ;;; |
| 806 | ;;; TOGGLE SELECT | 1341 | ;;; TOGGLE SELECT |
| @@ -819,33 +1354,71 @@ Accepts a positive prefix argument for the number of tabs to insert." | |||
| 819 | 1354 | ||
| 820 | (defun edt-sentence-forward (num) | 1355 | (defun edt-sentence-forward (num) |
| 821 | "Move forward to start of next sentence. | 1356 | "Move forward to start of next sentence. |
| 822 | Accepts a positive prefix argument for the number of sentences to move." | 1357 | Argument NUM is the positive number of sentences to move." |
| 823 | (interactive "p") | 1358 | (interactive "p") |
| 824 | (edt-check-prefix num) | 1359 | (edt-check-prefix num) |
| 825 | (if (eobp) | 1360 | (let* ((left nil) |
| 826 | (progn | 1361 | (beg (edt-current-line)) |
| 827 | (error "End of buffer")) | 1362 | (height (window-height)) |
| 1363 | (top-percent | ||
| 1364 | (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin)) | ||
| 1365 | (bottom-percent | ||
| 1366 | (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin)) | ||
| 1367 | (top-margin (/ (* height top-percent) 100)) | ||
| 1368 | (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100))) | ||
| 1369 | (bottom-margin (max beg (- height bottom-up-margin 1))) | ||
| 1370 | (top (save-excursion (move-to-window-line top-margin) (point))) | ||
| 1371 | (bottom (save-excursion (move-to-window-line bottom-margin) (point))) | ||
| 1372 | (far (save-excursion | ||
| 1373 | (goto-char bottom) (forward-line (- height 2)) (point)))) | ||
| 1374 | (if (eobp) | ||
| 1375 | (progn | ||
| 1376 | (error "End of buffer")) | ||
| 828 | (progn | 1377 | (progn |
| 829 | (forward-sentence num) | 1378 | (forward-sentence num) |
| 830 | (edt-one-word-forward)))) | 1379 | (forward-word 1) |
| 1380 | (backward-sentence))) | ||
| 1381 | (cond((> (point) far) | ||
| 1382 | (setq left (save-excursion (forward-line height))) | ||
| 1383 | (if (= 0 left) (recenter top-margin) | ||
| 1384 | (recenter (- left bottom-up-margin)))) | ||
| 1385 | (t | ||
| 1386 | (and (> (point) bottom) (recenter bottom-margin))))) | ||
| 1387 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 831 | 1388 | ||
| 832 | (defun edt-sentence-backward (num) | 1389 | (defun edt-sentence-backward (num) |
| 833 | "Move backward to next sentence beginning. | 1390 | "Move backward to next sentence beginning. |
| 834 | Accepts a positive prefix argument for the number of sentences to move." | 1391 | Argument NUM is the positive number of sentences to move." |
| 835 | (interactive "p") | 1392 | (interactive "p") |
| 836 | (edt-check-prefix num) | 1393 | (edt-check-prefix num) |
| 837 | (if (eobp) | 1394 | (let* ((left nil) |
| 838 | (progn | 1395 | (beg (edt-current-line)) |
| 839 | (error "End of buffer")) | 1396 | (height (window-height)) |
| 840 | (backward-sentence num))) | 1397 | (top-percent |
| 1398 | (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin)) | ||
| 1399 | (bottom-percent | ||
| 1400 | (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin)) | ||
| 1401 | (top-margin (/ (* height top-percent) 100)) | ||
| 1402 | (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100))) | ||
| 1403 | (bottom-margin (max beg (- height bottom-up-margin 1))) | ||
| 1404 | (top (save-excursion (move-to-window-line top-margin) (point))) | ||
| 1405 | (bottom (save-excursion (move-to-window-line bottom-margin) (point))) | ||
| 1406 | (far (save-excursion | ||
| 1407 | (goto-char bottom) (forward-line (- height 2)) (point)))) | ||
| 1408 | (if (eobp) | ||
| 1409 | (progn | ||
| 1410 | (error "End of buffer")) | ||
| 1411 | (backward-sentence num)) | ||
| 1412 | (and (< (point) top) (recenter (min beg top-margin)))) | ||
| 1413 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 841 | 1414 | ||
| 842 | (defun edt-sentence (num) | 1415 | (defun edt-sentence (num) |
| 843 | "Move in current direction to next sentence. | 1416 | "Move in current direction to next sentence. |
| 844 | Accepts a positive prefix argument for the number of sentences to move." | 1417 | Argument NUM is the positive number of sentences to move." |
| 845 | (interactive "p") | 1418 | (interactive "p") |
| 846 | (if (equal edt-direction-string edt-forward-string) | 1419 | (if (equal edt-direction-string edt-forward-string) |
| 847 | (edt-sentence-forward num) | 1420 | (edt-sentence-forward num) |
| 848 | (edt-sentence-backward num))) | 1421 | (edt-sentence-backward num))) |
| 849 | 1422 | ||
| 850 | ;;; | 1423 | ;;; |
| 851 | ;;; PARAGRAPH | 1424 | ;;; PARAGRAPH |
| @@ -853,35 +1426,69 @@ Accepts a positive prefix argument for the number of sentences to move." | |||
| 853 | 1426 | ||
| 854 | (defun edt-paragraph-forward (num) | 1427 | (defun edt-paragraph-forward (num) |
| 855 | "Move forward to beginning of paragraph. | 1428 | "Move forward to beginning of paragraph. |
| 856 | Accepts a positive prefix argument for the number of paragraphs to move." | 1429 | Argument NUM is the positive number of paragraphs to move." |
| 857 | (interactive "p") | 1430 | (interactive "p") |
| 858 | (edt-check-prefix num) | 1431 | (edt-check-prefix num) |
| 859 | (while (> num 0) | 1432 | (let* ((left nil) |
| 860 | (next-line 1) | 1433 | (beg (edt-current-line)) |
| 861 | (forward-paragraph) | 1434 | (height (window-height)) |
| 862 | (previous-line 1) | 1435 | (top-percent |
| 863 | (if (eolp) | 1436 | (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin)) |
| 864 | (next-line 1)) | 1437 | (bottom-percent |
| 865 | (setq num (1- num)))) | 1438 | (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin)) |
| 1439 | (top-margin (/ (* height top-percent) 100)) | ||
| 1440 | (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100))) | ||
| 1441 | (bottom-margin (max beg (- height bottom-up-margin 1))) | ||
| 1442 | (top (save-excursion (move-to-window-line top-margin) (point))) | ||
| 1443 | (bottom (save-excursion (move-to-window-line bottom-margin) (point))) | ||
| 1444 | (far (save-excursion | ||
| 1445 | (goto-char bottom) (forward-line (- height 2)) (point)))) | ||
| 1446 | (while (> num 0) | ||
| 1447 | (forward-paragraph (+ num 1)) | ||
| 1448 | (start-of-paragraph-text) | ||
| 1449 | (if (eolp) | ||
| 1450 | (next-line 1)) | ||
| 1451 | (setq num (1- num))) | ||
| 1452 | (cond((> (point) far) | ||
| 1453 | (setq left (save-excursion (forward-line height))) | ||
| 1454 | (if (= 0 left) (recenter top-margin) | ||
| 1455 | (recenter (- left bottom-up-margin)))) | ||
| 1456 | (t | ||
| 1457 | (and (> (point) bottom) (recenter bottom-margin))))) | ||
| 1458 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 866 | 1459 | ||
| 867 | (defun edt-paragraph-backward (num) | 1460 | (defun edt-paragraph-backward (num) |
| 868 | "Move backward to beginning of paragraph. | 1461 | "Move backward to beginning of paragraph. |
| 869 | Accepts a positive prefix argument for the number of paragraphs to move." | 1462 | Argument NUM is the positive number of paragraphs to move." |
| 870 | (interactive "p") | 1463 | (interactive "p") |
| 871 | (edt-check-prefix num) | 1464 | (edt-check-prefix num) |
| 872 | (while (> num 0) | 1465 | (let* ((left nil) |
| 873 | (backward-paragraph) | 1466 | (beg (edt-current-line)) |
| 874 | (previous-line 1) | 1467 | (height (window-height)) |
| 875 | (if (eolp) (next-line 1)) | 1468 | (top-percent |
| 876 | (setq num (1- num)))) | 1469 | (if (= 0 edt-top-scroll-margin) 10 edt-top-scroll-margin)) |
| 1470 | (bottom-percent | ||
| 1471 | (if (= 0 edt-bottom-scroll-margin) 15 edt-bottom-scroll-margin)) | ||
| 1472 | (top-margin (/ (* height top-percent) 100)) | ||
| 1473 | (bottom-up-margin (+ 1 (/ (* height bottom-percent) 100))) | ||
| 1474 | (bottom-margin (max beg (- height bottom-up-margin 1))) | ||
| 1475 | (top (save-excursion (move-to-window-line top-margin) (point))) | ||
| 1476 | (bottom (save-excursion (move-to-window-line bottom-margin) (point))) | ||
| 1477 | (far (save-excursion | ||
| 1478 | (goto-char bottom) (forward-line (- height 2)) (point)))) | ||
| 1479 | (while (> num 0) | ||
| 1480 | (start-of-paragraph-text) | ||
| 1481 | (setq num (1- num))) | ||
| 1482 | (and (< (point) top) (recenter (min beg top-margin)))) | ||
| 1483 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 877 | 1484 | ||
| 878 | (defun edt-paragraph (num) | 1485 | (defun edt-paragraph (num) |
| 879 | "Move in current direction to next paragraph. | 1486 | "Move in current direction to next paragraph. |
| 880 | Accepts a positive prefix argument for the number of paragraph to move." | 1487 | Argument NUM is the positive number of paragraphs to move." |
| 881 | (interactive "p") | 1488 | (interactive "p") |
| 882 | (if (equal edt-direction-string edt-forward-string) | 1489 | (if (equal edt-direction-string edt-forward-string) |
| 883 | (edt-paragraph-forward num) | 1490 | (edt-paragraph-forward num) |
| 884 | (edt-paragraph-backward num))) | 1491 | (edt-paragraph-backward num))) |
| 885 | 1492 | ||
| 886 | ;;; | 1493 | ;;; |
| 887 | ;;; RESTORE KEY | 1494 | ;;; RESTORE KEY |
| @@ -889,18 +1496,27 @@ Accepts a positive prefix argument for the number of paragraph to move." | |||
| 889 | 1496 | ||
| 890 | (defun edt-restore-key () | 1497 | (defun edt-restore-key () |
| 891 | "Restore last replaced key definition. | 1498 | "Restore last replaced key definition. |
| 892 | Definition is stored in edt-last-replaced-key-definition." | 1499 | Definition is stored in `edt-last-replaced-key-definition'." |
| 893 | (interactive) | 1500 | (interactive) |
| 1501 | (if edt-x-emacs19-p (setq zmacs-region-stays t)) | ||
| 894 | (if edt-last-replaced-key-definition | 1502 | (if edt-last-replaced-key-definition |
| 895 | (progn | 1503 | (progn |
| 896 | (let (edt-key-definition-string) | 1504 | (let (edt-key-definition) |
| 897 | (set 'edt-key-definition-string | 1505 | (set 'edt-key-definition |
| 898 | (read-key-sequence "Press the key to be restored: ")) | 1506 | (read-key-sequence "Press the key to be restored: ")) |
| 899 | (if (string-equal "\C-m" edt-key-definition-string) | 1507 | (if (if edt-gnu-emacs19-p |
| 900 | (message "Key not restored") | 1508 | (string-equal "\C-m" edt-key-definition) |
| 901 | (define-key (current-global-map) | 1509 | (string-equal "\C-m" (events-to-keys edt-key-definition))) |
| 902 | edt-key-definition-string edt-last-replaced-key-definition)))) | 1510 | (message "Key not restored") |
| 903 | (error "No replaced key definition to restore!"))) | 1511 | (progn |
| 1512 | (define-key (current-global-map) | ||
| 1513 | edt-key-definition edt-last-replaced-key-definition) | ||
| 1514 | (if edt-gnu-emacs19-p | ||
| 1515 | (message "Key definition for %s has been restored." | ||
| 1516 | edt-key-definition) | ||
| 1517 | (message "Key definition for %s has been restored." | ||
| 1518 | (events-to-keys edt-key-definition))))))) | ||
| 1519 | (error "No replaced key definition to restore!"))) | ||
| 904 | 1520 | ||
| 905 | ;;; | 1521 | ;;; |
| 906 | ;;; WINDOW TOP | 1522 | ;;; WINDOW TOP |
| @@ -911,7 +1527,8 @@ Definition is stored in edt-last-replaced-key-definition." | |||
| 911 | (interactive) | 1527 | (interactive) |
| 912 | (let ((start-column (current-column))) | 1528 | (let ((start-column (current-column))) |
| 913 | (move-to-window-line 0) | 1529 | (move-to-window-line 0) |
| 914 | (move-to-column start-column))) | 1530 | (move-to-column start-column)) |
| 1531 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 915 | 1532 | ||
| 916 | ;;; | 1533 | ;;; |
| 917 | ;;; WINDOW BOTTOM | 1534 | ;;; WINDOW BOTTOM |
| @@ -922,7 +1539,8 @@ Definition is stored in edt-last-replaced-key-definition." | |||
| 922 | (interactive) | 1539 | (interactive) |
| 923 | (let ((start-column (current-column))) | 1540 | (let ((start-column (current-column))) |
| 924 | (move-to-window-line (- (window-height) 2)) | 1541 | (move-to-window-line (- (window-height) 2)) |
| 925 | (move-to-column start-column))) | 1542 | (move-to-column start-column)) |
| 1543 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 926 | 1544 | ||
| 927 | ;;; | 1545 | ;;; |
| 928 | ;;; SCROLL WINDOW LINE | 1546 | ;;; SCROLL WINDOW LINE |
| @@ -931,29 +1549,31 @@ Definition is stored in edt-last-replaced-key-definition." | |||
| 931 | (defun edt-scroll-window-forward-line () | 1549 | (defun edt-scroll-window-forward-line () |
| 932 | "Move window forward one line leaving cursor at position in window." | 1550 | "Move window forward one line leaving cursor at position in window." |
| 933 | (interactive) | 1551 | (interactive) |
| 934 | (scroll-up 1)) | 1552 | (scroll-up 1) |
| 1553 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 935 | 1554 | ||
| 936 | (defun edt-scroll-window-backward-line () | 1555 | (defun edt-scroll-window-backward-line () |
| 937 | "Move window backward one line leaving cursor at position in window." | 1556 | "Move window backward one line leaving cursor at position in window." |
| 938 | (interactive) | 1557 | (interactive) |
| 939 | (scroll-down 1)) | 1558 | (scroll-down 1) |
| 1559 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 940 | 1560 | ||
| 941 | (defun edt-scroll-line () | 1561 | (defun edt-scroll-line () |
| 942 | "Move window one line in current direction." | 1562 | "Move window one line in current direction." |
| 943 | (interactive) | 1563 | (interactive) |
| 944 | (if (equal edt-direction-string edt-forward-string) | 1564 | (if (equal edt-direction-string edt-forward-string) |
| 945 | (edt-scroll-window-forward-line) | 1565 | (edt-scroll-window-forward-line) |
| 946 | (edt-scroll-window-backward-line))) | 1566 | (edt-scroll-window-backward-line))) |
| 947 | 1567 | ||
| 948 | ;;; | 1568 | ;;; |
| 949 | ;;; SCROLL WINDOW | 1569 | ;;; SCROLL WINDOW |
| 950 | ;;; | 1570 | ;;; |
| 951 | ;;; Scroll a window (less one line) at a time. Leave cursor in center of | 1571 | ;;; Scroll a window (less one line) at a time. Leave cursor in center of |
| 952 | ;;; window. | 1572 | ;;; window. |
| 953 | 1573 | ||
| 954 | (defun edt-scroll-window-forward (num) | 1574 | (defun edt-scroll-window-forward (num) |
| 955 | "Scroll forward one window in buffer, less one line. | 1575 | "Scroll forward one window in buffer, less one line. |
| 956 | Accepts a positive prefix argument for the number of windows to move." | 1576 | Argument NUM is the positive number of windows to move." |
| 957 | (interactive "p") | 1577 | (interactive "p") |
| 958 | (edt-check-prefix num) | 1578 | (edt-check-prefix num) |
| 959 | (scroll-up (- (* (window-height) num) 2)) | 1579 | (scroll-up (- (* (window-height) num) 2)) |
| @@ -961,7 +1581,7 @@ Accepts a positive prefix argument for the number of windows to move." | |||
| 961 | 1581 | ||
| 962 | (defun edt-scroll-window-backward (num) | 1582 | (defun edt-scroll-window-backward (num) |
| 963 | "Scroll backward one window in buffer, less one line. | 1583 | "Scroll backward one window in buffer, less one line. |
| 964 | Accepts a positive prefix argument for the number of windows to move." | 1584 | Argument NUM is the positive number of windows to move." |
| 965 | (interactive "p") | 1585 | (interactive "p") |
| 966 | (edt-check-prefix num) | 1586 | (edt-check-prefix num) |
| 967 | (scroll-down (- (* (window-height) num) 2)) | 1587 | (scroll-down (- (* (window-height) num) 2)) |
| @@ -969,11 +1589,11 @@ Accepts a positive prefix argument for the number of windows to move." | |||
| 969 | 1589 | ||
| 970 | (defun edt-scroll-window (num) | 1590 | (defun edt-scroll-window (num) |
| 971 | "Scroll one window in buffer, less one line, in current direction. | 1591 | "Scroll one window in buffer, less one line, in current direction. |
| 972 | Accepts a positive prefix argument for the number windows to move." | 1592 | Argument NUM is the positive number of windows to move." |
| 973 | (interactive "p") | 1593 | (interactive "p") |
| 974 | (if (equal edt-direction-string edt-forward-string) | 1594 | (if (equal edt-direction-string edt-forward-string) |
| 975 | (edt-scroll-window-forward num) | 1595 | (edt-scroll-window-forward num) |
| 976 | (edt-scroll-window-backward num))) | 1596 | (edt-scroll-window-backward num))) |
| 977 | 1597 | ||
| 978 | ;;; | 1598 | ;;; |
| 979 | ;;; LINE TO BOTTOM OF WINDOW | 1599 | ;;; LINE TO BOTTOM OF WINDOW |
| @@ -982,7 +1602,8 @@ Accepts a positive prefix argument for the number windows to move." | |||
| 982 | (defun edt-line-to-bottom-of-window () | 1602 | (defun edt-line-to-bottom-of-window () |
| 983 | "Move the current line to the bottom of the window." | 1603 | "Move the current line to the bottom of the window." |
| 984 | (interactive) | 1604 | (interactive) |
| 985 | (recenter -1)) | 1605 | (recenter -1) |
| 1606 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 986 | 1607 | ||
| 987 | ;;; | 1608 | ;;; |
| 988 | ;;; LINE TO TOP OF WINDOW | 1609 | ;;; LINE TO TOP OF WINDOW |
| @@ -991,7 +1612,8 @@ Accepts a positive prefix argument for the number windows to move." | |||
| 991 | (defun edt-line-to-top-of-window () | 1612 | (defun edt-line-to-top-of-window () |
| 992 | "Move the current line to the top of the window." | 1613 | "Move the current line to the top of the window." |
| 993 | (interactive) | 1614 | (interactive) |
| 994 | (recenter 0)) | 1615 | (recenter 0) |
| 1616 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 995 | 1617 | ||
| 996 | ;;; | 1618 | ;;; |
| 997 | ;;; LINE TO MIDDLE OF WINDOW | 1619 | ;;; LINE TO MIDDLE OF WINDOW |
| @@ -1000,18 +1622,21 @@ Accepts a positive prefix argument for the number windows to move." | |||
| 1000 | (defun edt-line-to-middle-of-window () | 1622 | (defun edt-line-to-middle-of-window () |
| 1001 | "Move window so line with cursor is in the middle of the window." | 1623 | "Move window so line with cursor is in the middle of the window." |
| 1002 | (interactive) | 1624 | (interactive) |
| 1003 | (recenter '(4))) | 1625 | (recenter '(4)) |
| 1626 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 1004 | 1627 | ||
| 1005 | ;;; | 1628 | ;;; |
| 1006 | ;;; GOTO PERCENTAGE | 1629 | ;;; GOTO PERCENTAGE |
| 1007 | ;;; | 1630 | ;;; |
| 1008 | 1631 | ||
| 1009 | (defun edt-goto-percentage (num) | 1632 | (defun edt-goto-percentage (num) |
| 1010 | "Move to specified percentage in buffer from top of buffer." | 1633 | "Move to specified percentage in buffer from top of buffer. |
| 1634 | Argument NUM is the percentage into the buffer to move." | ||
| 1011 | (interactive "NGoto-percentage: ") | 1635 | (interactive "NGoto-percentage: ") |
| 1012 | (if (or (> num 100) (< num 0)) | 1636 | (if (or (> num 100) (< num 0)) |
| 1013 | (error "Percentage %d out of range 0 < percent < 100" num) | 1637 | (error "Percentage %d out of range 0 < percent < 100" num) |
| 1014 | (goto-char (/ (* (point-max) num) 100)))) | 1638 | (goto-char (/ (* (point-max) num) 100))) |
| 1639 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 1015 | 1640 | ||
| 1016 | ;;; | 1641 | ;;; |
| 1017 | ;;; FILL REGION | 1642 | ;;; FILL REGION |
| @@ -1019,7 +1644,7 @@ Accepts a positive prefix argument for the number windows to move." | |||
| 1019 | 1644 | ||
| 1020 | (defun edt-fill-region () | 1645 | (defun edt-fill-region () |
| 1021 | "Fill selected text." | 1646 | "Fill selected text." |
| 1022 | (interactive "*") | 1647 | (interactive "*") |
| 1023 | (edt-check-selection) | 1648 | (edt-check-selection) |
| 1024 | (fill-region (point) (mark))) | 1649 | (fill-region (point) (mark))) |
| 1025 | 1650 | ||
| @@ -1029,38 +1654,38 @@ Accepts a positive prefix argument for the number windows to move." | |||
| 1029 | 1654 | ||
| 1030 | (defun edt-indent-or-fill-region () | 1655 | (defun edt-indent-or-fill-region () |
| 1031 | "Fill region in text modes, indent region in programming language modes." | 1656 | "Fill region in text modes, indent region in programming language modes." |
| 1032 | (interactive "*") | 1657 | (interactive "*") |
| 1033 | (if (string= paragraph-start "$\\|\f") | 1658 | (if (string= paragraph-start "$\\|\f") |
| 1034 | (indent-region (point) (mark) nil) | 1659 | (indent-region (point) (mark) nil) |
| 1035 | (fill-region (point) (mark)))) | 1660 | (fill-region (point) (mark)))) |
| 1036 | 1661 | ||
| 1037 | ;;; | 1662 | ;;; |
| 1038 | ;;; MARK SECTION WISELY | 1663 | ;;; MARK SECTION WISELY |
| 1039 | ;;; | 1664 | ;;; |
| 1040 | 1665 | ||
| 1041 | (defun edt-mark-section-wisely () | 1666 | (defun edt-mark-section-wisely () |
| 1042 | "Mark the section in a manner consistent with the major-mode. | 1667 | "Mark the section in a manner consistent with the `major-mode'. |
| 1043 | Uses mark-defun for emacs-lisp and lisp, | 1668 | Uses `mark-defun' for emacs-lisp and Lisp, |
| 1044 | mark-c-function for C, | 1669 | mark-c-function for C, |
| 1045 | mark-fortran-subsystem for fortran, | 1670 | mark-fortran-subsystem for fortran, |
| 1046 | and mark-paragraph for other modes." | 1671 | and `mark-paragraph' for other modes." |
| 1047 | (interactive) | 1672 | (interactive) |
| 1048 | (if edt-select-mode | 1673 | (if edt-select-mode |
| 1049 | (progn | 1674 | (progn |
| 1050 | (edt-reset)) | 1675 | (edt-reset)) |
| 1051 | (progn | 1676 | (progn |
| 1052 | (cond ((or (eq major-mode 'emacs-lisp-mode) | 1677 | (cond ((or (eq major-mode 'emacs-lisp-mode) |
| 1053 | (eq major-mode 'lisp-mode)) | 1678 | (eq major-mode 'lisp-mode)) |
| 1054 | (mark-defun) | 1679 | (mark-defun) |
| 1055 | (message "Lisp defun selected")) | 1680 | (message "Lisp defun selected")) |
| 1056 | ((eq major-mode 'c-mode) | 1681 | ((eq major-mode 'c-mode) |
| 1057 | (mark-c-function) | 1682 | (mark-c-function) |
| 1058 | (message "C function selected")) | 1683 | (message "C function selected")) |
| 1059 | ((eq major-mode 'fortran-mode) | 1684 | ((eq major-mode 'fortran-mode) |
| 1060 | (mark-fortran-subprogram) | 1685 | (mark-fortran-subprogram) |
| 1061 | (message "Fortran subprogram selected")) | 1686 | (message "Fortran subprogram selected")) |
| 1062 | (t (mark-paragraph) | 1687 | (t (mark-paragraph) |
| 1063 | (message "Paragraph selected")))))) | 1688 | (message "Paragraph selected")))))) |
| 1064 | 1689 | ||
| 1065 | ;;; | 1690 | ;;; |
| 1066 | ;;; COPY | 1691 | ;;; COPY |
| @@ -1080,12 +1705,12 @@ and mark-paragraph for other modes." | |||
| 1080 | 1705 | ||
| 1081 | (defun edt-cut-or-copy () | 1706 | (defun edt-cut-or-copy () |
| 1082 | "Cuts (or copies) selected text to kill ring. | 1707 | "Cuts (or copies) selected text to kill ring. |
| 1083 | Cuts selected text if buffer-read-only is nil. | 1708 | Cuts selected text if `buffer-read-only' is nil. |
| 1084 | Copies selected text if buffer-read-only is t." | 1709 | Copies selected text if `buffer-read-only' is t." |
| 1085 | (interactive) | 1710 | (interactive) |
| 1086 | (if buffer-read-only | 1711 | (if buffer-read-only |
| 1087 | (edt-copy) | 1712 | (edt-copy) |
| 1088 | (edt-cut))) | 1713 | (edt-cut))) |
| 1089 | 1714 | ||
| 1090 | ;;; | 1715 | ;;; |
| 1091 | ;;; DELETE ENTIRE LINE | 1716 | ;;; DELETE ENTIRE LINE |
| @@ -1102,8 +1727,8 @@ Copies selected text if buffer-read-only is t." | |||
| 1102 | ;;; | 1727 | ;;; |
| 1103 | 1728 | ||
| 1104 | (defun edt-duplicate-line (num) | 1729 | (defun edt-duplicate-line (num) |
| 1105 | "Duplicate a line of text. | 1730 | "Duplicate the line of text containing the cursor. |
| 1106 | Accepts a positive prefix argument for the number times to duplicate the line." | 1731 | Argument NUM is the number of times to duplicate the line." |
| 1107 | (interactive "*p") | 1732 | (interactive "*p") |
| 1108 | (edt-check-prefix num) | 1733 | (edt-check-prefix num) |
| 1109 | (let ((old-column (current-column)) | 1734 | (let ((old-column (current-column)) |
| @@ -1139,11 +1764,11 @@ Accepts a positive prefix argument for the number times to duplicate the line." | |||
| 1139 | (forward-line) | 1764 | (forward-line) |
| 1140 | (move-to-column start-column) | 1765 | (move-to-column start-column) |
| 1141 | (insert edt-last-copied-word)) | 1766 | (insert edt-last-copied-word)) |
| 1142 | (progn | 1767 | (progn |
| 1143 | (if (not (equal start (point))) | 1768 | (if (not (equal start (point))) |
| 1144 | (forward-line)) | 1769 | (forward-line)) |
| 1145 | (move-to-column start-column) | 1770 | (move-to-column start-column) |
| 1146 | (error "Nothing to duplicate!"))))) | 1771 | (error "Nothing to duplicate!"))))) |
| 1147 | 1772 | ||
| 1148 | ;;; | 1773 | ;;; |
| 1149 | ;;; KEY NOT ASSIGNED | 1774 | ;;; KEY NOT ASSIGNED |
| @@ -1184,6 +1809,7 @@ Accepts a positive prefix argument for the number times to duplicate the line." | |||
| 1184 | (defun edt-display-the-time () | 1809 | (defun edt-display-the-time () |
| 1185 | "Display the current time." | 1810 | "Display the current time." |
| 1186 | (interactive) | 1811 | (interactive) |
| 1812 | (if edt-x-emacs19-p (setq zmacs-region-stays t)) | ||
| 1187 | (set 'time-string (current-time-string)) | 1813 | (set 'time-string (current-time-string)) |
| 1188 | (message "%s" time-string)) | 1814 | (message "%s" time-string)) |
| 1189 | 1815 | ||
| @@ -1196,33 +1822,35 @@ Accepts a positive prefix argument for the number times to duplicate the line." | |||
| 1196 | (interactive) | 1822 | (interactive) |
| 1197 | (if (eq defining-kbd-macro t) | 1823 | (if (eq defining-kbd-macro t) |
| 1198 | (edt-remember) | 1824 | (edt-remember) |
| 1199 | (start-kbd-macro nil))) | 1825 | (start-kbd-macro nil))) |
| 1200 | 1826 | ||
| 1201 | ;;; | 1827 | ;;; |
| 1202 | ;;; REMEMBER | 1828 | ;;; REMEMBER |
| 1203 | ;;; | 1829 | ;;; |
| 1204 | 1830 | ||
| 1205 | (defun edt-remember () | 1831 | (defun edt-remember () |
| 1206 | "Store the sequence of key strokes started by edt-learn to a key." | 1832 | "Store the sequence of key strokes started by `edt-learn' to a key." |
| 1207 | (interactive) | 1833 | (interactive) |
| 1208 | (if (eq defining-kbd-macro nil) | 1834 | (if (eq defining-kbd-macro nil) |
| 1209 | (error "Nothing to remember!") | 1835 | (error "Nothing to remember!") |
| 1210 | (progn | 1836 | (progn |
| 1211 | (end-kbd-macro nil) | 1837 | (end-kbd-macro nil) |
| 1212 | (let (edt-key-definition-string) | 1838 | (let (edt-key-definition) |
| 1213 | (set 'edt-key-definition-string | 1839 | (set 'edt-key-definition |
| 1214 | (read-key-sequence "Enter key for binding: ")) | 1840 | (read-key-sequence "Enter key for binding: ")) |
| 1215 | (if (string-equal "\C-m" edt-key-definition-string) | 1841 | (if (if edt-gnu-emacs19-p |
| 1216 | (message "Key sequence not remembered") | 1842 | (string-equal "\C-m" edt-key-definition) |
| 1217 | (progn | 1843 | (string-equal "\C-m" (events-to-keys edt-key-definition))) |
| 1218 | (set 'edt-learn-macro-count (+ edt-learn-macro-count 1)) | 1844 | (message "Key sequence not remembered") |
| 1219 | (setq edt-last-replaced-key-definition | 1845 | (progn |
| 1220 | (lookup-key (current-global-map) | 1846 | (set 'edt-learn-macro-count (+ edt-learn-macro-count 1)) |
| 1221 | edt-key-definition-string)) | 1847 | (setq edt-last-replaced-key-definition |
| 1222 | (define-key (current-global-map) edt-key-definition-string | 1848 | (lookup-key (current-global-map) |
| 1223 | (name-last-kbd-macro | 1849 | edt-key-definition)) |
| 1224 | (intern (concat "last-learned-sequence-" | 1850 | (define-key (current-global-map) edt-key-definition |
| 1225 | (int-to-string edt-learn-macro-count))))))))))) | 1851 | (name-last-kbd-macro |
| 1852 | (intern (concat "last-learned-sequence-" | ||
| 1853 | (int-to-string edt-learn-macro-count))))))))))) | ||
| 1226 | 1854 | ||
| 1227 | ;;; | 1855 | ;;; |
| 1228 | ;;; EXIT | 1856 | ;;; EXIT |
| @@ -1239,9 +1867,20 @@ Accepts a positive prefix argument for the number times to duplicate the line." | |||
| 1239 | ;;; | 1867 | ;;; |
| 1240 | 1868 | ||
| 1241 | (defun edt-quit () | 1869 | (defun edt-quit () |
| 1242 | "Quit Emacs without saving changes." | 1870 | "Quit Emacs without saving buffer modifications. |
| 1871 | Warn user that modifications will be lost." | ||
| 1243 | (interactive) | 1872 | (interactive) |
| 1244 | (kill-emacs)) | 1873 | (let ((list (buffer-list)) |
| 1874 | (working t)) | ||
| 1875 | (while (and list working) | ||
| 1876 | (let ((buffer (car list))) | ||
| 1877 | (if (and (buffer-file-name buffer) (buffer-modified-p buffer)) | ||
| 1878 | (if (edt-y-or-n-p | ||
| 1879 | "Modifications will not be saved, continue quitting? ") | ||
| 1880 | (kill-emacs) | ||
| 1881 | (setq working nil))) | ||
| 1882 | (setq list (cdr list)))) | ||
| 1883 | (if working (kill-emacs)))) | ||
| 1245 | 1884 | ||
| 1246 | ;;; | 1885 | ;;; |
| 1247 | ;;; SPLIT WINDOW | 1886 | ;;; SPLIT WINDOW |
| @@ -1251,7 +1890,8 @@ Accepts a positive prefix argument for the number times to duplicate the line." | |||
| 1251 | "Split current window and place cursor in the new window." | 1890 | "Split current window and place cursor in the new window." |
| 1252 | (interactive) | 1891 | (interactive) |
| 1253 | (split-window) | 1892 | (split-window) |
| 1254 | (other-window 1)) | 1893 | (other-window 1) |
| 1894 | (if edt-x-emacs19-p (setq zmacs-region-stays t))) | ||
| 1255 | 1895 | ||
| 1256 | ;;; | 1896 | ;;; |
| 1257 | ;;; COPY RECTANGLE | 1897 | ;;; COPY RECTANGLE |
| @@ -1283,7 +1923,7 @@ upper left corner." | |||
| 1283 | (defun edt-cut-rectangle-insert-mode () | 1923 | (defun edt-cut-rectangle-insert-mode () |
| 1284 | "Cut a rectangle of text between mark and cursor to register. | 1924 | "Cut a rectangle of text between mark and cursor to register. |
| 1285 | Move cursor back to upper left corner." | 1925 | Move cursor back to upper left corner." |
| 1286 | (interactive "*") | 1926 | (interactive "*") |
| 1287 | (edt-check-selection) | 1927 | (edt-check-selection) |
| 1288 | (setq edt-rect-start-point (region-beginning)) | 1928 | (setq edt-rect-start-point (region-beginning)) |
| 1289 | (picture-clear-rectangle-to-register (region-beginning) (region-end) 3 t) | 1929 | (picture-clear-rectangle-to-register (region-beginning) (region-end) 3 t) |
| @@ -1297,7 +1937,7 @@ If overwrite mode is active, cut text is replaced with whitespace." | |||
| 1297 | (interactive "*") | 1937 | (interactive "*") |
| 1298 | (if overwrite-mode | 1938 | (if overwrite-mode |
| 1299 | (edt-cut-rectangle-overstrike-mode) | 1939 | (edt-cut-rectangle-overstrike-mode) |
| 1300 | (edt-cut-rectangle-insert-mode))) | 1940 | (edt-cut-rectangle-insert-mode))) |
| 1301 | 1941 | ||
| 1302 | ;;; | 1942 | ;;; |
| 1303 | ;;; PASTE RECTANGLE | 1943 | ;;; PASTE RECTANGLE |
| @@ -1305,7 +1945,7 @@ If overwrite mode is active, cut text is replaced with whitespace." | |||
| 1305 | 1945 | ||
| 1306 | (defun edt-paste-rectangle-overstrike-mode () | 1946 | (defun edt-paste-rectangle-overstrike-mode () |
| 1307 | "Paste a rectangular region of text from register, replacing text at cursor." | 1947 | "Paste a rectangular region of text from register, replacing text at cursor." |
| 1308 | (interactive "*") | 1948 | (interactive "*") |
| 1309 | (picture-yank-rectangle-from-register 3)) | 1949 | (picture-yank-rectangle-from-register 3)) |
| 1310 | 1950 | ||
| 1311 | (defun edt-paste-rectangle-insert-mode () | 1951 | (defun edt-paste-rectangle-insert-mode () |
| @@ -1319,7 +1959,7 @@ If overwrite mode is active, existing text is replace with text from register." | |||
| 1319 | (interactive) | 1959 | (interactive) |
| 1320 | (if overwrite-mode | 1960 | (if overwrite-mode |
| 1321 | (edt-paste-rectangle-overstrike-mode) | 1961 | (edt-paste-rectangle-overstrike-mode) |
| 1322 | (edt-paste-rectangle-insert-mode))) | 1962 | (edt-paste-rectangle-insert-mode))) |
| 1323 | 1963 | ||
| 1324 | ;;; | 1964 | ;;; |
| 1325 | ;;; DOWNCASE REGION | 1965 | ;;; DOWNCASE REGION |
| @@ -1338,24 +1978,24 @@ and the cursor is left to rest at the beginning of that word." | |||
| 1338 | (if edt-select-mode | 1978 | (if edt-select-mode |
| 1339 | (progn | 1979 | (progn |
| 1340 | (downcase-region (mark) (point))) | 1980 | (downcase-region (mark) (point))) |
| 1341 | (progn | 1981 | (progn |
| 1342 | ;; Move to beginning of current word. | 1982 | ;; Move to beginning of current word. |
| 1343 | (if (and | 1983 | (if (and |
| 1344 | (not (bobp)) | 1984 | (not (bobp)) |
| 1345 | (not (eobp)) | 1985 | (not (eobp)) |
| 1346 | (not (bolp)) | 1986 | (not (bolp)) |
| 1347 | (not (eolp)) | 1987 | (not (eolp)) |
| 1348 | (not (eq ?\ (char-syntax (preceding-char)))) | 1988 | (not (eq ?\ (char-syntax (preceding-char)))) |
| 1349 | (not (memq (preceding-char) edt-word-entities)) | 1989 | (not (memq (preceding-char) edt-word-entities)) |
| 1350 | (not (memq (following-char) edt-word-entities))) | 1990 | (not (memq (following-char) edt-word-entities))) |
| 1351 | (edt-one-word-backward)) | 1991 | (edt-one-word-backward)) |
| 1352 | (if (equal edt-direction-string edt-backward-string) | 1992 | (if (equal edt-direction-string edt-backward-string) |
| 1353 | (edt-one-word-backward)) | 1993 | (edt-one-word-backward)) |
| 1354 | (let ((beg (point))) | 1994 | (let ((beg (point))) |
| 1355 | (edt-one-word-forward) | 1995 | (edt-one-word-forward) |
| 1356 | (downcase-region beg (point))) | 1996 | (downcase-region beg (point))) |
| 1357 | (if (equal edt-direction-string edt-backward-string) | 1997 | (if (equal edt-direction-string edt-backward-string) |
| 1358 | (edt-one-word-backward))))) | 1998 | (edt-one-word-backward))))) |
| 1359 | 1999 | ||
| 1360 | ;;; | 2000 | ;;; |
| 1361 | ;;; UPCASE REGION | 2001 | ;;; UPCASE REGION |
| @@ -1374,40 +2014,36 @@ and the cursor is left to rest at the beginning of that word." | |||
| 1374 | (if edt-select-mode | 2014 | (if edt-select-mode |
| 1375 | (progn | 2015 | (progn |
| 1376 | (upcase-region (mark) (point))) | 2016 | (upcase-region (mark) (point))) |
| 1377 | (progn | 2017 | (progn |
| 1378 | ;; Move to beginning of current word. | 2018 | ;; Move to beginning of current word. |
| 1379 | (if (and | 2019 | (if (and |
| 1380 | (not (bobp)) | 2020 | (not (bobp)) |
| 1381 | (not (eobp)) | 2021 | (not (eobp)) |
| 1382 | (not (bolp)) | 2022 | (not (bolp)) |
| 1383 | (not (eolp)) | 2023 | (not (eolp)) |
| 1384 | (not (eq ?\ (char-syntax (preceding-char)))) | 2024 | (not (eq ?\ (char-syntax (preceding-char)))) |
| 1385 | (not (memq (preceding-char) edt-word-entities)) | 2025 | (not (memq (preceding-char) edt-word-entities)) |
| 1386 | (not (memq (following-char) edt-word-entities))) | 2026 | (not (memq (following-char) edt-word-entities))) |
| 1387 | (edt-one-word-backward)) | 2027 | (edt-one-word-backward)) |
| 1388 | (if (equal edt-direction-string edt-backward-string) | 2028 | (if (equal edt-direction-string edt-backward-string) |
| 1389 | (edt-one-word-backward)) | 2029 | (edt-one-word-backward)) |
| 1390 | (let ((beg (point))) | 2030 | (let ((beg (point))) |
| 1391 | (edt-one-word-forward) | 2031 | (edt-one-word-forward) |
| 1392 | (upcase-region beg (point))) | 2032 | (upcase-region beg (point))) |
| 1393 | (if (equal edt-direction-string edt-backward-string) | 2033 | (if (equal edt-direction-string edt-backward-string) |
| 1394 | (edt-one-word-backward))))) | 2034 | (edt-one-word-backward))))) |
| 1395 | 2035 | ||
| 1396 | 2036 | ;;; | |
| 1397 | ;;; | 2037 | ;;; Functions used in loading LK-201 key mapping file. |
| 1398 | ;;; INITIALIZATION COMMANDS. | 2038 | ;;; |
| 1399 | ;;; | 2039 | (defvar edt-last-answer nil |
| 1400 | 2040 | "Most recent response to `edt-y-or-n-p'.") | |
| 1401 | ;;; | ||
| 1402 | ;;; Emacs version 19 X-windows key definition support | ||
| 1403 | ;;; | ||
| 1404 | (defvar edt-last-answer nil | ||
| 1405 | "Most recent response to edt-y-or-n-p.") | ||
| 1406 | 2041 | ||
| 1407 | (defun edt-y-or-n-p (prompt &optional not-yes) | 2042 | (defun edt-y-or-n-p (prompt &optional not-yes) |
| 1408 | "Prompt for a y or n answer with positive default. | 2043 | "Prompt for a y or n answer with positive default. |
| 1409 | Optional second argument NOT-YES changes default to negative. | 2044 | Like Emacs `y-or-n-p', also accepts space as y and DEL as n. |
| 1410 | Like emacs y-or-n-p, also accepts space as y and DEL as n." | 2045 | Argument PROMPT is the prompt string. |
| 2046 | Optional argument NOT-YES changes the default to negative." | ||
| 1411 | (message "%s[%s]" prompt (if not-yes "n" "y")) | 2047 | (message "%s[%s]" prompt (if not-yes "n" "y")) |
| 1412 | (let ((doit t)) | 2048 | (let ((doit t)) |
| 1413 | (while doit | 2049 | (while doit |
| @@ -1423,20 +2059,36 @@ Like emacs y-or-n-p, also accepts space as y and DEL as n." | |||
| 1423 | (message "Please answer y or n. %s[%s]" | 2059 | (message "Please answer y or n. %s[%s]" |
| 1424 | prompt (if not-yes "n" "y"))))))) | 2060 | prompt (if not-yes "n" "y"))))))) |
| 1425 | edt-last-answer) | 2061 | edt-last-answer) |
| 2062 | |||
| 2063 | ;;; | ||
| 2064 | ;;; INITIALIZATION COMMANDS. | ||
| 2065 | ;;; | ||
| 1426 | 2066 | ||
| 1427 | (defun edt-load-xkeys (file) | 2067 | ;;; |
| 1428 | "Load the EDT X-windows key definitions FILE. | 2068 | ;;; Function used to load LK-201 key mapping file generated by edt-mapper.el. |
| 1429 | If FILE is nil, try to load a default file. The default file names are | 2069 | ;;; |
| 1430 | ~/.edt-lucid-keys for Lucid emacs, and ~/.edt-gnu-keys for GNU emacs." | 2070 | (defun edt-load-keys (file) |
| 1431 | (interactive "fX key definition file: ") | 2071 | "Load the LK-201 key mapping FILE generated by edt-mapper.el. |
| 2072 | If FILE is nil, which is the normal case, try to load a default file. | ||
| 2073 | The default file names are based upon the window system, terminal | ||
| 2074 | type, and version of Emacs in use: GNU Emacs or XEmacs (aka Lucid | ||
| 2075 | Emacs). If a default file does not exist, ask user if one should be | ||
| 2076 | created." | ||
| 2077 | (interactive "fKey definition file: ") | ||
| 1432 | (cond (file | 2078 | (cond (file |
| 1433 | (setq file (expand-file-name file))) | 2079 | (setq file (expand-file-name file))) |
| 1434 | (edt-xkeys-file | 2080 | (edt-keys-file |
| 1435 | (setq file (expand-file-name edt-xkeys-file))) | 2081 | (setq file (expand-file-name edt-keys-file))) |
| 1436 | (edt-gnu-emacs19-p | 2082 | (t |
| 1437 | (setq file (expand-file-name "~/.edt-gnu-keys"))) | 2083 | (setq file |
| 1438 | (edt-lucid-emacs19-p | 2084 | (expand-file-name |
| 1439 | (setq file (expand-file-name "~/.edt-lucid-keys")))) | 2085 | (concat |
| 2086 | "~/.edt-" edt-emacs-variant | ||
| 2087 | (if edt-term (concat "-" edt-term)) | ||
| 2088 | (if edt-xserver (concat "-" edt-xserver)) | ||
| 2089 | (if edt-window-system | ||
| 2090 | (concat "-" (upcase (symbol-name edt-window-system)))) | ||
| 2091 | "-keys"))))) | ||
| 1440 | (cond ((file-readable-p file) | 2092 | (cond ((file-readable-p file) |
| 1441 | (load-file file)) | 2093 | (load-file file)) |
| 1442 | (t | 2094 | (t |
| @@ -1444,16 +2096,19 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1444 | (erase-buffer) | 2096 | (erase-buffer) |
| 1445 | (insert " | 2097 | (insert " |
| 1446 | 2098 | ||
| 1447 | Ack!! You're running the Enhanced EDT Emulation under X-windows | 2099 | Ack!! You're running the Enhanced EDT Emulation without loading an |
| 1448 | without loading an EDT X key definition file. To create an EDT X | 2100 | EDT key mapping file. To create an EDT key mapping file, run the |
| 1449 | key definition file, run the edt-mapper.el program. But ONLY run | 2101 | edt-mapper.el program. It is safest to run it from an Emacs loaded |
| 1450 | it from an Emacs loaded without any of your own customizations | 2102 | without any of your own customizations found in your .emacs file, etc. |
| 1451 | found in your .emacs file, etc. Some user customization confuse | 2103 | The reason for this is that some user customizations confuse edt-mapper. |
| 1452 | the edt-mapper function. To do this, you need to invoke Emacs | 2104 | You can do this by quitting Emacs and then invoking Emacs again as |
| 1453 | as follows: | 2105 | follows: |
| 1454 | 2106 | ||
| 1455 | emacs -q -l edt-mapper.el | 2107 | emacs -q -l edt-mapper.el |
| 1456 | 2108 | ||
| 2109 | [NOTE: If you do nothing out of the ordinary in your .emacs file, and | ||
| 2110 | the search for edt-mapper.el is successful, you can try running it now.] | ||
| 2111 | |||
| 1457 | The file edt-mapper.el includes these same directions on how to | 2112 | The file edt-mapper.el includes these same directions on how to |
| 1458 | use it! Perhaps it's lying around here someplace. \n ") | 2113 | use it! Perhaps it's lying around here someplace. \n ") |
| 1459 | (let ((file "edt-mapper.el") | 2114 | (let ((file "edt-mapper.el") |
| @@ -1472,48 +2127,78 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1472 | "Ah yes, there it is, in \n\n %s \n\n" path)) | 2127 | "Ah yes, there it is, in \n\n %s \n\n" path)) |
| 1473 | (if (edt-y-or-n-p "Do you want to run it now? ") | 2128 | (if (edt-y-or-n-p "Do you want to run it now? ") |
| 1474 | (load-file path) | 2129 | (load-file path) |
| 1475 | (error "EDT Emulation not configured."))) | 2130 | (error "EDT Emulation not configured"))) |
| 1476 | (t | 2131 | (t |
| 1477 | (insert "Nope, I can't seem to find it. :-(\n\n") | 2132 | (insert "Nope, I can't seem to find it. :-(\n\n") |
| 1478 | (sit-for 20) | 2133 | (sit-for 20) |
| 1479 | (error "EDT Emulation not configured."))))))) | 2134 | (error "EDT Emulation not configured"))))))) |
| 2135 | |||
| 2136 | ;;; | ||
| 2137 | ;;; Turning the EDT Emulation on and off. | ||
| 2138 | ;;; | ||
| 1480 | 2139 | ||
| 1481 | ;;;###autoload | 2140 | ;;;###autoload |
| 1482 | (defun edt-emulation-on () | 2141 | (defun edt-emulation-on () |
| 1483 | "Turn on EDT Emulation." | 2142 | "Turn on EDT Emulation." |
| 1484 | (interactive) | 2143 | (interactive) |
| 1485 | ;; If using MS-DOS or Windows, need to load edt-pc.el | 2144 | ;; If using pc window system (MS-DOS), set terminal type to pc. |
| 1486 | (if (memq system-type '(ms-dos windows-nt)) | 2145 | ;; If not a window system (GNU) or a tty window system (XEmacs), |
| 2146 | ;; get terminal type. | ||
| 2147 | (if (eq edt-window-system 'pc) | ||
| 1487 | (setq edt-term "pc") | 2148 | (setq edt-term "pc") |
| 1488 | (setq edt-term (or (getenv "TERM") ""))) | 2149 | (if (or (not edt-window-system) (eq edt-window-system 'tty)) |
| 1489 | ;; All DEC VT series terminals are supported by loading edt-vt100.el | 2150 | (setq edt-term (getenv "TERM")))) |
| 1490 | (if (string-equal "vt" (substring edt-term 0 (min (length edt-term) 2))) | 2151 | ;; Look for for terminal configuration file for this terminal type. |
| 1491 | (setq edt-term "vt100")) | 2152 | ;; Otherwise, load the user's custom configuration file. |
| 1492 | ;; Load EDT terminal specific configuration file. | 2153 | (if (or (not edt-window-system) (memq edt-window-system '(pc tty))) |
| 1493 | (let ((term edt-term) | 2154 | (progn |
| 1494 | hyphend) | 2155 | ;; Load terminal-specific configuration file, if it exists for this |
| 1495 | (while (and term | 2156 | ;; terminal type. Note: All DEC VT series terminals are supported |
| 1496 | (not (load (concat "edt-" term) t t))) | 2157 | ;; by the same terminal configuration file: edt-vt100.el. |
| 1497 | ;; Strip off last hyphen and what follows, then try again | 2158 | (if (string-equal "vt" (substring edt-term 0 (min (length edt-term) 2))) |
| 1498 | (if (setq hyphend (string-match "[-_][^-_]+$" term)) | 2159 | (setq edt-term "vt100")) |
| 1499 | (setq term (substring term 0 hyphend)) | 2160 | (let ((term edt-term) |
| 1500 | (setq term nil))) | 2161 | hyphend) |
| 1501 | ;; Override terminal-specific file if running X Windows. X Windows support | 2162 | (while (and term |
| 1502 | ;; is handled differently in edt-load-xkeys | 2163 | (not (load (concat "edt-" term) t t))) |
| 1503 | (if (eq window-system 'x) | 2164 | ;; Strip off last hyphen and what follows, then try again |
| 1504 | (edt-load-xkeys nil) | 2165 | (if (setq hyphend (string-match "[-_][^-_]+$" term)) |
| 1505 | (if (null term) | 2166 | (setq term (substring term 0 hyphend)) |
| 1506 | (error "Unable to load EDT terminal specific file for %s" edt-term))) | 2167 | (setq term nil))) |
| 1507 | (setq edt-term term)) | 2168 | ;; If no terminal-specific configuration file exists, load user's |
| 1508 | (setq edt-orig-transient-mark-mode transient-mark-mode) | 2169 | ;; custom EDT terminal configuration file. |
| 1509 | (add-hook 'activate-mark-hook | 2170 | ;; If this is a pc running MS-DOS, then custom configuration files |
| 1510 | (function | 2171 | ;; are not supported. So, if the file is missing, issue an error |
| 1511 | (lambda () | 2172 | ;; message. |
| 1512 | (edt-select-mode t)))) | 2173 | (if (null term) |
| 1513 | (add-hook 'deactivate-mark-hook | 2174 | (if (equal edt-term "pc") |
| 1514 | (function | 2175 | (error "Unable to find EDT terminal specific file edt-pc.el") |
| 1515 | (lambda () | 2176 | (edt-load-keys nil)) |
| 1516 | (edt-select-mode nil)))) | 2177 | (setq edt-term term)))) |
| 2178 | (edt-load-keys nil)) | ||
| 2179 | ;; Make highlighting of selected text work properly for EDT commands. | ||
| 2180 | (if edt-gnu-emacs19-p | ||
| 2181 | (progn | ||
| 2182 | (setq edt-orig-transient-mark-mode transient-mark-mode) | ||
| 2183 | (add-hook 'activate-mark-hook | ||
| 2184 | (function | ||
| 2185 | (lambda () | ||
| 2186 | (edt-select-mode t)))) | ||
| 2187 | (add-hook 'deactivate-mark-hook | ||
| 2188 | (function | ||
| 2189 | (lambda () | ||
| 2190 | (edt-select-mode nil))))) | ||
| 2191 | (progn | ||
| 2192 | (add-hook 'zmacs-activate-region-hook | ||
| 2193 | (function | ||
| 2194 | (lambda () | ||
| 2195 | (edt-select-mode t)))) | ||
| 2196 | (add-hook 'zmacs-deactivate-region-hook | ||
| 2197 | (function | ||
| 2198 | (lambda () | ||
| 2199 | (edt-select-mode nil)))))) | ||
| 2200 | ;; Load user's EDT custom key bindings file, if it exists. | ||
| 2201 | ;; Otherwise, use the default bindings. | ||
| 1517 | (if (load "edt-user" t t) | 2202 | (if (load "edt-user" t t) |
| 1518 | (edt-user-emulation-setup) | 2203 | (edt-user-emulation-setup) |
| 1519 | (edt-default-emulation-setup))) | 2204 | (edt-default-emulation-setup))) |
| @@ -1525,14 +2210,17 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1525 | (if (not edt-keep-current-page-delimiter) | 2210 | (if (not edt-keep-current-page-delimiter) |
| 1526 | (setq page-delimiter edt-orig-page-delimiter)) | 2211 | (setq page-delimiter edt-orig-page-delimiter)) |
| 1527 | (setq edt-direction-string "") | 2212 | (setq edt-direction-string "") |
| 1528 | (setq edt-select-mode-text nil) | 2213 | (setq edt-select-mode-current nil) |
| 1529 | (edt-reset) | 2214 | (edt-reset) |
| 1530 | (force-mode-line-update t) | 2215 | (force-mode-line-update t) |
| 1531 | (setq transient-mark-mode edt-orig-transient-mark-mode) | 2216 | (if edt-gnu-emacs19-p |
| 2217 | (setq transient-mark-mode edt-orig-transient-mark-mode)) | ||
| 1532 | (message "Original key bindings restored; EDT Emulation disabled")) | 2218 | (message "Original key bindings restored; EDT Emulation disabled")) |
| 1533 | 2219 | ||
| 1534 | (defun edt-default-emulation-setup (&optional user-setup) | 2220 | (defun edt-default-emulation-setup (&optional user-setup) |
| 1535 | "Setup emulation of DEC's EDT editor." | 2221 | "Setup emulation of DEC's EDT editor. |
| 2222 | Optional argument USER-SETUP non-nil means called from function | ||
| 2223 | `edt-user-emulation-setup'." | ||
| 1536 | ;; Setup default EDT global map by copying global map bindings. | 2224 | ;; Setup default EDT global map by copying global map bindings. |
| 1537 | ;; This preserves ESC and C-x prefix bindings and other bindings we | 2225 | ;; This preserves ESC and C-x prefix bindings and other bindings we |
| 1538 | ;; wish to retain in EDT emulation mode keymaps. It also permits | 2226 | ;; wish to retain in EDT emulation mode keymaps. It also permits |
| @@ -1540,7 +2228,9 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1540 | ;; disturbing the original bindings in global-map. | 2228 | ;; disturbing the original bindings in global-map. |
| 1541 | (fset 'edt-default-ESC-prefix (copy-keymap 'ESC-prefix)) | 2229 | (fset 'edt-default-ESC-prefix (copy-keymap 'ESC-prefix)) |
| 1542 | (setq edt-default-global-map (copy-keymap (current-global-map))) | 2230 | (setq edt-default-global-map (copy-keymap (current-global-map))) |
| 1543 | (define-key edt-default-global-map "\e" 'edt-default-ESC-prefix) | 2231 | (if edt-gnu-emacs19-p |
| 2232 | (define-key edt-default-global-map "\e" 'edt-default-ESC-prefix) | ||
| 2233 | (define-key edt-default-global-map [escape] 'edt-default-ESC-prefix)) | ||
| 1544 | (define-prefix-command 'edt-default-gold-map) | 2234 | (define-prefix-command 'edt-default-gold-map) |
| 1545 | (edt-setup-default-bindings) | 2235 | (edt-setup-default-bindings) |
| 1546 | ;; If terminal has additional function keys, the terminal-specific | 2236 | ;; If terminal has additional function keys, the terminal-specific |
| @@ -1552,20 +2242,20 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1552 | (setq edt-learn-macro-count 0) | 2242 | (setq edt-learn-macro-count 0) |
| 1553 | ;; Display EDT text selection active within the mode line | 2243 | ;; Display EDT text selection active within the mode line |
| 1554 | (or (assq 'edt-select-mode minor-mode-alist) | 2244 | (or (assq 'edt-select-mode minor-mode-alist) |
| 1555 | (setq minor-mode-alist | 2245 | (setq minor-mode-alist |
| 1556 | (cons '(edt-select-mode edt-select-mode) minor-mode-alist))) | 2246 | (cons '(edt-select-mode edt-select-mode) minor-mode-alist))) |
| 1557 | ;; Display EDT direction of motion within the mode line | 2247 | ;; Display EDT direction of motion within the mode line |
| 1558 | (or (assq 'edt-direction-string minor-mode-alist) | 2248 | (or (assq 'edt-direction-string minor-mode-alist) |
| 1559 | (setq minor-mode-alist | 2249 | (setq minor-mode-alist |
| 1560 | (cons | 2250 | (cons |
| 1561 | '(edt-direction-string edt-direction-string) minor-mode-alist))) | 2251 | '(edt-direction-string edt-direction-string) minor-mode-alist))) |
| 1562 | (if user-setup | 2252 | (if user-setup |
| 1563 | (progn | 2253 | (progn |
| 1564 | (setq edt-user-map-configured t) | 2254 | (setq edt-user-map-configured t) |
| 1565 | (fset 'edt-emulation-on (symbol-function 'edt-select-user-global-map))) | 2255 | (fset 'edt-emulation-on (symbol-function 'edt-select-user-global-map))) |
| 1566 | (progn | 2256 | (progn |
| 1567 | (fset 'edt-emulation-on (symbol-function 'edt-select-default-global-map)) | 2257 | (fset 'edt-emulation-on (symbol-function 'edt-select-default-global-map)) |
| 1568 | (edt-select-default-global-map)))) | 2258 | (edt-select-default-global-map)))) |
| 1569 | 2259 | ||
| 1570 | (defun edt-user-emulation-setup () | 2260 | (defun edt-user-emulation-setup () |
| 1571 | "Setup user custom emulation of DEC's EDT editor." | 2261 | "Setup user custom emulation of DEC's EDT editor." |
| @@ -1574,7 +2264,9 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1574 | ;; Setup user EDT global map by copying default EDT global map bindings. | 2264 | ;; Setup user EDT global map by copying default EDT global map bindings. |
| 1575 | (fset 'edt-user-ESC-prefix (copy-keymap 'edt-default-ESC-prefix)) | 2265 | (fset 'edt-user-ESC-prefix (copy-keymap 'edt-default-ESC-prefix)) |
| 1576 | (setq edt-user-global-map (copy-keymap edt-default-global-map)) | 2266 | (setq edt-user-global-map (copy-keymap edt-default-global-map)) |
| 1577 | (define-key edt-user-global-map "\e" 'edt-user-ESC-prefix) | 2267 | (if edt-gnu-emacs19-p |
| 2268 | (define-key edt-user-global-map "\e" 'edt-user-ESC-prefix) | ||
| 2269 | (define-key edt-user-global-map [escape] 'edt-user-ESC-prefix)) | ||
| 1578 | ;; If terminal has additional function keys, the user's initialization | 2270 | ;; If terminal has additional function keys, the user's initialization |
| 1579 | ;; file can assign bindings to them via the optional | 2271 | ;; file can assign bindings to them via the optional |
| 1580 | ;; function edt-setup-extra-default-bindings. | 2272 | ;; function edt-setup-extra-default-bindings. |
| @@ -1586,7 +2278,8 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1586 | (defun edt-select-default-global-map() | 2278 | (defun edt-select-default-global-map() |
| 1587 | "Select default EDT emulation key bindings." | 2279 | "Select default EDT emulation key bindings." |
| 1588 | (interactive) | 2280 | (interactive) |
| 1589 | (transient-mark-mode 1) | 2281 | (if edt-gnu-emacs19-p |
| 2282 | (transient-mark-mode 1)) | ||
| 1590 | (use-global-map edt-default-global-map) | 2283 | (use-global-map edt-default-global-map) |
| 1591 | (if (not edt-keep-current-page-delimiter) | 2284 | (if (not edt-keep-current-page-delimiter) |
| 1592 | (progn | 2285 | (progn |
| @@ -1594,7 +2287,7 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1594 | (setq page-delimiter "\f"))) | 2287 | (setq page-delimiter "\f"))) |
| 1595 | (setq edt-default-map-active t) | 2288 | (setq edt-default-map-active t) |
| 1596 | (edt-advance) | 2289 | (edt-advance) |
| 1597 | (setq edt-select-mode-text 'edt-select-mode-string) | 2290 | (setq edt-select-mode-current 'edt-select-mode-string) |
| 1598 | (edt-reset) | 2291 | (edt-reset) |
| 1599 | (message "Default EDT keymap active")) | 2292 | (message "Default EDT keymap active")) |
| 1600 | 2293 | ||
| @@ -1603,7 +2296,8 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1603 | (interactive) | 2296 | (interactive) |
| 1604 | (if edt-user-map-configured | 2297 | (if edt-user-map-configured |
| 1605 | (progn | 2298 | (progn |
| 1606 | (transient-mark-mode 1) | 2299 | (if edt-gnu-emacs19-p |
| 2300 | (transient-mark-mode 1)) | ||
| 1607 | (use-global-map edt-user-global-map) | 2301 | (use-global-map edt-user-global-map) |
| 1608 | (if (not edt-keep-current-page-delimiter) | 2302 | (if (not edt-keep-current-page-delimiter) |
| 1609 | (progn | 2303 | (progn |
| @@ -1611,51 +2305,73 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1611 | (setq page-delimiter "\f"))) | 2305 | (setq page-delimiter "\f"))) |
| 1612 | (setq edt-default-map-active nil) | 2306 | (setq edt-default-map-active nil) |
| 1613 | (edt-advance) | 2307 | (edt-advance) |
| 1614 | (setq edt-select-mode-text 'edt-select-mode-string) | 2308 | (setq edt-select-mode-current 'edt-select-mode-string) |
| 1615 | (edt-reset) | 2309 | (edt-reset) |
| 1616 | (message "User EDT custom keymap active")) | 2310 | (message "User EDT custom keymap active")) |
| 1617 | (error "User EDT custom keymap NOT configured!"))) | 2311 | (error "User EDT custom keymap NOT configured!"))) |
| 1618 | 2312 | ||
| 1619 | (defun edt-switch-global-maps () | 2313 | (defun edt-switch-global-maps () |
| 1620 | "Toggle between default EDT keymap and user EDT keymap." | 2314 | "Toggle between default EDT keymap and user EDT keymap." |
| 1621 | (interactive) | 2315 | (interactive) |
| 1622 | (if edt-default-map-active | 2316 | (if edt-default-map-active |
| 1623 | (edt-select-user-global-map) | 2317 | (edt-select-user-global-map) |
| 1624 | (edt-select-default-global-map))) | 2318 | (edt-select-default-global-map))) |
| 1625 | 2319 | ||
| 1626 | ;; There are three key binding functions needed: one for standard keys | 2320 | ;; |
| 1627 | ;; (used to bind control keys, primarily), one for Gold sequences of | 2321 | ;; Functions used to set up DEFAULT bindings to EDT emulation functions. |
| 1628 | ;; standard keys, and one for function keys. | 2322 | ;; |
| 1629 | 2323 | ||
| 1630 | (defun edt-bind-gold-key (key gold-binding &optional default) | 2324 | (defun edt-bind-function-key-default (function-key binding gold-binding) |
| 1631 | "Binds commands to a gold key sequence in the EDT Emulator." | 2325 | "Binds LK-201 function keys to default bindings in the EDT Emulator. |
| 1632 | (if default | 2326 | Argument FUNCTION-KEY is the name of the function key or keypad function key. |
| 1633 | (define-key 'edt-default-gold-map key gold-binding) | 2327 | Argument BINDING is the Emacs function to be bound to <KEY>. |
| 1634 | (define-key 'edt-user-gold-map key gold-binding))) | 2328 | Argument GOLD-BINDING is the Emacs function to be bound to GOLD <KEY>." |
| 1635 | 2329 | (let ((key (cdr (assoc function-key *EDT-keys*)))) | |
| 1636 | (defun edt-bind-standard-key (key gold-binding &optional default) | 2330 | (if (and key (not (equal key ""))) |
| 1637 | "Bind commands to a gold key sequence in the default EDT keymap." | 2331 | (progn |
| 1638 | (if default | 2332 | (define-key edt-default-global-map key binding) |
| 1639 | (define-key edt-default-global-map key gold-binding) | 2333 | (define-key 'edt-default-gold-map key gold-binding))))) |
| 1640 | (define-key edt-user-global-map key gold-binding))) | 2334 | |
| 1641 | 2335 | (defun edt-bind-key-default (key binding) | |
| 1642 | (defun edt-bind-function-key | 2336 | "Bind key sequences to default bindings in the EDT Emulator. |
| 1643 | (function-key binding gold-binding &optional default) | 2337 | Argument KEY is the name of a standard key or a function key. |
| 1644 | "Binds function keys in the EDT Emulator." | 2338 | Argument BINDING is the Emacs function to be bound to <KEY>." |
| 1645 | (catch 'edt-key-not-supported | 2339 | (define-key edt-default-global-map key binding)) |
| 1646 | (let ((key-vector (cdr (assoc function-key *EDT-keys*)))) | 2340 | |
| 1647 | (if (stringp key-vector) | 2341 | (defun edt-bind-gold-key-default (key gold-binding) |
| 1648 | (throw 'edt-key-not-supported t)) | 2342 | "Binds <GOLD> key sequences to default bindings in the EDT Emulator. |
| 1649 | (if (not (null key-vector)) | 2343 | Argument KEY is the name of a standard key or a function key. |
| 1650 | (progn | 2344 | Argument GOLD-BINDING is the Emacs function to be bound to GOLD <KEY>." |
| 1651 | (if default | 2345 | (define-key 'edt-default-gold-map key gold-binding)) |
| 1652 | (progn | 2346 | |
| 1653 | (define-key edt-default-global-map key-vector binding) | 2347 | ;; |
| 1654 | (define-key 'edt-default-gold-map key-vector gold-binding)) | 2348 | ;; Functions used to set up USER CUSTOM bindings to EDT emulation functions. |
| 1655 | (progn | 2349 | ;; |
| 1656 | (define-key edt-user-global-map key-vector binding) | 2350 | (defun edt-bind-function-key (function-key binding gold-binding) |
| 1657 | (define-key 'edt-user-gold-map key-vector gold-binding)))) | 2351 | "Binds LK-201 function keys to custom bindings in the EDT Emulator. |
| 1658 | (error "%s is not a legal function key name" function-key))))) | 2352 | Argument FUNCTION-KEY is the name of the function key or keypad function key. |
| 2353 | Argument BINDING is the Emacs function to be bound to <KEY>. | ||
| 2354 | Argument GOLD-BINDING is the Emacs function to be bound to GOLD <KEY>." | ||
| 2355 | (let ((key (cdr (assoc function-key *EDT-keys*)))) | ||
| 2356 | (if (and key (not (equal key ""))) | ||
| 2357 | (progn | ||
| 2358 | (define-key edt-user-global-map key binding) | ||
| 2359 | (define-key 'edt-user-gold-map key gold-binding))))) | ||
| 2360 | |||
| 2361 | (defun edt-bind-key (key binding) | ||
| 2362 | "Bind standard key sequences to custom bindings in the EDT Emulator. | ||
| 2363 | Argument KEY is the name of a key. It can be a standard key or a function key. | ||
| 2364 | Argument BINDING is the Emacs function to be bound to <KEY>." | ||
| 2365 | (define-key edt-user-global-map key binding)) | ||
| 2366 | |||
| 2367 | ;; For backward compatibility to existing edt-user.el files. | ||
| 2368 | (fset 'edt-bind-standard-key (symbol-function 'edt-bind-key)) | ||
| 2369 | |||
| 2370 | (defun edt-bind-gold-key (key gold-binding) | ||
| 2371 | "Binds <GOLD> standard key sequences to custom bindings in the EDT Emulator. | ||
| 2372 | Argument KEY is the name of a standard key or a function key. | ||
| 2373 | Argument GOLD-BINDING is the Emacs function to be bound to GOLD <KEY>." | ||
| 2374 | (define-key 'edt-user-gold-map key gold-binding)) | ||
| 1659 | 2375 | ||
| 1660 | (defun edt-setup-default-bindings () | 2376 | (defun edt-setup-default-bindings () |
| 1661 | "Assigns default EDT Emulation keyboard bindings." | 2377 | "Assigns default EDT Emulation keyboard bindings." |
| @@ -1663,65 +2379,81 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1663 | ;; Function Key Bindings: Regular and GOLD. | 2379 | ;; Function Key Bindings: Regular and GOLD. |
| 1664 | 2380 | ||
| 1665 | ;; VT100/VT200/VT300 PF1 (GOLD), PF2, PF3, PF4 Keys | 2381 | ;; VT100/VT200/VT300 PF1 (GOLD), PF2, PF3, PF4 Keys |
| 1666 | (edt-bind-function-key "PF1" 'edt-default-gold-map 'edt-mark-section-wisely t) | 2382 | (edt-bind-function-key-default "PF1" |
| 1667 | (edt-bind-function-key "PF2" 'edt-electric-keypad-help 'describe-function t) | 2383 | 'edt-default-gold-map 'edt-mark-section-wisely) |
| 1668 | (edt-bind-function-key "PF3" 'edt-find-next 'edt-find t) | 2384 | (edt-bind-function-key-default "PF2" |
| 1669 | (edt-bind-function-key "PF4" 'edt-delete-line 'edt-undelete-line t) | 2385 | 'edt-electric-keypad-help 'describe-function) |
| 2386 | (edt-bind-function-key-default "PF3" 'edt-find-next 'edt-find) | ||
| 2387 | (edt-bind-function-key-default "PF4" 'edt-delete-line 'edt-undelete-line) | ||
| 1670 | 2388 | ||
| 1671 | ;; VT100/VT200/VT300 Arrow Keys | 2389 | ;; VT100/VT200/VT300 Arrow Keys |
| 1672 | (edt-bind-function-key "UP" 'previous-line 'edt-window-top t) | 2390 | (edt-bind-function-key-default "UP" 'edt-previous-line 'edt-window-top) |
| 1673 | (edt-bind-function-key "DOWN" 'next-line 'edt-window-bottom t) | 2391 | (edt-bind-function-key-default "DOWN" 'edt-next-line 'edt-window-bottom) |
| 1674 | (edt-bind-function-key "LEFT" 'backward-char 'edt-sentence-backward t) | 2392 | (edt-bind-function-key-default "LEFT" 'backward-char 'edt-sentence-backward) |
| 1675 | (edt-bind-function-key "RIGHT" 'forward-char 'edt-sentence-forward t) | 2393 | (edt-bind-function-key-default "RIGHT" 'forward-char 'edt-sentence-forward) |
| 1676 | 2394 | ||
| 1677 | ;; VT100/VT200/VT300 Keypad Keys | 2395 | ;; VT100/VT200/VT300 Keypad Keys |
| 1678 | (edt-bind-function-key "KP0" 'edt-line 'open-line t) | 2396 | (edt-bind-function-key-default "KP0" 'edt-line 'open-line) |
| 1679 | (edt-bind-function-key "KP1" 'edt-word 'edt-change-case t) | 2397 | (edt-bind-function-key-default "KP1" 'edt-word 'edt-change-case) |
| 1680 | (edt-bind-function-key "KP2" 'edt-end-of-line 'edt-delete-to-end-of-line t) | 2398 | (edt-bind-function-key-default "KP2" |
| 1681 | (edt-bind-function-key "KP3" 'edt-character 'quoted-insert t) | 2399 | 'edt-end-of-line 'edt-delete-to-end-of-line) |
| 1682 | (edt-bind-function-key "KP4" 'edt-advance 'edt-bottom t) | 2400 | (edt-bind-function-key-default "KP3" 'edt-character 'quoted-insert) |
| 1683 | (edt-bind-function-key "KP5" 'edt-backup 'edt-top t) | 2401 | (edt-bind-function-key-default "KP4" 'edt-advance 'edt-bottom) |
| 1684 | (edt-bind-function-key "KP6" 'edt-cut 'yank t) | 2402 | (edt-bind-function-key-default "KP5" 'edt-backup 'edt-top) |
| 1685 | (edt-bind-function-key "KP7" 'edt-page 'execute-extended-command t) | 2403 | (edt-bind-function-key-default "KP6" 'edt-cut 'yank) |
| 1686 | (edt-bind-function-key "KP8" 'edt-sect 'edt-fill-region t) | 2404 | (edt-bind-function-key-default "KP7" 'edt-page 'execute-extended-command) |
| 1687 | (edt-bind-function-key "KP9" 'edt-append 'edt-replace t) | 2405 | (edt-bind-function-key-default "KP8" 'edt-sect 'edt-fill-region) |
| 1688 | (edt-bind-function-key "KP-" 'edt-delete-word 'edt-undelete-word t) | 2406 | (edt-bind-function-key-default "KP9" 'edt-append 'edt-replace) |
| 1689 | (edt-bind-function-key "KP," 'edt-delete-character 'edt-undelete-character t) | 2407 | (edt-bind-function-key-default "KP-" 'edt-delete-word 'edt-undelete-word) |
| 1690 | (edt-bind-function-key "KPP" 'edt-select 'edt-reset t) | 2408 | (edt-bind-function-key-default "KP," |
| 1691 | (edt-bind-function-key "KPE" 'other-window 'query-replace t) | 2409 | 'edt-delete-character 'edt-undelete-character) |
| 2410 | (edt-bind-function-key-default "KPP" 'edt-select 'edt-reset) | ||
| 2411 | (edt-bind-function-key-default "KPE" 'other-window 'edt-substitute) | ||
| 1692 | 2412 | ||
| 1693 | ;; VT200/VT300 Function Keys | 2413 | ;; VT200/VT300 Function Keys |
| 1694 | ;; (F1 through F5, on the VT220, are not programmable, so we skip | 2414 | ;; (F1 through F5, on the VT220, are not programmable, so we skip |
| 1695 | ;; making default bindings to those keys. | 2415 | ;; making default bindings to those keys. |
| 1696 | (edt-bind-function-key "FIND" 'edt-find-next 'edt-find t) | 2416 | (edt-bind-function-key-default "FIND" 'edt-find-next 'edt-find) |
| 1697 | (edt-bind-function-key "INSERT" 'yank 'edt-key-not-assigned t) | 2417 | (edt-bind-function-key-default "INSERT" 'yank 'edt-key-not-assigned) |
| 1698 | (edt-bind-function-key "REMOVE" 'edt-cut 'edt-copy t) | 2418 | (edt-bind-function-key-default "REMOVE" 'edt-cut 'edt-copy) |
| 1699 | (edt-bind-function-key "SELECT" 'edt-toggle-select 'edt-key-not-assigned t) | 2419 | (edt-bind-function-key-default "SELECT" |
| 1700 | (edt-bind-function-key "NEXT" 'edt-sect-forward 'edt-key-not-assigned t) | 2420 | 'edt-toggle-select 'edt-key-not-assigned) |
| 1701 | (edt-bind-function-key "PREVIOUS" 'edt-sect-backward 'edt-key-not-assigned t) | 2421 | (edt-bind-function-key-default "NEXT" |
| 1702 | (edt-bind-function-key "F6" 'edt-key-not-assigned 'edt-key-not-assigned t) | 2422 | 'edt-sect-forward 'edt-key-not-assigned) |
| 1703 | (edt-bind-function-key "F7" 'edt-copy-rectangle 'edt-key-not-assigned t) | 2423 | (edt-bind-function-key-default "PREVIOUS" |
| 1704 | (edt-bind-function-key "F8" | 2424 | 'edt-sect-backward 'edt-key-not-assigned) |
| 1705 | 'edt-cut-rectangle-overstrike-mode 'edt-paste-rectangle-overstrike-mode t) | 2425 | (edt-bind-function-key-default "F6" |
| 1706 | (edt-bind-function-key "F9" | 2426 | 'edt-key-not-assigned 'edt-key-not-assigned) |
| 1707 | 'edt-cut-rectangle-insert-mode 'edt-paste-rectangle-insert-mode t) | 2427 | (edt-bind-function-key-default "F7" |
| 1708 | (edt-bind-function-key "F10" 'edt-cut-rectangle 'edt-paste-rectangle t) | 2428 | 'edt-copy-rectangle 'edt-key-not-assigned) |
| 2429 | (edt-bind-function-key-default "F8" | ||
| 2430 | 'edt-cut-rectangle-overstrike-mode 'edt-paste-rectangle-overstrike-mode) | ||
| 2431 | (edt-bind-function-key-default "F9" | ||
| 2432 | 'edt-cut-rectangle-insert-mode 'edt-paste-rectangle-insert-mode) | ||
| 2433 | (edt-bind-function-key-default "F10" 'edt-cut-rectangle 'edt-paste-rectangle) | ||
| 1709 | ;; Under X, the F11 key can be bound. If using a VT-200 or higher terminal, | 2434 | ;; Under X, the F11 key can be bound. If using a VT-200 or higher terminal, |
| 1710 | ;; the default emacs terminal support causes the VT F11 key to seem as if it | 2435 | ;; the default emacs terminal support causes the VT F11 key to seem as if it |
| 1711 | ;; is an ESC key when in emacs. | 2436 | ;; is an ESC key when in emacs. |
| 1712 | (edt-bind-function-key "F11" | 2437 | (edt-bind-function-key-default "F11" |
| 1713 | 'edt-key-not-assigned 'edt-key-not-assigned t) | 2438 | 'edt-key-not-assigned 'edt-key-not-assigned) |
| 1714 | (edt-bind-function-key "F12" | 2439 | (edt-bind-function-key-default "F12" |
| 1715 | 'edt-beginning-of-line 'delete-other-windows t) ;BS | 2440 | 'edt-beginning-of-line 'delete-other-windows) ;BS |
| 1716 | (edt-bind-function-key "F13" | 2441 | (edt-bind-function-key-default "F13" |
| 1717 | 'edt-delete-to-beginning-of-word 'edt-key-not-assigned t) ;LF | 2442 | 'edt-delete-to-beginning-of-word 'edt-key-not-assigned) ;LF |
| 1718 | (edt-bind-function-key "F14" 'edt-key-not-assigned 'edt-key-not-assigned t) | 2443 | (edt-bind-function-key-default "F14" |
| 1719 | (edt-bind-function-key "HELP" 'edt-electric-keypad-help 'edt-key-not-assigned t) | 2444 | 'edt-key-not-assigned 'edt-key-not-assigned) |
| 1720 | (edt-bind-function-key "DO" 'execute-extended-command 'edt-key-not-assigned t) | 2445 | (edt-bind-function-key-default "HELP" |
| 1721 | (edt-bind-function-key "F17" 'edt-key-not-assigned 'edt-key-not-assigned t) | 2446 | 'edt-electric-keypad-help 'edt-key-not-assigned) |
| 1722 | (edt-bind-function-key "F18" 'edt-key-not-assigned 'edt-key-not-assigned t) | 2447 | (edt-bind-function-key-default "DO" |
| 1723 | (edt-bind-function-key "F19" 'edt-key-not-assigned 'edt-key-not-assigned t) | 2448 | 'execute-extended-command 'edt-key-not-assigned) |
| 1724 | (edt-bind-function-key "F20" 'edt-key-not-assigned 'edt-key-not-assigned t) | 2449 | (edt-bind-function-key-default "F17" |
| 2450 | 'edt-key-not-assigned 'edt-key-not-assigned) | ||
| 2451 | (edt-bind-function-key-default "F18" | ||
| 2452 | 'edt-key-not-assigned 'edt-key-not-assigned) | ||
| 2453 | (edt-bind-function-key-default "F19" | ||
| 2454 | 'edt-key-not-assigned 'edt-key-not-assigned) | ||
| 2455 | (edt-bind-function-key-default "F20" | ||
| 2456 | 'edt-key-not-assigned 'edt-key-not-assigned) | ||
| 1725 | 2457 | ||
| 1726 | ;; Control key bindings: Regular and GOLD | 2458 | ;; Control key bindings: Regular and GOLD |
| 1727 | ;; | 2459 | ;; |
| @@ -1734,142 +2466,139 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1734 | ;; used, instead. | 2466 | ;; used, instead. |
| 1735 | (if edt-use-EDT-control-key-bindings | 2467 | (if edt-use-EDT-control-key-bindings |
| 1736 | (progn | 2468 | (progn |
| 1737 | (edt-bind-standard-key "\C-a" 'edt-key-not-assigned t) | 2469 | (edt-bind-key-default "\C-a" 'edt-key-not-assigned) |
| 1738 | (edt-bind-standard-key "\C-b" 'edt-key-not-assigned t) | 2470 | (edt-bind-key-default "\C-b" 'edt-key-not-assigned) |
| 1739 | ;; Leave binding of C-c as original prefix key. | 2471 | ;; Leave binding of C-c to an Emacs prefix key. |
| 1740 | (edt-bind-standard-key "\C-d" 'edt-key-not-assigned t) | 2472 | (edt-bind-key-default "\C-d" 'edt-key-not-assigned) |
| 1741 | (edt-bind-standard-key "\C-e" 'edt-key-not-assigned t) | 2473 | (edt-bind-key-default "\C-e" 'edt-key-not-assigned) |
| 1742 | (edt-bind-standard-key "\C-f" 'edt-key-not-assigned t) | 2474 | (edt-bind-key-default "\C-f" 'edt-key-not-assigned) |
| 1743 | ;; Leave binding of C-g to keyboard-quit | 2475 | ;; Leave binding of C-g to the Emacs keyboard-quit |
| 1744 | ; (edt-bind-standard-key "\C-g" 'keyboard-quit t) | 2476 | (edt-bind-key-default "\C-h" 'edt-beginning-of-line) |
| 1745 | ;; Standard EDT binding of C-h. To invoke Emacs help, use | 2477 | (edt-bind-key-default "\C-i" 'edt-tab-insert) |
| 1746 | ;; GOLD-C-h instead. | 2478 | (edt-bind-key-default "\C-j" 'edt-delete-to-beginning-of-word) |
| 1747 | (edt-bind-standard-key "\C-h" 'edt-beginning-of-line t) | 2479 | (edt-bind-key-default "\C-k" 'edt-define-key) |
| 1748 | (edt-bind-standard-key "\C-i" 'edt-tab-insert t) | 2480 | (edt-bind-gold-key-default "\C-k" 'edt-restore-key) |
| 1749 | (edt-bind-standard-key "\C-j" 'edt-delete-to-beginning-of-word t) | 2481 | (edt-bind-key-default "\C-l" 'edt-form-feed-insert) |
| 1750 | (edt-bind-standard-key "\C-k" 'edt-define-key t) | ||
| 1751 | (edt-bind-gold-key "\C-k" 'edt-restore-key t) | ||
| 1752 | (edt-bind-standard-key "\C-l" 'edt-form-feed-insert t) | ||
| 1753 | ;; Leave binding of C-m to newline. | 2482 | ;; Leave binding of C-m to newline. |
| 1754 | (edt-bind-standard-key "\C-n" 'edt-set-screen-width-80 t) | 2483 | (edt-bind-key-default "\C-n" 'edt-set-screen-width-80) |
| 1755 | (edt-bind-standard-key "\C-o" 'edt-key-not-assigned t) | 2484 | (edt-bind-key-default "\C-o" 'edt-key-not-assigned) |
| 1756 | (edt-bind-standard-key "\C-p" 'edt-key-not-assigned t) | 2485 | (edt-bind-key-default "\C-p" 'edt-key-not-assigned) |
| 1757 | (edt-bind-standard-key "\C-q" 'edt-key-not-assigned t) | 2486 | (edt-bind-key-default "\C-q" 'edt-key-not-assigned) |
| 1758 | ;; Leave binding of C-r to isearch-backward. | 2487 | ;; Leave binding of C-r to isearch-backward. |
| 1759 | ;; Leave binding of C-s to isearch-forward. | 2488 | ;; Leave binding of C-s to isearch-forward. |
| 1760 | (edt-bind-standard-key "\C-t" 'edt-display-the-time t) | 2489 | (edt-bind-key-default "\C-t" 'edt-display-the-time) |
| 1761 | (edt-bind-standard-key "\C-u" 'edt-delete-to-beginning-of-line t) | 2490 | (edt-bind-key-default "\C-u" 'edt-delete-to-beginning-of-line) |
| 1762 | (edt-bind-standard-key "\C-v" 'redraw-display t) | 2491 | (edt-bind-key-default "\C-v" 'redraw-display) |
| 1763 | (edt-bind-standard-key "\C-w" 'edt-set-screen-width-132 t) | 2492 | (edt-bind-key-default "\C-w" 'edt-set-screen-width-132) |
| 1764 | ;; Leave binding of C-x as original prefix key. | 2493 | ;; Leave binding of C-x as original prefix key. |
| 1765 | (edt-bind-standard-key "\C-y" 'edt-key-not-assigned t) | 2494 | (edt-bind-key-default "\C-y" 'edt-key-not-assigned) |
| 1766 | ; (edt-bind-standard-key "\C-z" 'suspend-emacs t) | 2495 | ;; Leave binding of C-z to suspend-emacs. |
| 1767 | ) | 2496 | ) |
| 1768 | ) | 2497 | ) |
| 1769 | 2498 | ||
| 1770 | ;; GOLD bindings for a few Control keys. | 2499 | ;; GOLD bindings for a few keys. |
| 1771 | (edt-bind-gold-key "\C-g" 'keyboard-quit t); Just in case. | 2500 | (edt-bind-gold-key-default "\C-g" 'keyboard-quit); Just in case. |
| 1772 | (edt-bind-gold-key "\C-h" 'help-for-help t) | 2501 | (edt-bind-gold-key-default "\C-h" 'help-for-help); Just in case. |
| 1773 | (edt-bind-gold-key [f1] 'help-for-help t) | 2502 | (edt-bind-gold-key-default [f1] 'help-for-help) |
| 1774 | (edt-bind-gold-key [help] 'help-for-help t) | 2503 | (edt-bind-gold-key-default [help] 'help-for-help) |
| 1775 | (edt-bind-gold-key "\C-\\" 'split-window-vertically t) | 2504 | (edt-bind-gold-key-default "\C-\\" 'split-window-vertically) |
| 1776 | 2505 | ||
| 1777 | ;; GOLD bindings for regular keys. | 2506 | ;; GOLD bindings for regular keys. |
| 1778 | (edt-bind-gold-key "a" 'edt-key-not-assigned t) | 2507 | (edt-bind-gold-key-default "a" 'edt-key-not-assigned) |
| 1779 | (edt-bind-gold-key "A" 'edt-key-not-assigned t) | 2508 | (edt-bind-gold-key-default "A" 'edt-key-not-assigned) |
| 1780 | (edt-bind-gold-key "b" 'buffer-menu t) | 2509 | (edt-bind-gold-key-default "b" 'buffer-menu) |
| 1781 | (edt-bind-gold-key "B" 'buffer-menu t) | 2510 | (edt-bind-gold-key-default "B" 'buffer-menu) |
| 1782 | (edt-bind-gold-key "c" 'compile t) | 2511 | (edt-bind-gold-key-default "c" 'compile) |
| 1783 | (edt-bind-gold-key "C" 'compile t) | 2512 | (edt-bind-gold-key-default "C" 'compile) |
| 1784 | (edt-bind-gold-key "d" 'delete-window t) | 2513 | (edt-bind-gold-key-default "d" 'delete-window) |
| 1785 | (edt-bind-gold-key "D" 'delete-window t) | 2514 | (edt-bind-gold-key-default "D" 'delete-window) |
| 1786 | (edt-bind-gold-key "e" 'edt-exit t) | 2515 | (edt-bind-gold-key-default "e" 'edt-exit) |
| 1787 | (edt-bind-gold-key "E" 'edt-exit t) | 2516 | (edt-bind-gold-key-default "E" 'edt-exit) |
| 1788 | (edt-bind-gold-key "f" 'find-file t) | 2517 | (edt-bind-gold-key-default "f" 'find-file) |
| 1789 | (edt-bind-gold-key "F" 'find-file t) | 2518 | (edt-bind-gold-key-default "F" 'find-file) |
| 1790 | (edt-bind-gold-key "g" 'find-file-other-window t) | 2519 | (edt-bind-gold-key-default "g" 'find-file-other-window) |
| 1791 | (edt-bind-gold-key "G" 'find-file-other-window t) | 2520 | (edt-bind-gold-key-default "G" 'find-file-other-window) |
| 1792 | (edt-bind-gold-key "h" 'edt-electric-keypad-help t) | 2521 | (edt-bind-gold-key-default "h" 'edt-electric-keypad-help) |
| 1793 | (edt-bind-gold-key "H" 'edt-electric-keypad-help t) | 2522 | (edt-bind-gold-key-default "H" 'edt-electric-keypad-help) |
| 1794 | (edt-bind-gold-key "i" 'insert-file t) | 2523 | (edt-bind-gold-key-default "i" 'insert-file) |
| 1795 | (edt-bind-gold-key "I" 'insert-file t) | 2524 | (edt-bind-gold-key-default "I" 'insert-file) |
| 1796 | (edt-bind-gold-key "j" 'edt-key-not-assigned t) | 2525 | (edt-bind-gold-key-default "j" 'edt-key-not-assigned) |
| 1797 | (edt-bind-gold-key "J" 'edt-key-not-assigned t) | 2526 | (edt-bind-gold-key-default "J" 'edt-key-not-assigned) |
| 1798 | (edt-bind-gold-key "k" 'edt-toggle-capitalization-of-word t) | 2527 | (edt-bind-gold-key-default "k" 'edt-toggle-capitalization-of-word) |
| 1799 | (edt-bind-gold-key "K" 'edt-toggle-capitalization-of-word t) | 2528 | (edt-bind-gold-key-default "K" 'edt-toggle-capitalization-of-word) |
| 1800 | (edt-bind-gold-key "l" 'edt-lowercase t) | 2529 | (edt-bind-gold-key-default "l" 'edt-lowercase) |
| 1801 | (edt-bind-gold-key "L" 'edt-lowercase t) | 2530 | (edt-bind-gold-key-default "L" 'edt-lowercase) |
| 1802 | (edt-bind-gold-key "m" 'save-some-buffers t) | 2531 | (edt-bind-gold-key-default "m" 'save-some-buffers) |
| 1803 | (edt-bind-gold-key "M" 'save-some-buffers t) | 2532 | (edt-bind-gold-key-default "M" 'save-some-buffers) |
| 1804 | (edt-bind-gold-key "n" 'next-error t) | 2533 | (edt-bind-gold-key-default "n" 'next-error) |
| 1805 | (edt-bind-gold-key "N" 'next-error t) | 2534 | (edt-bind-gold-key-default "N" 'next-error) |
| 1806 | (edt-bind-gold-key "o" 'switch-to-buffer-other-window t) | 2535 | (edt-bind-gold-key-default "o" 'switch-to-buffer-other-window) |
| 1807 | (edt-bind-gold-key "O" 'switch-to-buffer-other-window t) | 2536 | (edt-bind-gold-key-default "O" 'switch-to-buffer-other-window) |
| 1808 | (edt-bind-gold-key "p" 'edt-key-not-assigned t) | 2537 | (edt-bind-gold-key-default "p" 'edt-key-not-assigned) |
| 1809 | (edt-bind-gold-key "P" 'edt-key-not-assigned t) | 2538 | (edt-bind-gold-key-default "P" 'edt-key-not-assigned) |
| 1810 | (edt-bind-gold-key "q" 'edt-quit t) | 2539 | (edt-bind-gold-key-default "q" 'edt-quit) |
| 1811 | (edt-bind-gold-key "Q" 'edt-quit t) | 2540 | (edt-bind-gold-key-default "Q" 'edt-quit) |
| 1812 | (edt-bind-gold-key "r" 'revert-buffer t) | 2541 | (edt-bind-gold-key-default "r" 'revert-buffer) |
| 1813 | (edt-bind-gold-key "R" 'revert-buffer t) | 2542 | (edt-bind-gold-key-default "R" 'revert-buffer) |
| 1814 | (edt-bind-gold-key "s" 'save-buffer t) | 2543 | (edt-bind-gold-key-default "s" 'save-buffer) |
| 1815 | (edt-bind-gold-key "S" 'save-buffer t) | 2544 | (edt-bind-gold-key-default "S" 'save-buffer) |
| 1816 | (edt-bind-gold-key "t" 'edt-key-not-assigned t) | 2545 | (edt-bind-gold-key-default "t" 'edt-key-not-assigned) |
| 1817 | (edt-bind-gold-key "T" 'edt-key-not-assigned t) | 2546 | (edt-bind-gold-key-default "T" 'edt-key-not-assigned) |
| 1818 | (edt-bind-gold-key "u" 'edt-uppercase t) | 2547 | (edt-bind-gold-key-default "u" 'edt-uppercase) |
| 1819 | (edt-bind-gold-key "U" 'edt-uppercase t) | 2548 | (edt-bind-gold-key-default "U" 'edt-uppercase) |
| 1820 | (edt-bind-gold-key "v" 'find-file-other-window t) | 2549 | (edt-bind-gold-key-default "v" 'find-file-other-window) |
| 1821 | (edt-bind-gold-key "V" 'find-file-other-window t) | 2550 | (edt-bind-gold-key-default "V" 'find-file-other-window) |
| 1822 | (edt-bind-gold-key "w" 'write-file t) | 2551 | (edt-bind-gold-key-default "w" 'write-file) |
| 1823 | (edt-bind-gold-key "W" 'write-file t) | 2552 | (edt-bind-gold-key-default "W" 'write-file) |
| 1824 | (edt-bind-gold-key "x" 'edt-key-not-assigned t) | 2553 | (edt-bind-gold-key-default "x" 'edt-key-not-assigned) |
| 1825 | (edt-bind-gold-key "X" 'edt-key-not-assigned t) | 2554 | (edt-bind-gold-key-default "X" 'edt-key-not-assigned) |
| 1826 | (edt-bind-gold-key "y" 'edt-emulation-off t) | 2555 | (edt-bind-gold-key-default "y" 'edt-emulation-off) |
| 1827 | (edt-bind-gold-key "Y" 'edt-emulation-off t) | 2556 | (edt-bind-gold-key-default "Y" 'edt-emulation-off) |
| 1828 | (edt-bind-gold-key "z" 'edt-switch-global-maps t) | 2557 | (edt-bind-gold-key-default "z" 'edt-switch-global-maps) |
| 1829 | (edt-bind-gold-key "Z" 'edt-switch-global-maps t) | 2558 | (edt-bind-gold-key-default "Z" 'edt-switch-global-maps) |
| 1830 | (edt-bind-gold-key "1" 'delete-other-windows t) | 2559 | (edt-bind-gold-key-default "1" 'delete-other-windows) |
| 1831 | (edt-bind-gold-key "!" 'edt-key-not-assigned t) | 2560 | (edt-bind-gold-key-default "!" 'edt-key-not-assigned) |
| 1832 | (edt-bind-gold-key "2" 'edt-split-window t) | 2561 | (edt-bind-gold-key-default "2" 'edt-split-window) |
| 1833 | (edt-bind-gold-key "@" 'edt-key-not-assigned t) | 2562 | (edt-bind-gold-key-default "@" 'edt-key-not-assigned) |
| 1834 | (edt-bind-gold-key "3" 'edt-key-not-assigned t) | 2563 | (edt-bind-gold-key-default "3" 'edt-key-not-assigned) |
| 1835 | (edt-bind-gold-key "#" 'edt-key-not-assigned t) | 2564 | (edt-bind-gold-key-default "#" 'edt-key-not-assigned) |
| 1836 | (edt-bind-gold-key "4" 'edt-key-not-assigned t) | 2565 | (edt-bind-gold-key-default "4" 'edt-key-not-assigned) |
| 1837 | (edt-bind-gold-key "$" 'edt-key-not-assigned t) | 2566 | (edt-bind-gold-key-default "$" 'edt-key-not-assigned) |
| 1838 | (edt-bind-gold-key "5" 'edt-key-not-assigned t) | 2567 | (edt-bind-gold-key-default "5" 'edt-key-not-assigned) |
| 1839 | (edt-bind-gold-key "%" 'edt-goto-percentage t) | 2568 | (edt-bind-gold-key-default "%" 'edt-goto-percentage) |
| 1840 | (edt-bind-gold-key "6" 'edt-key-not-assigned t) | 2569 | (edt-bind-gold-key-default "6" 'edt-key-not-assigned) |
| 1841 | (edt-bind-gold-key "^" 'edt-key-not-assigned t) | 2570 | (edt-bind-gold-key-default "^" 'edt-key-not-assigned) |
| 1842 | (edt-bind-gold-key "7" 'edt-key-not-assigned t) | 2571 | (edt-bind-gold-key-default "7" 'edt-key-not-assigned) |
| 1843 | (edt-bind-gold-key "&" 'edt-key-not-assigned t) | 2572 | (edt-bind-gold-key-default "&" 'edt-key-not-assigned) |
| 1844 | (edt-bind-gold-key "8" 'edt-key-not-assigned t) | 2573 | (edt-bind-gold-key-default "8" 'edt-key-not-assigned) |
| 1845 | (edt-bind-gold-key "*" 'edt-key-not-assigned t) | 2574 | (edt-bind-gold-key-default "*" 'edt-key-not-assigned) |
| 1846 | (edt-bind-gold-key "9" 'edt-key-not-assigned t) | 2575 | (edt-bind-gold-key-default "9" 'edt-key-not-assigned) |
| 1847 | (edt-bind-gold-key "(" 'edt-key-not-assigned t) | 2576 | (edt-bind-gold-key-default "(" 'edt-key-not-assigned) |
| 1848 | (edt-bind-gold-key "0" 'edt-key-not-assigned t) | 2577 | (edt-bind-gold-key-default "0" 'edt-key-not-assigned) |
| 1849 | (edt-bind-gold-key ")" 'edt-key-not-assigned t) | 2578 | (edt-bind-gold-key-default ")" 'edt-key-not-assigned) |
| 1850 | (edt-bind-gold-key " " 'undo t) | 2579 | (edt-bind-gold-key-default " " 'undo) |
| 1851 | (edt-bind-gold-key "," 'edt-key-not-assigned t) | 2580 | (edt-bind-gold-key-default "," 'edt-key-not-assigned) |
| 1852 | (edt-bind-gold-key "<" 'edt-key-not-assigned t) | 2581 | (edt-bind-gold-key-default "<" 'edt-key-not-assigned) |
| 1853 | (edt-bind-gold-key "." 'edt-key-not-assigned t) | 2582 | (edt-bind-gold-key-default "." 'edt-key-not-assigned) |
| 1854 | (edt-bind-gold-key ">" 'edt-key-not-assigned t) | 2583 | (edt-bind-gold-key-default ">" 'edt-key-not-assigned) |
| 1855 | (edt-bind-gold-key "/" 'edt-key-not-assigned t) | 2584 | (edt-bind-gold-key-default "/" 'query-replace) |
| 1856 | (edt-bind-gold-key "?" 'edt-key-not-assigned t) | 2585 | (edt-bind-gold-key-default "?" 'edt-key-not-assigned) |
| 1857 | (edt-bind-gold-key "\\" 'edt-key-not-assigned t) | 2586 | (edt-bind-gold-key-default "\\" 'edt-key-not-assigned) |
| 1858 | (edt-bind-gold-key "|" 'edt-key-not-assigned t) | 2587 | (edt-bind-gold-key-default "|" 'edt-key-not-assigned) |
| 1859 | (edt-bind-gold-key ";" 'edt-key-not-assigned t) | 2588 | (edt-bind-gold-key-default ";" 'edt-key-not-assigned) |
| 1860 | (edt-bind-gold-key ":" 'edt-key-not-assigned t) | 2589 | (edt-bind-gold-key-default ":" 'edt-key-not-assigned) |
| 1861 | (edt-bind-gold-key "'" 'edt-key-not-assigned t) | 2590 | (edt-bind-gold-key-default "'" 'edt-key-not-assigned) |
| 1862 | (edt-bind-gold-key "\"" 'edt-key-not-assigned t) | 2591 | (edt-bind-gold-key-default "\"" 'edt-key-not-assigned) |
| 1863 | (edt-bind-gold-key "-" 'edt-key-not-assigned t) | 2592 | (edt-bind-gold-key-default "-" 'edt-key-not-assigned) |
| 1864 | (edt-bind-gold-key "_" 'edt-key-not-assigned t) | 2593 | (edt-bind-gold-key-default "_" 'edt-key-not-assigned) |
| 1865 | (edt-bind-gold-key "=" 'goto-line t) | 2594 | (edt-bind-gold-key-default "=" 'goto-line) |
| 1866 | (edt-bind-gold-key "+" 'edt-key-not-assigned t) | 2595 | (edt-bind-gold-key-default "+" 'edt-key-not-assigned) |
| 1867 | (edt-bind-gold-key "[" 'edt-key-not-assigned t) | 2596 | (edt-bind-gold-key-default "[" 'edt-key-not-assigned) |
| 1868 | (edt-bind-gold-key "{" 'edt-key-not-assigned t) | 2597 | (edt-bind-gold-key-default "{" 'edt-key-not-assigned) |
| 1869 | (edt-bind-gold-key "]" 'edt-key-not-assigned t) | 2598 | (edt-bind-gold-key-default "]" 'edt-key-not-assigned) |
| 1870 | (edt-bind-gold-key "}" 'edt-key-not-assigned t) | 2599 | (edt-bind-gold-key-default "}" 'edt-key-not-assigned) |
| 1871 | (edt-bind-gold-key "`" 'what-line t) | 2600 | (edt-bind-gold-key-default "`" 'what-line) |
| 1872 | (edt-bind-gold-key "~" 'edt-key-not-assigned t) | 2601 | (edt-bind-gold-key-default "~" 'edt-key-not-assigned) |
| 1873 | ) | 2602 | ) |
| 1874 | 2603 | ||
| 1875 | ;;; | 2604 | ;;; |
| @@ -1884,8 +2613,7 @@ If FILE is nil, try to load a default file. The default file names are | |||
| 1884 | ;;; | 2613 | ;;; |
| 1885 | 2614 | ||
| 1886 | (defun edt-keypad-help () | 2615 | (defun edt-keypad-help () |
| 1887 | " | 2616 | "DEFAULT EDT Keypad Active. |
| 1888 | DEFAULT EDT Keypad Active | ||
| 1889 | 2617 | ||
| 1890 | F7: Copy Rectangle +----------+----------+----------+----------+ | 2618 | F7: Copy Rectangle +----------+----------+----------+----------+ |
| 1891 | F8: Cut Rect Overstrike |Prev Line |Next Line |Bkwd Char |Frwd Char | | 2619 | F8: Cut Rect Overstrike |Prev Line |Next Line |Bkwd Char |Frwd Char | |
| @@ -1899,8 +2627,8 @@ G-F10: Paste Rectangle | |||
| 1899 | G-F12: Delete Other Windows | GOLD | HELP | FNDNXT | DEL L | | 2627 | G-F12: Delete Other Windows | GOLD | HELP | FNDNXT | DEL L | |
| 1900 | F13: Delete to Begin of Word | (PF1) | (PF2) | (PF3) | (PF4) | | 2628 | F13: Delete to Begin of Word | (PF1) | (PF2) | (PF3) | (PF4) | |
| 1901 | HELP: Keypad Help |Mark Wisel|Desc Funct| FIND | UND L | | 2629 | HELP: Keypad Help |Mark Wisel|Desc Funct| FIND | UND L | |
| 1902 | DO: Execute extended command +----------+----------+----------+----------+ | 2630 | G-HELP: Emacs Help +----------+----------+----------+----------+ |
| 1903 | | PAGE | SECT | APPEND | DEL W | | 2631 | DO: Execute extended command | PAGE | SECT | APPEND | DEL W | |
| 1904 | C-g: Keyboard Quit | (7) | (8) | (9) | (-) | | 2632 | C-g: Keyboard Quit | (7) | (8) | (9) | (-) | |
| 1905 | G-C-g: Keyboard Quit |Ex Ext Cmd|Fill Regio| REPLACE | UND W | | 2633 | G-C-g: Keyboard Quit |Ex Ext Cmd|Fill Regio| REPLACE | UND W | |
| 1906 | C-h: Beginning of Line +----------+----------+----------+----------+ | 2634 | C-h: Beginning of Line +----------+----------+----------+----------+ |
| @@ -1913,8 +2641,8 @@ G-C-k: Restore Key | WORD | EOL | CHAR | Next | | |||
| 1913 | C-n: Set Screen Width 80 | CHNGCASE | DEL EOL |Quoted Ins| ! | 2641 | C-n: Set Screen Width 80 | CHNGCASE | DEL EOL |Quoted Ins| ! |
| 1914 | C-r: Isearch Backward +---------------------+----------+ (ENTER) | | 2642 | C-r: Isearch Backward +---------------------+----------+ (ENTER) | |
| 1915 | C-s: Isearch Forward | LINE | SELECT | ! | 2643 | C-s: Isearch Forward | LINE | SELECT | ! |
| 1916 | C-t: Display the Time | (0) | (.) | Query | | 2644 | C-t: Display the Time | (0) | (.) | SUBS | |
| 1917 | C-u: Delete to Begin of Line | Open Line | RESET | Replace | | 2645 | C-u: Delete to Begin of Line | Open Line | RESET | | |
| 1918 | C-v: Redraw Display +---------------------+----------+----------+ | 2646 | C-v: Redraw Display +---------------------+----------+----------+ |
| 1919 | C-w: Set Screen Width 132 | 2647 | C-w: Set Screen Width 132 |
| 1920 | C-z: Suspend Emacs +----------+----------+----------+ | 2648 | C-z: Suspend Emacs +----------+----------+----------+ |
| @@ -1946,7 +2674,8 @@ G-C-\\: Split Window | FNDNXT | Yank | CUT | | |||
| 1946 | G-%: Go to Percentage | 2674 | G-%: Go to Percentage |
| 1947 | G- : Undo (GOLD Spacebar) | 2675 | G- : Undo (GOLD Spacebar) |
| 1948 | G-=: Go to Line | 2676 | G-=: Go to Line |
| 1949 | G-`: What line" | 2677 | G-`: What line |
| 2678 | G-/: Query-Replace" | ||
| 1950 | 2679 | ||
| 1951 | (interactive) | 2680 | (interactive) |
| 1952 | (describe-function 'edt-keypad-help)) | 2681 | (describe-function 'edt-keypad-help)) |
| @@ -1993,25 +2722,26 @@ G-C-\\: Split Window | FNDNXT | Yank | CUT | | |||
| 1993 | ;;; | 2722 | ;;; |
| 1994 | ;;; EDT emulation screen width commands. | 2723 | ;;; EDT emulation screen width commands. |
| 1995 | ;;; | 2724 | ;;; |
| 1996 | ;; Some terminals require modification of terminal attributes when changing the | 2725 | ;; Some terminals require modification of terminal attributes when |
| 1997 | ;; number of columns displayed, hence the fboundp tests below. These functions | 2726 | ;; changing the number of columns displayed, hence the fboundp tests |
| 1998 | ;; are defined in the corresponding terminal specific file, if needed. | 2727 | ;; below. These functions are defined in the corresponding terminal |
| 2728 | ;; specific file, if needed. | ||
| 1999 | 2729 | ||
| 2000 | (defun edt-set-screen-width-80 () | 2730 | (defun edt-set-screen-width-80 () |
| 2001 | "Set screen width to 80 columns." | 2731 | "Set screen width to 80 columns." |
| 2002 | (interactive) | 2732 | (interactive) |
| 2003 | (if (fboundp 'edt-set-term-width-80) | 2733 | (if (fboundp 'edt-set-term-width-80) |
| 2004 | (edt-set-term-width-80)) | 2734 | (edt-set-term-width-80)) |
| 2005 | (set-screen-width 80) | 2735 | (set-frame-width nil 80) |
| 2006 | (message "Screen width 80")) | 2736 | (message "Terminal width 80")) |
| 2007 | 2737 | ||
| 2008 | (defun edt-set-screen-width-132 () | 2738 | (defun edt-set-screen-width-132 () |
| 2009 | "Set screen width to 132 columns." | 2739 | "Set screen width to 132 columns." |
| 2010 | (interactive) | 2740 | (interactive) |
| 2011 | (if (fboundp 'edt-set-term-width-132) | 2741 | (if (fboundp 'edt-set-term-width-132) |
| 2012 | (edt-set-term-width-132)) | 2742 | (edt-set-term-width-132)) |
| 2013 | (set-screen-width 132) | 2743 | (set-frame-width nil 132) |
| 2014 | (message "Screen width 132")) | 2744 | (message "Terminal width 132")) |
| 2015 | 2745 | ||
| 2016 | (provide 'edt) | 2746 | (provide 'edt) |
| 2017 | 2747 | ||