strange behaviour with f, r and t in evil mode: next key is taken as being a command in normal mode
Óscar Fuentes
ofv at wanadoo.es
Sun Jun 23 11:02:27 CEST 2013
Ping.
Please let me know if this is something to be fixed on Evil. If not,
I'll file a bug report on Emacs.
> Just to confirm that an older version of Emacs (snapshot from 27 May)
> works just fine with current evil from git. The problem is definitely
> with Emacs.
Bisecting Emacs points to the change below. It contains a NEWS entry
about keymaps. Maybe Evil needs to adapt to that change?
commit a760a079aba36493e9787cb7e67a511e4b69887a
Author: Stefan Monnier
Date: Tue Jun 4 21:58:43 2013 -0400
* 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.
6 files changed, 96 insertions(+), 34 deletions(-)
etc/NEWS | 4 ++++
lisp/subr.el | 47 +++++++++++++++++++++++++++++++++++++++++++----
src/ChangeLog | 7 +++++++
src/doc.c | 4 +---
src/keyboard.c | 23 ++++++++++++++---------
src/keymap.c | 45 +++++++++++++++++++++++++++------------------
Modified etc/NEWS
diff --git a/etc/NEWS b/etc/NEWS
index 45a3632..271d314 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -396,6 +396,10 @@ It is layered as:
* 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 lisp/subr.el
diff --git a/lisp/subr.el b/lisp/subr.el
index f30e6db..6d2f016 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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 @@ Each element of this list holds the arguments to one call to `defcustom'.")
(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 @@ is converted into a string by expressing it in decimal."
(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 @@ ELEMENT is added at the end.
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 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
;; 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 src/ChangeLog
diff --git a/src/ChangeLog b/src/ChangeLog
index d5c2785..34b8338 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
+2013-06-05 Stefan Monnier <monnier at iro.umontreal.ca>
+
+ * 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 <eliz at gnu.org>
* window.c (Fpos_visible_in_window_p): Doc fix. (Bug#14540)
Modified src/doc.c
diff --git a/src/doc.c b/src/doc.c
index e454819..155a989 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -758,9 +758,7 @@ Otherwise, return a new string, without any text properties. */)
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 src/keyboard.c
diff --git a/src/keyboard.c b/src/keyboard.c
index 8dd109d..d01ecb9 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7392,7 +7392,8 @@ menu_bar_items (Lisp_Object old)
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 @@ menu_bar_items (Lisp_Object old)
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 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
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 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
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 @@ tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */);
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 @@ terminal device.
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 src/keymap.c
diff --git a/src/keymap.c b/src/keymap.c
index c43d528..536db77 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -56,28 +56,28 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include "keymap.h"
#include "window.h"
-/* Actually allocate storage for these variables */
+/* Actually allocate storage for these variables. */
-Lisp_Object current_global_map; /* Current global keymap */
+Lisp_Object current_global_map; /* Current global keymap. */
-Lisp_Object global_map; /* default global key bindings */
+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 @@ like in the respective argument of `key-binding'. */)
}
}
- 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 @@ like in the respective argument of `key-binding'. */)
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 @@ like in the respective argument of `key-binding'. */)
if (!NILP (keymap))
keymaps = Fcons (keymap, keymaps);
+
+ if (!NILP (olp) && !NILP (otlp))
+ keymaps = Fcons (otlp, keymaps);
}
unbind_to (count, Qnil);
@@ -2851,7 +2852,7 @@ You type Translation\n\
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 @@ You type Translation\n\
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;
More information about the implementations-list
mailing list