emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r112851: * src/keymap.c (Fcurrent_act


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112851: * src/keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings):
Date: Tue, 04 Jun 2013 21:58:43 -0400
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 112851
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Tue 2013-06-04 21:58:43 -0400
message:
  * src/keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings):
  * src/keyboard.c (menu_bar_items, tool_bar_items):
  * src/doc.c (Fsubstitute_command_keys): Voverriding_terminal_local_map does
  not override local keymaps any more.
modified:
  etc/NEWS
  lisp/subr.el
  src/ChangeLog
  src/doc.c
  src/keyboard.c
  src/keymap.c
=== modified file 'etc/NEWS'
--- a/etc/NEWS  2013-06-03 13:35:21 +0000
+++ b/etc/NEWS  2013-06-05 01:58:43 +0000
@@ -396,6 +396,10 @@
 
 * Incompatible Lisp Changes in Emacs 24.4
 
+** overriding-terminal-local-map does not replace the local keymaps any more.
+It used to disable the minor mode, major mode, and text-property keymaps,
+whereas now it simply has higher precedence.
+
 ** Default process filers and sentinels are not nil any more.
 Instead they default to a function which does what the nil value used to do.
 

=== modified file 'lisp/subr.el'
--- a/lisp/subr.el      2013-06-03 13:03:05 +0000
+++ b/lisp/subr.el      2013-06-05 01:58:43 +0000
@@ -1,4 +1,4 @@
-;;; subr.el --- basic lisp subroutines for Emacs  -*- coding: utf-8 -*-
+;;; subr.el --- basic lisp subroutines for Emacs  -*- coding: utf-8; 
lexical-binding:t -*-
 
 ;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2013 Free Software
 ;; Foundation, Inc.
@@ -39,7 +39,7 @@
   (setq custom-declare-variable-list
        (cons arguments custom-declare-variable-list)))
 
