emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs lisp/ChangeLog lisp/loadup.el lisp/startu...


From: Stefan Monnier
Subject: [Emacs-diffs] emacs lisp/ChangeLog lisp/loadup.el lisp/startu...
Date: Thu, 10 Sep 2009 18:19:09 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/09/10 18:19:08

Modified files:
        lisp           : ChangeLog loadup.el startup.el subr.el 
        src            : ChangeLog keyboard.c 

Log message:
        * keyboard.c (Qmenu_alias, Vdefine_key_rebound_commands): Remove.
        (parse_menu_item): Streamline since bindings are recomputed all the
        time anyway.  Don't bother checking Vdefine_key_rebound_commands any
        more and don't support lmenu's menu-alias any more either.
        * subr.el (define-key-rebound-commands): Mark obsolete.
        * startup.el (precompute-menubar-bindings): Remove.
        (normal-top-level): Remove obsolete code that tried to precompute
        menubar bindings.
        * loadup.el (define-key-rebound-commands): Don't bother fiddling with
        define-key-rebound-commands and precompute-menubar-bindings.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16121&r2=1.16122
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/loadup.el?cvsroot=emacs&r1=1.180&r2=1.181
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/startup.el?cvsroot=emacs&r1=1.537&r2=1.538
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/subr.el?cvsroot=emacs&r1=1.649&r2=1.650
http://cvs.savannah.gnu.org/viewcvs/emacs/src/ChangeLog?cvsroot=emacs&r1=1.7734&r2=1.7735
http://cvs.savannah.gnu.org/viewcvs/emacs/src/keyboard.c?cvsroot=emacs&r1=1.1012&r2=1.1013

Patches:
Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16121
retrieving revision 1.16122
diff -u -b -r1.16121 -r1.16122
--- lisp/ChangeLog      10 Sep 2009 06:23:06 -0000      1.16121
+++ lisp/ChangeLog      10 Sep 2009 18:19:03 -0000      1.16122
@@ -1,3 +1,12 @@
+2009-09-10  Stefan Monnier  <address@hidden>
+
+       * subr.el (define-key-rebound-commands): Mark obsolete.
+       * startup.el (precompute-menubar-bindings): Remove.
+       (normal-top-level): Remove obsolete code that tried to precompute
+       menubar bindings.
+       * loadup.el (define-key-rebound-commands): Don't bother fiddling with
+       define-key-rebound-commands and precompute-menubar-bindings.
+
 2009-09-10  Glenn Morris  <address@hidden>
 
        * pcvs.el (cvs-mode-find-file): Use forward-line rather than goto-line.

Index: lisp/loadup.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/loadup.el,v
retrieving revision 1.180
retrieving revision 1.181
diff -u -b -r1.180 -r1.181
--- lisp/loadup.el      21 Aug 2009 06:19:28 -0000      1.180
+++ lisp/loadup.el      10 Sep 2009 18:19:06 -0000      1.181
@@ -233,12 +233,6 @@
 (if (load "site-load" t)
     (garbage-collect))
 
-(if (fboundp 'x-popup-menu)
-    (precompute-menubar-bindings))
-;; Turn on recording of which commands get rebound,
-;; for the sake of the next call to precompute-menubar-bindings.
-(setq define-key-rebound-commands nil)
-
 ;; Determine which last version number to use
 ;; based on the executables that now exist.
 (if (and (or (equal (nth 3 command-line-args) "dump")

Index: lisp/startup.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/startup.el,v
retrieving revision 1.537
retrieving revision 1.538
diff -u -b -r1.537 -r1.538
--- lisp/startup.el     10 Sep 2009 02:25:56 -0000      1.537
+++ lisp/startup.el     10 Sep 2009 18:19:06 -0000      1.538
@@ -501,8 +501,7 @@
                     (delete (concat "PWD=" pwd)
                             process-environment)))))
     (setq default-directory (abbreviate-file-name default-directory))
