Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bpsm/40232 to your computer and use it in GitHub Desktop.
Save bpsm/40232 to your computer and use it in GitHub Desktop.
From 3ba1fbf6833c21724659646518a4b999d783840d Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@suse.de>
Date: Fri, 26 Dec 2008 16:49:30 +0000
Subject: [PATCH] (keymap-canonicalize): Properly preserve keymap prompt.
---
lisp/ChangeLog | 2 ++
lisp/subr.el | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 35495c4..a046cbf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,7 @@
2008-12-26 Andreas Schwab <schwab@suse.de>
+ * subr.el (keymap-canonicalize): Properly preserve keymap prompt.
+
* tar-mode.el (tar-swap-data): New function.
(tar-change-major-mode-hook): Use it instead of buffer-swap-text.
(tar-mode-revert): Likewise.
diff --git a/lisp/subr.el b/lisp/subr.el
index a7027b4..7c8f844 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -558,7 +558,8 @@ Don't call this function; it is for internal use only."
(defun keymap-canonicalize (map)
"Return an equivalent keymap, without inheritance."
(let ((bindings ())
- (ranges ()))
+ (ranges ())
+ (prompt (keymap-prompt map)))
(while (keymapp map)
(setq map (map-keymap-internal
(lambda (key item)
@@ -567,8 +568,7 @@ Don't call this function; it is for internal use only."
(push (cons key item) ranges)
(push (cons key item) bindings)))
map)))
- (setq map (funcall (if ranges 'make-keymap 'make-sparse-keymap)
- (keymap-prompt map)))
+ (setq map (funcall (if ranges 'make-keymap 'make-sparse-keymap) prompt))
(dolist (binding ranges)
;; Treat char-ranges specially.
(define-key map (vector (car binding)) (cdr binding)))
--
1.6.0.3+GitX
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment