Mercurial > emacs
comparison lisp/subr.el @ 100699:ad20c1d5df89
(keymap-canonicalize): Properly preserve keymap prompt.
author | Andreas Schwab <schwab@suse.de> |
---|---|
date | Fri, 26 Dec 2008 16:49:30 +0000 |
parents | 5478b71d59c6 |
children | 2935e76b69a8 |
comparison
equal
deleted
inserted
replaced
100698:2ff8670c7e9f | 100699:ad20c1d5df89 |
---|---|
556 (funcall function (car p) (cdr p))))) | 556 (funcall function (car p) (cdr p))))) |
557 | 557 |
558 (defun keymap-canonicalize (map) | 558 (defun keymap-canonicalize (map) |
559 "Return an equivalent keymap, without inheritance." | 559 "Return an equivalent keymap, without inheritance." |
560 (let ((bindings ()) | 560 (let ((bindings ()) |
561 (ranges ())) | 561 (ranges ()) |
562 (prompt (keymap-prompt map))) | |
562 (while (keymapp map) | 563 (while (keymapp map) |
563 (setq map (map-keymap-internal | 564 (setq map (map-keymap-internal |
564 (lambda (key item) | 565 (lambda (key item) |
565 (if (consp key) | 566 (if (consp key) |
566 ;; Treat char-ranges specially. | 567 ;; Treat char-ranges specially. |
567 (push (cons key item) ranges) | 568 (push (cons key item) ranges) |
568 (push (cons key item) bindings))) | 569 (push (cons key item) bindings))) |
569 map))) | 570 map))) |
570 (setq map (funcall (if ranges 'make-keymap 'make-sparse-keymap) | 571 (setq map (funcall (if ranges 'make-keymap 'make-sparse-keymap) prompt)) |
571 (keymap-prompt map))) | |
572 (dolist (binding ranges) | 572 (dolist (binding ranges) |
573 ;; Treat char-ranges specially. | 573 ;; Treat char-ranges specially. |
574 (define-key map (vector (car binding)) (cdr binding))) | 574 (define-key map (vector (car binding)) (cdr binding))) |
575 (dolist (binding (prog1 bindings (setq bindings ()))) | 575 (dolist (binding (prog1 bindings (setq bindings ()))) |
576 (let* ((key (car binding)) | 576 (let* ((key (car binding)) |