-(defmacro declare-function (fn file &optional arglist fileonly)
+(defmacro declare-function (_fn _file &optional _arglist _fileonly)
   "Tell the byte-compiler that function FN is defined, in FILE.
 Optional ARGLIST is the argument list used by the function.  The
 FILE argument is not used by the byte-compiler, but by the
@@ -1261,6 +1261,8 @@
 (make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register 
"23.1")
 (make-obsolete-variable 'deferred-action-list 'post-command-hook "24.1")
 (make-obsolete-variable 'deferred-action-function 'post-command-hook "24.1")
+(make-obsolete-variable 'overriding-local-map
+                        'overriding-terminal-local-map "24.4" 'set)
 (make-obsolete 'window-redisplay-end-trigger nil "23.1")
 (make-obsolete 'set-window-redisplay-end-trigger nil "23.1")
 
@@ -1478,11 +1480,48 @@
 
 The return value is the new value of LIST-VAR.
 
+This is handy to add some elements to configuration variables,
+but please do not abuse it in Elisp code, where you are usually better off
+using `push' or `cl-pushnew'.
+
 If you want to use `add-to-list' on a variable that is not defined
 until a certain package is loaded, you should put the call to `add-to-list'
 into a hook function that will be run only after loading the package.
 `eval-after-load' provides one way to do this.  In some cases
 other hooks, such as major mode hooks, can do the job."
+  (declare
+   (compiler-macro
+    (lambda (exp)
+      ;; FIXME: Something like this could be used for `set' as well.
+      (if (or (not (eq 'quote (car-safe list-var)))
+              (special-variable-p (cadr list-var))
+              (and append compare-fn))
+          exp
+        (let* ((sym (cadr list-var))
+               (msg (format "`add-to-list' can't use lexical var `%s'; use 
`push' or `cl-pushnew'"
+                            sym))
+               ;; Big ugly hack so we only output a warning during
+               ;; byte-compilation, and so we can use
+               ;; byte-compile-not-lexical-var-p to silence the warning
+               ;; when a defvar has been seen but not yet executed.
+               (warnfun (lambda ()
+                          ;; FIXME: We should also emit a warning for let-bound
+                          ;; variables with dynamic binding.
+                          (when (assq sym byte-compile--lexical-environment)
+                            (byte-compile-log-warning msg t :error))))
+               (code
+                (if append
+                    (macroexp-let2 macroexp-copyable-p x element
+                    `(unless (member ,x ,sym)
+                       (setq ,sym (append ,sym (list ,x)))))
+                  (require 'cl-lib)
+                  `(cl-pushnew ,element ,sym
+                               :test ,(or compare-fn '#'equal)))))
+          (if (not (macroexp--compiling-p))
+              code
+            `(progn
+               (macroexp--funcall-if-compiled ',warnfun)
+               ,code)))))))
   (if (cond
        ((null compare-fn)
        (member element (symbol-value list-var)))
@@ -2054,8 +2093,8 @@
   ;; disable quail's input methods, so although read-key-sequence
   ;; always inherits the input method, in practice read-key does not
   ;; inherit the input method (at least not if it's based on quail).
-  (let ((overriding-terminal-local-map read-key-empty-map)
-       (overriding-local-map nil)
+  (let ((overriding-terminal-local-map nil)
+       (overriding-local-map read-key-empty-map)
         (echo-keystrokes 0)
        (old-global-map (current-global-map))
         (timer (run-with-idle-timer

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-06-04 16:33:46 +0000
+++ b/src/ChangeLog     2013-06-05 01:58:43 +0000
@@ -1,3 +1,10 @@
+2013-06-05  Stefan Monnier  <address@hidden>
+
+       * keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings):
+       * keyboard.c (menu_bar_items, tool_bar_items):
+       * doc.c (Fsubstitute_command_keys): Voverriding_terminal_local_map does
+       not override local keymaps any more.
+
 2013-06-04  Eli Zaretskii  <address@hidden>
 
        * window.c (Fpos_visible_in_window_p): Doc fix.  (Bug#14540)

=== modified file 'src/doc.c'
--- a/src/doc.c 2013-05-15 20:12:53 +0000
+++ b/src/doc.c 2013-06-05 01:58:43 +0000
@@ -758,9 +758,7 @@
      or a specified local map (which means search just that and the
      global map).  If non-nil, it might come from Voverriding_local_map,
      or from a \\<mapname> construct in STRING itself..  */
-  keymap = KVAR (current_kboard, Voverriding_terminal_local_map);
-  if (NILP (keymap))
-    keymap = Voverriding_local_map;
+  keymap = Voverriding_local_map;
 
   bsize = SBYTES (string);
   bufp = buf = xmalloc (bsize);

=== modified file 'src/keyboard.c'
--- a/src/keyboard.c    2013-06-03 15:18:18 +0000
+++ b/src/keyboard.c    2013-06-05 01:58:43 +0000
@@ -7392,7 +7392,8 @@
     Lisp_Object *tmaps;
 
     /* Should overriding-terminal-local-map and overriding-local-map apply?  */
-    if (!NILP (Voverriding_local_map_menu_flag))
+    if (!NILP (Voverriding_local_map_menu_flag)
+       && !NILP (Voverriding_local_map))
       {
        /* Yes, use them (if non-nil) as well as the global map.  */
        maps = alloca (3 * sizeof (maps[0]));
@@ -7412,8 +7413,11 @@
        Lisp_Object tem;
        ptrdiff_t nminor;
        nminor = current_minor_maps (NULL, &tmaps);
-       maps = alloca ((nminor + 3) * sizeof *maps);
+       maps = alloca ((nminor + 4) * sizeof *maps);
        nmaps = 0;
+       tem = KVAR (current_kboard, Voverriding_terminal_local_map);
+       if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag))
+         maps[nmaps++] = tem;
        if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
          maps[nmaps++] = tem;
        memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
@@ -7938,7 +7942,8 @@
      to process.  */
 
   /* Should overriding-terminal-local-map and overriding-local-map apply?  */
-  if (!NILP (Voverriding_local_map_menu_flag))
+  if (!NILP (Voverriding_local_map_menu_flag)
+      && !NILP (Voverriding_local_map))
     {
       /* Yes, use them (if non-nil) as well as the global map.  */
       maps = alloca (3 * sizeof *maps);
@@ -7958,8 +7963,11 @@
       Lisp_Object tem;
       ptrdiff_t nminor;
       nminor = current_minor_maps (NULL, &tmaps);
-      maps = alloca ((nminor + 3) * sizeof *maps);
+      maps = alloca ((nminor + 4) * sizeof *maps);
       nmaps = 0;
+      tem = KVAR (current_kboard, Voverriding_terminal_local_map);
+      if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag))
+       maps[nmaps++] = tem;
       if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
        maps[nmaps++] = tem;
       memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
@@ -11443,10 +11451,7 @@
 
   DEFVAR_KBOARD ("overriding-terminal-local-map",
                 Voverriding_terminal_local_map,
-                doc: /* Per-terminal keymap that overrides all other local 
keymaps.
-If this variable is non-nil, it is used as a keymap instead of the
-buffer's local map, and the minor mode keymaps and text property keymaps.
-It also replaces `overriding-local-map'.
+                doc: /* Per-terminal keymap that takes precedence over all 
other keymaps.
 
 This variable is intended to let commands such as `universal-argument'
 set up a different keymap for reading the next command.
@@ -11456,7 +11461,7 @@
 See Info node `(elisp)Multiple Terminals'.  */);
 
   DEFVAR_LISP ("overriding-local-map", Voverriding_local_map,
-              doc: /* Keymap that overrides all other local keymaps.
+              doc: /* Keymap that overrides almost all other local keymaps.
 If this variable is non-nil, it is used as a keymap--replacing the
 buffer's local map, the minor mode keymaps, and char property keymaps.  */);
   Voverriding_local_map = Qnil;

=== modified file 'src/keymap.c'
--- a/src/keymap.c      2013-04-02 01:54:56 +0000
+++ b/src/keymap.c      2013-06-05 01:58:43 +0000
@@ -56,28 +56,28 @@
 #include "keymap.h"
 #include "window.h"
 
-/* Actually allocate storage for these variables */
-
-Lisp_Object current_global_map;        /* Current global keymap */
-
-Lisp_Object global_map;                /* default global key bindings */
+/* Actually allocate storage for these variables.  */
+
+Lisp_Object current_global_map;        /* Current global keymap.  */
+
+Lisp_Object global_map;                /* Default global key bindings.  */
 
 Lisp_Object meta_map;          /* The keymap used for globally bound
-                                  ESC-prefixed default commands */
+                                  ESC-prefixed default commands.  */
 
 Lisp_Object control_x_map;     /* The keymap used for globally bound
-                                  C-x-prefixed default commands */
+                                  C-x-prefixed default commands.  */
 
                                /* The keymap used by the minibuf for local
                                   bindings when spaces are allowed in the
-                                  minibuf */
+                                  minibuf.  */
 
                                /* The keymap used by the minibuf for local
                                   bindings when spaces are not encouraged
-                                  in the minibuf */
+                                  in the minibuf.  */
 
-/* keymap used for minibuffers when doing completion */
-/* keymap used for minibuffers when doing completion and require a match */
+/* Keymap used for minibuffers when doing completion.  */
+/* Keymap used for minibuffers when doing completion and require a match.  */
 static Lisp_Object Qkeymapp, Qnon_ascii;
 Lisp_Object Qkeymap, Qmenu_item, Qremap;
 static Lisp_Object QCadvertised_binding;
@@ -1571,17 +1571,14 @@
        }
     }
 
-  if (!NILP (olp))
-    {
-      if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
-       keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map),
-                        keymaps);
+  if (!NILP (olp)
       /* The doc said that overriding-terminal-local-map should
         override overriding-local-map.  The code used them both,
         but it seems clearer to use just one.  rms, jan 2005.  */
-      else if (!NILP (Voverriding_local_map))
-       keymaps = Fcons (Voverriding_local_map, keymaps);
-    }
+      && NILP (KVAR (current_kboard, Voverriding_terminal_local_map))
+      && !NILP (Voverriding_local_map))
+    keymaps = Fcons (Voverriding_local_map, keymaps);
+
   if (NILP (XCDR (keymaps)))
     {
       Lisp_Object *maps;
@@ -1592,6 +1589,7 @@
       Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map);
       /* This returns nil unless there is a `keymap' property.  */
       Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap);
+      Lisp_Object otlp = KVAR (current_kboard, Voverriding_terminal_local_map);
 
       if (CONSP (position))
        {
@@ -1656,6 +1654,9 @@
 
       if (!NILP (keymap))
        keymaps = Fcons (keymap, keymaps);
+
+      if (!NILP (olp) && !NILP (otlp))
+       keymaps = Fcons (otlp, keymaps);
     }
 
   unbind_to (count, Qnil);
@@ -2851,7 +2852,7 @@
 
            insert ("\n", 1);
 
-           /* Insert calls signal_after_change which may GC. */
+           /* Insert calls signal_after_change which may GC.  */
            translate = SDATA (KVAR (current_kboard, 
Vkeyboard_translate_table));
          }
 
@@ -2867,6 +2868,14 @@
   start1 = Qnil;
   if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
     start1 = KVAR (current_kboard, Voverriding_terminal_local_map);
+
+  if (!NILP (start1))
+    {
+      describe_map_tree (start1, 1, shadow, prefix,
+                        "\f\nOverriding Bindings", nomenu, 0, 0, 0);
+      shadow = Fcons (start1, shadow);
+      start1 = Qnil;
+    }
   else if (!NILP (Voverriding_local_map))
     start1 = Voverriding_local_map;
 


reply via email to

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