-    (let ((menubar-bindings-done nil)
-         (old-face-font-rescale-alist face-font-rescale-alist))
+    (let ((old-face-font-rescale-alist face-font-rescale-alist))
       (unwind-protect
          (command-line)
        ;; Do this again, in case .emacs defined more abbreviations.
@@ -571,10 +570,7 @@
        (if (fboundp 'font-menu-add-default)
            (font-menu-add-default))
        (and window-setup-hook
-            (run-hooks 'window-setup-hook))
-       (or menubar-bindings-done
-           (if (display-popup-menus-p)
-               (precompute-menubar-bindings)))))
+            (run-hooks 'window-setup-hook))))
     ;; Subprocesses of Emacs do not have direct access to the terminal, so
     ;; unless told otherwise they should only assume a dumb terminal.
     ;; We are careful to do it late (after term-setup-hook), although the
@@ -595,20 +591,6 @@
         (delete display process-environment)))))
 
 ;; Precompute the keyboard equivalents in the menu bar items.
-(defun precompute-menubar-bindings ()
-  (let ((submap (lookup-key global-map [menu-bar])))
-    (while submap
-      (and (consp (car submap))
-          (symbolp (car (car submap)))
-          (stringp (car-safe (cdr (car submap))))
-          (keymapp (cdr (cdr (car submap))))
-          (progn
-            (x-popup-menu nil (cdr (cdr (car submap))))
-            (if purify-flag
-                (garbage-collect))))
-      (setq submap (cdr submap))))
-    (setq define-key-rebound-commands t))
-
 ;; Command-line options supported by tty's:
 (defconst tty-long-option-alist
   '(("--name"            . "-name")

Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.649
retrieving revision 1.650
diff -u -b -r1.649 -r1.650
--- lisp/subr.el        8 Sep 2009 19:42:25 -0000       1.649
+++ lisp/subr.el        10 Sep 2009 18:19:06 -0000      1.650
@@ -1076,6 +1076,7 @@
 
 ;;;; Obsolescence declarations for variables, and aliases.
 
+(make-obsolete-variable 'define-key-rebound-commands nil "23.2")
 (make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register 
"23.1")
 (make-obsolete 'window-redisplay-end-trigger nil "23.1")
 (make-obsolete 'set-window-redisplay-end-trigger nil "23.1")

Index: src/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.7734
retrieving revision 1.7735
diff -u -b -r1.7734 -r1.7735
--- src/ChangeLog       10 Sep 2009 16:19:52 -0000      1.7734
+++ src/ChangeLog       10 Sep 2009 18:19:06 -0000      1.7735
@@ -1,5 +1,10 @@
 2009-09-10  Stefan Monnier  <address@hidden>
 
+       * keyboard.c (Qmenu_alias, Vdefine_key_rebound_commands): Remove.
+       (parse_menu_item): Streamline since bindings are recomputed all the
+       time anyway.  Don't bother checking Vdefine_key_rebound_commands any
+       more and don't support lmenu's menu-alias any more either.
+
        * keymap.c (where_is_internal_data): Make noindirect a boolean.
        (where_is_internal): Strip it down to only traverse the keymaps.
        Move the cache handling from Fwhere_is_internal to here.

Index: src/keyboard.c
===================================================================
RCS file: /sources/emacs/emacs/src/keyboard.c,v
retrieving revision 1.1012
retrieving revision 1.1013
diff -u -b -r1.1012 -r1.1013
--- src/keyboard.c      10 Sep 2009 16:19:54 -0000      1.1012
+++ src/keyboard.c      10 Sep 2009 18:19:08 -0000      1.1013
@@ -495,11 +495,9 @@
 Lisp_Object Qevent_symbol_elements;
 
 /* menu item parts */
-Lisp_Object Qmenu_alias;
 Lisp_Object Qmenu_enable;
 Lisp_Object QCenable, QCvisible, QChelp, QCfilter, QCkeys, QCkey_sequence;
 Lisp_Object QCbutton, QCtoggle, QCradio;
-extern Lisp_Object Vdefine_key_rebound_commands;
 extern Lisp_Object Qmenu_item;
 
 /* An event header symbol HEAD may have a property named
@@ -7883,13 +7881,10 @@
      int notreal, inmenubar;
 {
   Lisp_Object def, tem, item_string, start;
-  Lisp_Object cachelist;
   Lisp_Object filter;
   Lisp_Object keyhint;
   int i;
-  int newcache = 0;
 
-  cachelist = Qnil;
   filter = Qnil;
   keyhint = Qnil;
 
@@ -7926,14 +7921,11 @@
          item = XCDR (item);
        }
 
-      /* Maybe key binding cache.  */
+      /* Maybe an obsolete key binding cache.  */
       if (CONSP (item) && CONSP (XCAR (item))
          && (NILP (XCAR (XCAR (item)))
              || VECTORP (XCAR (XCAR (item)))))
-       {
-         cachelist = XCAR (item);
          item = XCDR (item);
-       }
 
       /* This is the real definition--the function to run.  */
       ASET (item_properties, ITEM_PROPERTY_DEF, item);
@@ -7959,12 +7951,9 @@
          ASET (item_properties, ITEM_PROPERTY_DEF, XCAR (start));
 
          item = XCDR (start);
-         /* Is there a cache list with key equivalences. */
+         /* Is there an obsolete cache list with key equivalences.  */
          if (CONSP (item) && CONSP (XCAR (item)))
-           {
-             cachelist = XCAR (item);
              item = XCDR (item);
-           }
 
          /* Parse properties.  */
          while (CONSP (item) && CONSP (XCDR (item)))
@@ -7994,15 +7983,14 @@
              else if (EQ (tem, QCkey_sequence))
                {
                  tem = XCAR (item);
-                 if (NILP (cachelist)
-                     && (SYMBOLP (tem) || STRINGP (tem) || VECTORP (tem)))
+                 if (SYMBOLP (tem) || STRINGP (tem) || VECTORP (tem))
                    /* Be GC protected. Set keyhint to item instead of tem. */
                    keyhint = item;
                }
              else if (EQ (tem, QCkeys))
                {
                  tem = XCAR (item);
-                 if (CONSP (tem) || (STRINGP (tem) && NILP (cachelist)))
+                 if (CONSP (tem) || STRINGP (tem))
                    ASET (item_properties, ITEM_PROPERTY_KEYEQ, tem);
                }
              else if (EQ (tem, QCbutton) && CONSP (XCAR (item)))
@@ -8083,40 +8071,16 @@
     return 1;
 
   /* This is a command.  See if there is an equivalent key binding. */
-  if (NILP (cachelist))
-    {
-      /* We have to create a cachelist.  */
-      /* With the introduction of where_is_cache, the computation
-         of equivalent key bindings is sufficiently fast that we
-         do not need to cache it here any more. */
-      /* CHECK_IMPURE (start);
-         XSETCDR (start, Fcons (Fcons (Qnil, Qnil), XCDR (start)));
-        cachelist = XCAR (XCDR (start));  */
-      cachelist = Fcons (Qnil, Qnil);
-      newcache = 1;
       tem = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
-      if (!NILP (keyhint))
-       {
-         XSETCAR (cachelist, XCAR (keyhint));
-         newcache = 0;
-       }
-      else if (STRINGP (tem))
-       {
-         XSETCDR (cachelist, Fsubstitute_command_keys (tem));
-         XSETCAR (cachelist, Qt);
-       }
-    }
-
-  tem = XCAR (cachelist);
-  if (!EQ (tem, Qt))
+  /* The previous code preferred :key-sequence to :keys, so we
+     preserve this behavior.  */
+  if (STRINGP (tem) && !CONSP (keyhint))
+    tem = Fsubstitute_command_keys (tem);
+  else
     {
-      int chkcache = 0;
-      Lisp_Object prefix;
+      Lisp_Object prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
+      Lisp_Object keys = Qnil;
 
-      if (!NILP (tem))
-       tem = Fkey_binding (tem, Qnil, Qnil, Qnil);
-
-      prefix = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
       if (CONSP (prefix))
        {
          def = XCAR (prefix);
@@ -8125,58 +8089,27 @@
       else
        def = AREF (item_properties, ITEM_PROPERTY_DEF);
 
-      if (NILP (XCAR (cachelist))) /* Have no saved key.  */
+      if (CONSP (keyhint) && !NILP (XCAR (keyhint)))
        {
-         if (newcache          /* Always check first time.  */
-             /* Should we check everything when precomputing key
-                bindings?  */
-             /* If something had no key binding before, don't recheck it
-                because that is too slow--except if we have a list of
-                rebound commands in Vdefine_key_rebound_commands, do
-                recheck any command that appears in that list. */
-             || (CONSP (Vdefine_key_rebound_commands)
-                 && !NILP (Fmemq (def, Vdefine_key_rebound_commands))))
-           chkcache = 1;
-       }
-      /* We had a saved key. Is it still bound to the command?  */
-      else if (NILP (tem)
+         keys = XCAR (keyhint);
+         tem = Fkey_binding (keys, Qnil, Qnil, Qnil);
+
+         /* We have a suggested key.  Is it bound to the command?  */
+         if (NILP (tem)
               || (!EQ (tem, def)
                   /* If the command is an alias for another
                      (such as lmenu.el set it up), check if the
                      original command matches the cached command.  */
                   && !(SYMBOLP (def) && EQ (tem, XSYMBOL (def)->function))))
-       chkcache = 1;           /* Need to recompute key binding.  */
-
-      if (chkcache)
-       {
-         /* Recompute equivalent key binding.  If the command is an alias
-            for another (such as lmenu.el set it up), see if the original
-            command name has equivalent keys.  Otherwise look up the
-            specified command itself.  We don't try both, because that
-            makes lmenu menus slow. */
-         if (SYMBOLP (def)
-             && SYMBOLP (XSYMBOL (def)->function)
-             && ! NILP (Fget (def, Qmenu_alias)))
-           def = XSYMBOL (def)->function;
-         tem = Fwhere_is_internal (def, Qnil, Qt, Qnil, Qnil);
-
-         XSETCAR (cachelist, tem);
-         if (NILP (tem))
-           {
-             XSETCDR (cachelist, Qnil);
-             chkcache = 0;
-           }
-       }
-      else if (!NILP (keyhint) && !NILP (XCAR (cachelist)))
-       {
-         tem = XCAR (cachelist);
-         chkcache = 1;
+           keys = Qnil;
        }
 
-      newcache = chkcache;
-      if (chkcache)
+      if (NILP (keys))
+       keys = Fwhere_is_internal (def, Qnil, Qt, Qnil, Qnil);
+         
+      if (!NILP (keys))
        {
-         tem = Fkey_description (tem, Qnil);
+         tem = Fkey_description (keys, Qnil);
          if (CONSP (prefix))
            {
              if (STRINGP (XCAR (prefix)))
@@ -8184,17 +8117,11 @@
              if (STRINGP (XCDR (prefix)))
                tem = concat2 (tem, XCDR (prefix));
            }
-         XSETCDR (cachelist, tem);
-       }
-    }
-
-  tem = XCDR (cachelist);
-  if (newcache && !NILP (tem))
-    {
       tem = concat2 (build_string ("  "), tem);
       /* tem = concat3 (build_string ("  ("), tem, build_string (")")); */
-      XSETCDR (cachelist, tem);
     }
+    }
+  
 
   /* If we only want to precompute equivalent key bindings, stop here. */
   if (notreal)
@@ -11870,8 +11797,6 @@
 
   Qmenu_enable = intern ("menu-enable");
   staticpro (&Qmenu_enable);
-  Qmenu_alias = intern ("menu-alias");
-  staticpro (&Qmenu_alias);
   QCenable = intern (":enable");
   staticpro (&QCenable);
   QCvisible = intern (":visible");




reply via email to

[Prev in Thread] Current Thread [Next in Thread]