aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/subr.el47
-rw-r--r--src/ChangeLog7
-rw-r--r--src/doc.c4
-rw-r--r--src/keyboard.c23
-rw-r--r--src/keymap.c45
6 files changed, 96 insertions, 34 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 45a3632f5c9..271d3148b0b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -396,6 +396,10 @@ It is layered as:
396 396
397* Incompatible Lisp Changes in Emacs 24.4 397* Incompatible Lisp Changes in Emacs 24.4
398 398
399** overriding-terminal-local-map does not replace the local keymaps any more.
400It used to disable the minor mode, major mode, and text-property keymaps,
401whereas now it simply has higher precedence.
402
399** Default process filers and sentinels are not nil any more. 403** Default process filers and sentinels are not nil any more.
400Instead they default to a function which does what the nil value used to do. 404Instead they default to a function which does what the nil value used to do.
401 405
diff --git a/lisp/subr.el b/lisp/subr.el
index f30e6db3a1f..6d2f0161b1f 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1,4 +1,4 @@
1;;; subr.el --- basic lisp subroutines for Emacs -*- coding: utf-8 -*- 1;;; subr.el --- basic lisp subroutines for Emacs -*- coding: utf-8; lexical-binding:t -*-
2 2
3;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2013 Free Software 3;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2013 Free Software
4;; Foundation, Inc. 4;; Foundation, Inc.
@@ -39,7 +39,7 @@ Each element of this list holds the arguments to one call to `defcustom'.")
39 (setq custom-declare-variable-list 39 (setq custom-declare-variable-list
40 (cons arguments custom-declare-variable-list))) 40 (cons arguments custom-declare-variable-list)))
41 41
42(defmacro declare-function (fn file &optional arglist fileonly) 42(defmacro declare-function (_fn _file &optional _arglist _fileonly)
43 "Tell the byte-compiler that function FN is defined, in FILE. 43 "Tell the byte-compiler that function FN is defined, in FILE.
44Optional ARGLIST is the argument list used by the function. The 44Optional ARGLIST is the argument list used by the function. The
45FILE argument is not used by the byte-compiler, but by the 45FILE 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."
1261(make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register "23.1") 1261(make-obsolete-variable 'redisplay-end-trigger-functions 'jit-lock-register "23.1")
1262(make-obsolete-variable 'deferred-action-list 'post-command-hook "24.1") 1262(make-obsolete-variable 'deferred-action-list 'post-command-hook "24.1")
1263(make-obsolete-variable 'deferred-action-function 'post-command-hook "24.1") 1263(make-obsolete-variable 'deferred-action-function 'post-command-hook "24.1")
1264(make-obsolete-variable 'overriding-local-map
1265 'overriding-terminal-local-map "24.4" 'set)
1264(make-obsolete 'window-redisplay-end-trigger nil "23.1") 1266(make-obsolete 'window-redisplay-end-trigger nil "23.1")
1265(make-obsolete 'set-window-redisplay-end-trigger nil "23.1") 1267(make-obsolete 'set-window-redisplay-end-trigger nil "23.1")
1266 1268
@@ -1478,11 +1480,48 @@ ELEMENT is added at the end.
1478 1480
1479The return value is the new value of LIST-VAR. 1481The return value is the new value of LIST-VAR.
1480 1482
1483This is handy to add some elements to configuration variables,
1484but please do not abuse it in Elisp code, where you are usually better off
1485using `push' or `cl-pushnew'.
1486
1481If you want to use `add-to-list' on a variable that is not defined 1487If you want to use `add-to-list' on a variable that is not defined
1482until a certain package is loaded, you should put the call to `add-to-list' 1488until a certain package is loaded, you should put the call to `add-to-list'
1483into a hook function that will be run only after loading the package. 1489into a hook function that will be run only after loading the package.
1484`eval-after-load' provides one way to do this. In some cases 1490`eval-after-load' provides one way to do this. In some cases
1485other hooks, such as major mode hooks, can do the job." 1491other hooks, such as major mode hooks, can do the job."
1492 (declare
1493 (compiler-macro
1494 (lambda (exp)
1495 ;; FIXME: Something like this could be used for `set' as well.
1496 (if (or (not (eq 'quote (car-safe list-var)))
1497 (special-variable-p (cadr list-var))
1498 (and append compare-fn))
1499 exp
1500 (let* ((sym (cadr list-var))
1501 (msg (format "`add-to-list' can't use lexical var `%s'; use `push' or `cl-pushnew'"
1502 sym))
1503 ;; Big ugly hack so we only output a warning during
1504 ;; byte-compilation, and so we can use
1505 ;; byte-compile-not-lexical-var-p to silence the warning
1506 ;; when a defvar has been seen but not yet executed.
1507 (warnfun (lambda ()
1508 ;; FIXME: We should also emit a warning for let-bound
1509 ;; variables with dynamic binding.
1510 (when (assq sym byte-compile--lexical-environment)
1511 (byte-compile-log-warning msg t :error))))
1512 (code
1513 (if append
1514 (macroexp-let2 macroexp-copyable-p x element
1515 `(unless (member ,x ,sym)
1516 (setq ,sym (append ,sym (list ,x)))))
1517 (require 'cl-lib)
1518 `(cl-pushnew ,element ,sym
1519 :test ,(or compare-fn '#'equal)))))
1520 (if (not (macroexp--compiling-p))
1521 code
1522 `(progn
1523 (macroexp--funcall-if-compiled ',warnfun)
1524 ,code)))))))
1486 (if (cond 1525 (if (cond
1487 ((null compare-fn) 1526 ((null compare-fn)
1488 (member element (symbol-value list-var))) 1527 (member element (symbol-value list-var)))
@@ -2054,8 +2093,8 @@ some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
2054 ;; disable quail's input methods, so although read-key-sequence 2093 ;; disable quail's input methods, so although read-key-sequence
2055 ;; always inherits the input method, in practice read-key does not 2094 ;; always inherits the input method, in practice read-key does not
2056 ;; inherit the input method (at least not if it's based on quail). 2095 ;; inherit the input method (at least not if it's based on quail).
2057 (let ((overriding-terminal-local-map read-key-empty-map) 2096 (let ((overriding-terminal-local-map nil)
2058 (overriding-local-map nil) 2097 (overriding-local-map read-key-empty-map)
2059 (echo-keystrokes 0) 2098 (echo-keystrokes 0)
2060 (old-global-map (current-global-map)) 2099 (old-global-map (current-global-map))
2061 (timer (run-with-idle-timer 2100 (timer (run-with-idle-timer
diff --git a/src/ChangeLog b/src/ChangeLog
index 0914d8efac0..bfb9b1a4c83 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12013-06-05 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * keymap.c (Fcurrent_active_maps, Fdescribe_buffer_bindings):
4 * keyboard.c (menu_bar_items, tool_bar_items):
5 * doc.c (Fsubstitute_command_keys): Voverriding_terminal_local_map does
6 not override local keymaps any more.
7
12013-06-04 Eli Zaretskii <eliz@gnu.org> 82013-06-04 Eli Zaretskii <eliz@gnu.org>
2 9
3 * window.c (Fpos_visible_in_window_p): Doc fix. (Bug#14540) 10 * window.c (Fpos_visible_in_window_p): Doc fix. (Bug#14540)
diff --git a/src/doc.c b/src/doc.c
index e45481944f0..155a9891303 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -758,9 +758,7 @@ Otherwise, return a new string, without any text properties. */)
758 or a specified local map (which means search just that and the 758 or a specified local map (which means search just that and the
759 global map). If non-nil, it might come from Voverriding_local_map, 759 global map). If non-nil, it might come from Voverriding_local_map,
760 or from a \\<mapname> construct in STRING itself.. */ 760 or from a \\<mapname> construct in STRING itself.. */
761 keymap = KVAR (current_kboard, Voverriding_terminal_local_map); 761 keymap = Voverriding_local_map;
762 if (NILP (keymap))
763 keymap = Voverriding_local_map;
764 762
765 bsize = SBYTES (string); 763 bsize = SBYTES (string);
766 bufp = buf = xmalloc (bsize); 764 bufp = buf = xmalloc (bsize);
diff --git a/src/keyboard.c b/src/keyboard.c
index 8dd109d252d..d01ecb9432b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7392,7 +7392,8 @@ menu_bar_items (Lisp_Object old)
7392 Lisp_Object *tmaps; 7392 Lisp_Object *tmaps;
7393 7393
7394 /* Should overriding-terminal-local-map and overriding-local-map apply? */ 7394 /* Should overriding-terminal-local-map and overriding-local-map apply? */
7395 if (!NILP (Voverriding_local_map_menu_flag)) 7395 if (!NILP (Voverriding_local_map_menu_flag)
7396 && !NILP (Voverriding_local_map))
7396 { 7397 {
7397 /* Yes, use them (if non-nil) as well as the global map. */ 7398 /* Yes, use them (if non-nil) as well as the global map. */
7398 maps = alloca (3 * sizeof (maps[0])); 7399 maps = alloca (3 * sizeof (maps[0]));
@@ -7412,8 +7413,11 @@ menu_bar_items (Lisp_Object old)
7412 Lisp_Object tem; 7413 Lisp_Object tem;
7413 ptrdiff_t nminor; 7414 ptrdiff_t nminor;
7414 nminor = current_minor_maps (NULL, &tmaps); 7415 nminor = current_minor_maps (NULL, &tmaps);
7415 maps = alloca ((nminor + 3) * sizeof *maps); 7416 maps = alloca ((nminor + 4) * sizeof *maps);
7416 nmaps = 0; 7417 nmaps = 0;
7418 tem = KVAR (current_kboard, Voverriding_terminal_local_map);
7419 if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag))
7420 maps[nmaps++] = tem;
7417 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) 7421 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
7418 maps[nmaps++] = tem; 7422 maps[nmaps++] = tem;
7419 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); 7423 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
@@ -7938,7 +7942,8 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
7938 to process. */ 7942 to process. */
7939 7943
7940 /* Should overriding-terminal-local-map and overriding-local-map apply? */ 7944 /* Should overriding-terminal-local-map and overriding-local-map apply? */
7941 if (!NILP (Voverriding_local_map_menu_flag)) 7945 if (!NILP (Voverriding_local_map_menu_flag)
7946 && !NILP (Voverriding_local_map))
7942 { 7947 {
7943 /* Yes, use them (if non-nil) as well as the global map. */ 7948 /* Yes, use them (if non-nil) as well as the global map. */
7944 maps = alloca (3 * sizeof *maps); 7949 maps = alloca (3 * sizeof *maps);
@@ -7958,8 +7963,11 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
7958 Lisp_Object tem; 7963 Lisp_Object tem;
7959 ptrdiff_t nminor; 7964 ptrdiff_t nminor;
7960 nminor = current_minor_maps (NULL, &tmaps); 7965 nminor = current_minor_maps (NULL, &tmaps);
7961 maps = alloca ((nminor + 3) * sizeof *maps); 7966 maps = alloca ((nminor + 4) * sizeof *maps);
7962 nmaps = 0; 7967 nmaps = 0;
7968 tem = KVAR (current_kboard, Voverriding_terminal_local_map);
7969 if (!NILP (tem) && !NILP (Voverriding_local_map_menu_flag))
7970 maps[nmaps++] = tem;
7963 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem)) 7971 if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
7964 maps[nmaps++] = tem; 7972 maps[nmaps++] = tem;
7965 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0])); 7973 memcpy (maps + nmaps, tmaps, nminor * sizeof (maps[0]));
@@ -11443,10 +11451,7 @@ tool-bar separators natively. Otherwise it is unused (e.g. on GTK). */);
11443 11451
11444 DEFVAR_KBOARD ("overriding-terminal-local-map", 11452 DEFVAR_KBOARD ("overriding-terminal-local-map",
11445 Voverriding_terminal_local_map, 11453 Voverriding_terminal_local_map,
11446 doc: /* Per-terminal keymap that overrides all other local keymaps. 11454 doc: /* Per-terminal keymap that takes precedence over all other keymaps.
11447If this variable is non-nil, it is used as a keymap instead of the
11448buffer's local map, and the minor mode keymaps and text property keymaps.
11449It also replaces `overriding-local-map'.
11450 11455
11451This variable is intended to let commands such as `universal-argument' 11456This variable is intended to let commands such as `universal-argument'
11452set up a different keymap for reading the next command. 11457set up a different keymap for reading the next command.
@@ -11456,7 +11461,7 @@ terminal device.
11456See Info node `(elisp)Multiple Terminals'. */); 11461See Info node `(elisp)Multiple Terminals'. */);
11457 11462
11458 DEFVAR_LISP ("overriding-local-map", Voverriding_local_map, 11463 DEFVAR_LISP ("overriding-local-map", Voverriding_local_map,
11459 doc: /* Keymap that overrides all other local keymaps. 11464 doc: /* Keymap that overrides almost all other local keymaps.
11460If this variable is non-nil, it is used as a keymap--replacing the 11465If this variable is non-nil, it is used as a keymap--replacing the
11461buffer's local map, the minor mode keymaps, and char property keymaps. */); 11466buffer's local map, the minor mode keymaps, and char property keymaps. */);
11462 Voverriding_local_map = Qnil; 11467 Voverriding_local_map = Qnil;
diff --git a/src/keymap.c b/src/keymap.c
index c43d528b25b..536db77f59b 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/>. */
56#include "keymap.h" 56#include "keymap.h"
57#include "window.h" 57#include "window.h"
58 58
59/* Actually allocate storage for these variables */ 59/* Actually allocate storage for these variables. */
60 60
61Lisp_Object current_global_map; /* Current global keymap */ 61Lisp_Object current_global_map; /* Current global keymap. */
62 62
63Lisp_Object global_map; /* default global key bindings */ 63Lisp_Object global_map; /* Default global key bindings. */
64 64
65Lisp_Object meta_map; /* The keymap used for globally bound 65Lisp_Object meta_map; /* The keymap used for globally bound
66 ESC-prefixed default commands */ 66 ESC-prefixed default commands. */
67 67
68Lisp_Object control_x_map; /* The keymap used for globally bound 68Lisp_Object control_x_map; /* The keymap used for globally bound
69 C-x-prefixed default commands */ 69 C-x-prefixed default commands. */
70 70
71 /* The keymap used by the minibuf for local 71 /* The keymap used by the minibuf for local
72 bindings when spaces are allowed in the 72 bindings when spaces are allowed in the
73 minibuf */ 73 minibuf. */
74 74
75 /* The keymap used by the minibuf for local 75 /* The keymap used by the minibuf for local
76 bindings when spaces are not encouraged 76 bindings when spaces are not encouraged
77 in the minibuf */ 77 in the minibuf. */
78 78
79/* keymap used for minibuffers when doing completion */ 79/* Keymap used for minibuffers when doing completion. */
80/* keymap used for minibuffers when doing completion and require a match */ 80/* Keymap used for minibuffers when doing completion and require a match. */
81static Lisp_Object Qkeymapp, Qnon_ascii; 81static Lisp_Object Qkeymapp, Qnon_ascii;
82Lisp_Object Qkeymap, Qmenu_item, Qremap; 82Lisp_Object Qkeymap, Qmenu_item, Qremap;
83static Lisp_Object QCadvertised_binding; 83static Lisp_Object QCadvertised_binding;
@@ -1571,17 +1571,14 @@ like in the respective argument of `key-binding'. */)
1571 } 1571 }
1572 } 1572 }
1573 1573
1574 if (!NILP (olp)) 1574 if (!NILP (olp)
1575 {
1576 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
1577 keymaps = Fcons (KVAR (current_kboard, Voverriding_terminal_local_map),
1578 keymaps);
1579 /* The doc said that overriding-terminal-local-map should 1575 /* The doc said that overriding-terminal-local-map should
1580 override overriding-local-map. The code used them both, 1576 override overriding-local-map. The code used them both,
1581 but it seems clearer to use just one. rms, jan 2005. */ 1577 but it seems clearer to use just one. rms, jan 2005. */
1582 else if (!NILP (Voverriding_local_map)) 1578 && NILP (KVAR (current_kboard, Voverriding_terminal_local_map))
1583 keymaps = Fcons (Voverriding_local_map, keymaps); 1579 && !NILP (Voverriding_local_map))
1584 } 1580 keymaps = Fcons (Voverriding_local_map, keymaps);
1581
1585 if (NILP (XCDR (keymaps))) 1582 if (NILP (XCDR (keymaps)))
1586 { 1583 {
1587 Lisp_Object *maps; 1584 Lisp_Object *maps;
@@ -1592,6 +1589,7 @@ like in the respective argument of `key-binding'. */)
1592 Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map); 1589 Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map);
1593 /* This returns nil unless there is a `keymap' property. */ 1590 /* This returns nil unless there is a `keymap' property. */
1594 Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap); 1591 Lisp_Object keymap = get_local_map (pt, current_buffer, Qkeymap);
1592 Lisp_Object otlp = KVAR (current_kboard, Voverriding_terminal_local_map);
1595 1593
1596 if (CONSP (position)) 1594 if (CONSP (position))
1597 { 1595 {
@@ -1656,6 +1654,9 @@ like in the respective argument of `key-binding'. */)
1656 1654
1657 if (!NILP (keymap)) 1655 if (!NILP (keymap))
1658 keymaps = Fcons (keymap, keymaps); 1656 keymaps = Fcons (keymap, keymaps);
1657
1658 if (!NILP (olp) && !NILP (otlp))
1659 keymaps = Fcons (otlp, keymaps);
1659 } 1660 }
1660 1661
1661 unbind_to (count, Qnil); 1662 unbind_to (count, Qnil);
@@ -2851,7 +2852,7 @@ You type Translation\n\
2851 2852
2852 insert ("\n", 1); 2853 insert ("\n", 1);
2853 2854
2854 /* Insert calls signal_after_change which may GC. */ 2855 /* Insert calls signal_after_change which may GC. */
2855 translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table)); 2856 translate = SDATA (KVAR (current_kboard, Vkeyboard_translate_table));
2856 } 2857 }
2857 2858
@@ -2867,6 +2868,14 @@ You type Translation\n\
2867 start1 = Qnil; 2868 start1 = Qnil;
2868 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map))) 2869 if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
2869 start1 = KVAR (current_kboard, Voverriding_terminal_local_map); 2870 start1 = KVAR (current_kboard, Voverriding_terminal_local_map);
2871
2872 if (!NILP (start1))
2873 {
2874 describe_map_tree (start1, 1, shadow, prefix,
2875 "\f\nOverriding Bindings", nomenu, 0, 0, 0);
2876 shadow = Fcons (start1, shadow);
2877 start1 = Qnil;
2878 }
2870 else if (!NILP (Voverriding_local_map)) 2879 else if (!NILP (Voverriding_local_map))
2871 start1 = Voverriding_local_map; 2880 start1 = Voverriding_local_map;
2872 2881