diff 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
line wrap: on
line diff
--- a/lisp/keymap.el	Sun Mar 02 02:18:12 2003 +0000
+++ b/lisp/keymap.el	Sun Mar 02 09:38:54 2003 +0000
@@ -2,6 +2,7 @@
 
 ;; Copyright (C) 1993-4, 1997 Free Software Foundation, Inc.
 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
+;; Copyright (C) 2003 Ben Wing.
 
 ;; Maintainer: XEmacs Development Team
 ;; Keywords: internals, dumped
@@ -37,21 +38,15 @@
 
 ;;; Code:
 
-(put 'undefined 'suppress-keymap t)
+;; BEGIN SYNCHED WITH FSF 21.2.
 
 (defun undefined ()
   (interactive)
   (ding))
 
-(defmacro kbd (keys)
-  "Convert KEYS to the internal Emacs key representation.
-KEYS should be a string in the format used for saving keyboard macros
-\(see `insert-kbd-macro')."
-  (if (or (stringp keys)
-	  (vectorp keys))
-      ;; #### need to move xemacs-base into the core!!!!!!
-      (declare-fboundp (read-kbd-macro keys))
-    `(declare-fboundp (read-kbd-macro ,keys))))
+;Prevent the \{...} documentation construct
+;from mentioning keys that run this command.
+(put 'undefined 'suppress-keymap t)
 
 (defun suppress-keymap (map &optional nodigits)
   "Make MAP override all normally self-inserting keys to be undefined.
@@ -66,6 +61,8 @@
 	  (define-key map string 'digit-argument)
 	  (incf (aref string 0))))))
 
+;Unneeded in XEmacs (defvar key-substitution-in-progress nil
+
 (defun substitute-key-definition (olddef newdef keymap &optional oldmap prefix)
   "Replace OLDDEF with NEWDEF for any keys in KEYMAP now defined as OLDDEF.
 In other words, OLDDEF is replaced with NEWDEF wherever it appears.
@@ -84,7 +81,12 @@
 	    maps (cdr maps))
       ;; Substitute in this keymap
       (map-keymap #'(lambda (key binding)
-		      (if (eq binding olddef)
+		      (if (or (eq binding olddef)
+			      ;; Compare with equal if definition is a key
+			      ;; sequence.  That is useful for operating on
+			      ;; function-key-map.
+			      (and (or (stringp binding) (vectorp binding))
+				   (equal binding olddef)))
 			  ;; The new bindings always go in KEYMAP even if we
 			  ;; found them in OLDMAP or one of its children.
 			  ;; If KEYMAP will be shadowing OLDMAP, then do not
@@ -103,6 +105,38 @@
 		  map)
       )))
 
+;; FSF garbage.  They misguidedly tried to put menu entries into keymaps,
+;; and needed stuff like the following.  Eventually they admitted defeat
+;; and switched to our method.
+
+; (defun define-key-after (keymap key definition &optional after)
+;   "Add binding in KEYMAP for KEY => DEFINITION, right after AFTER's binding.
+; This is like `define-key' except that the binding for KEY is placed
+; just after the binding for the event AFTER, instead of at the beginning
+; of the map.  Note that AFTER must be an event type (like KEY), NOT a command
+; \(like DEFINITION).
+;
+; If AFTER is t or omitted, the new binding goes at the end of the keymap.
+;
+; KEY must contain just one event type--that is to say, it must be a
+; string or vector of length 1, but AFTER should be a single event
+; type--a symbol or a character, not a sequence.
+;
+; Bindings are always added before any inherited map.
+;
+; The order of bindings in a keymap matters when it is used as a menu."
+
+(defmacro kbd (keys)
+  "Convert KEYS to the internal Emacs key representation.
+KEYS should be a string constant in the format used for
+saving keyboard macros (see `insert-kbd-macro')."
+  (if (or (stringp keys)
+	  (vectorp keys))
+      ;; #### need to move xemacs-base into the core!!!!!!
+      (declare-fboundp (read-kbd-macro keys))
+    `(declare-fboundp (read-kbd-macro ,keys))))
+
+;; END SYNCHED WITH FSF 21.2.
 
 ;; This used to wrap forms into an interactive lambda.  It is unclear
 ;; to me why this is needed in this function.  Anyway,