comparison lisp/keymap.el @ 1333:1b0339b048ce

[xemacs-hg @ 2003-03-02 09:38:37 by ben] To: xemacs-patches@xemacs.org PROBLEMS: Include nt/PROBLEMS and update. Add note about incremental linking badness. cmdloop.el, custom.el, dumped-lisp.el, files.el, keydefs.el, keymap.el, lisp-mode.el, make-docfile.el, replace.el, simple.el, subr.el, view-less.el, wid-edit.el: Lots of syncing with FSF 21.2. Use if-fboundp in wid-edit.el. New file newcomment.el from FSF. internals/internals.texi: Fix typo. (Build-Time Dependencies): New node. PROBLEMS: Delete. config.inc.samp, xemacs.mak: Eliminate HAVE_VC6, use SUPPORT_EDIT_AND_CONTINUE in its place. No incremental linking unless SUPPORT_EDIT_AND_CONTINUE, since it can cause nasty crashes in pdump. Put warnings about this in config.inc.samp. Report the full compile flags used for src and lib-src in the Installation output. alloc.c, lisp.h, ralloc.c, regex.c: Use ALLOCA() in regex.c to avoid excessive stack allocation. Also fix subtle problem with REL_ALLOC() -- any call to malloc() (direct or indirect) may relocate rel-alloced data, causing buffer text to shift. After any such call, regex must update all its pointers to such data. Add a system, when ERROR_CHECK_MALLOC, whereby regex.c indicates all the places it is prepared to handle malloc()/realloc()/free(), and any calls anywhere in XEmacs outside of this will trigger an abort. alloc.c, dialog-msw.c, eval.c, event-stream.c, general-slots.h, insdel.c, lisp.h, menubar-msw.c, menubar-x.c: Change *run_hook*_trapping_problems to take a warning class, not a string. Factor out code to issue warnings, add flag to call_trapping_problems() to postpone warning issue, and make *run_hook*_trapping_problems issue their own warnings tailored to the hook, postponed in the case of safe_run_hook_trapping_problems() so that the appropriate message can be issued about resetting to nil only when not `quit'. Make record_unwind_protect_restoring_int() non-static. dumper.c: Issue notes about incremental linking problems under Windows. fileio.c: Mule-ize encrypt/decrypt-string code. text.h: Spacing changes.
author ben
date Sun, 02 Mar 2003 09:38:54 +0000
parents 79940b592197
children a25c824ed558
comparison
equal deleted inserted replaced
1332:6aa23bb3da6b 1333:1b0339b048ce
1 ;; keymap.el --- Keymap functions for XEmacs. 1 ;; keymap.el --- Keymap functions for XEmacs.
2 2
3 ;; Copyright (C) 1993-4, 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1993-4, 1997 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. 4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
5 ;; Copyright (C) 2003 Ben Wing.
5 6
6 ;; Maintainer: XEmacs Development Team 7 ;; Maintainer: XEmacs Development Team
7 ;; Keywords: internals, dumped 8 ;; Keywords: internals, dumped
8 9
9 ;; This file is part of XEmacs. 10 ;; This file is part of XEmacs.
35 ;Prevent the \{...} documentation construct 36 ;Prevent the \{...} documentation construct
36 ;from mentioning keys that run this command. 37 ;from mentioning keys that run this command.
37 38
38 ;;; Code: 39 ;;; Code:
39 40
40 (put 'undefined 'suppress-keymap t) 41 ;; BEGIN SYNCHED WITH FSF 21.2.
41 42
42 (defun undefined () 43 (defun undefined ()
43 (interactive) 44 (interactive)
44 (ding)) 45 (ding))
45 46
46 (defmacro kbd (keys) 47 ;Prevent the \{...} documentation construct
47 "Convert KEYS to the internal Emacs key representation. 48 ;from mentioning keys that run this command.
48 KEYS should be a string in the format used for saving keyboard macros 49 (put 'undefined 'suppress-keymap t)
49 \(see `insert-kbd-macro')."
50 (if (or (stringp keys)
51 (vectorp keys))
52 ;; #### need to move xemacs-base into the core!!!!!!
53 (declare-fboundp (read-kbd-macro keys))
54 `(declare-fboundp (read-kbd-macro ,keys))))
55 50
56 (defun suppress-keymap (map &optional nodigits) 51 (defun suppress-keymap (map &optional nodigits)
57 "Make MAP override all normally self-inserting keys to be undefined. 52 "Make MAP override all normally self-inserting keys to be undefined.
58 Normally, as an exception, digits and minus-sign are set to make prefix args, 53 Normally, as an exception, digits and minus-sign are set to make prefix args,
59 but optional second arg NODIGITS non-nil treats them like other chars." 54 but optional second arg NODIGITS non-nil treats them like other chars."
63 (define-key map "-" 'negative-argument) 58 (define-key map "-" 'negative-argument)
64 ;; Make plain numbers do numeric args. 59 ;; Make plain numbers do numeric args.
65 (while (<= (aref string 0) ?9) 60 (while (<= (aref string 0) ?9)
66 (define-key map string 'digit-argument) 61 (define-key map string 'digit-argument)
67 (incf (aref string 0)))))) 62 (incf (aref string 0))))))
63
64 ;Unneeded in XEmacs (defvar key-substitution-in-progress nil
68 65
69 (defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix) 66 (defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix)
70 "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF. 67 "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF.
71 In other words, OLDDEF is replaced with NEWDEF wherever it appears. 68 In other words, OLDDEF is replaced with NEWDEF wherever it appears.
72 Prefix keymaps are checked recursively. If optional fourth argument OLDMAP 69 Prefix keymaps are checked recursively. If optional fourth argument OLDMAP
82 (setq prefix (car (car maps)) 79 (setq prefix (car (car maps))
83 map (cdr (car maps)) 80 map (cdr (car maps))
84 maps (cdr maps)) 81 maps (cdr maps))
85 ;; Substitute in this keymap 82 ;; Substitute in this keymap
86 (map-keymap #'(lambda (key binding) 83 (map-keymap #'(lambda (key binding)
87 (if (eq binding olddef) 84 (if (or (eq binding olddef)
85 ;; Compare with equal if definition is a key
86 ;; sequence. That is useful for operating on
87 ;; function-key-map.
88 (and (or (stringp binding) (vectorp binding))
89 (equal binding olddef)))
88 ;; The new bindings always go in KEYMAP even if we 90 ;; The new bindings always go in KEYMAP even if we
89 ;; found them in OLDMAP or one of its children. 91 ;; found them in OLDMAP or one of its children.
90 ;; If KEYMAP will be shadowing OLDMAP, then do not 92 ;; If KEYMAP will be shadowing OLDMAP, then do not
91 ;; redefine the key if there is another binding 93 ;; redefine the key if there is another binding
92 ;; in KEYMAP that will shadow OLDDEF. 94 ;; in KEYMAP that will shadow OLDDEF.
101 (vconcat prefix (list key)) 103 (vconcat prefix (list key))
102 newdef)))) 104 newdef))))
103 map) 105 map)
104 ))) 106 )))
105 107
108 ;; FSF garbage. They misguidedly tried to put menu entries into keymaps,
109 ;; and needed stuff like the following. Eventually they admitted defeat
110 ;; and switched to our method.
111
112 ; (defun define-key-after (keymap key definition &optional after)
113 ; "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding.
114 ; This is like `define-key' except that the binding for KEY is placed
115 ; just after the binding for the event AFTER, instead of at the beginning
116 ; of the map. Note that AFTER must be an event type (like KEY), NOT a command
117 ; \(like DEFINITION).
118 ;
119 ; If AFTER is t or omitted, the new binding goes at the end of the keymap.
120 ;
121 ; KEY must contain just one event type--that is to say, it must be a
122 ; string or vector of length 1, but AFTER should be a single event
123 ; type--a symbol or a character, not a sequence.
124 ;
125 ; Bindings are always added before any inherited map.
126 ;
127 ; The order of bindings in a keymap matters when it is used as a menu."
128
129 (defmacro kbd (keys)
130 "Convert KEYS to the internal Emacs key representation.
131 KEYS should be a string constant in the format used for
132 saving keyboard macros (see `insert-kbd-macro')."
133 (if (or (stringp keys)
134 (vectorp keys))
135 ;; #### need to move xemacs-base into the core!!!!!!
136 (declare-fboundp (read-kbd-macro keys))
137 `(declare-fboundp (read-kbd-macro ,keys))))
138
139 ;; END SYNCHED WITH FSF 21.2.
106 140
107 ;; This used to wrap forms into an interactive lambda. It is unclear 141 ;; This used to wrap forms into an interactive lambda. It is unclear
108 ;; to me why this is needed in this function. Anyway, 142 ;; to me why this is needed in this function. Anyway,
109 ;; `key-or-menu-binding' doesn't do it, so this function no longer 143 ;; `key-or-menu-binding' doesn't do it, so this function no longer
110 ;; does it, either. 144 ;; does it, either.