-(defun keymap-parent (keymap)
- (let ((tail (cdr keymap)))
- (while (and tail (not (eq (car tail) 'keymap)))
- (setq tail (cdr tail)))
- tail))
-
-(defun set-keymap-parent (keymap new-parent)
- (let ((tail keymap))
- (while (and tail (cdr tail) (not (eq (car (cdr tail)) 'keymap)))
- (setq tail (cdr tail)))
- (if tail
- (setcdr tail new-parent))))
-
-(defun remprop (symbol prop)
- (let ((plist (symbol-plist symbol)))
- (while (eq (car plist) prop)
- (setplist symbol (setq plist (cdr (cdr plist)))))
- (while plist
- (if (eq (nth 2 plist) prop)
- (setcdr (cdr plist) (nthcdr 4 plist)))
- (setq plist (cdr (cdr plist))))))
+;; In case cl-map-keymap is an alias for map-keymap, avoid circular calls.
+(fset 'cl-map-keymap (indirect-function 'cl-map-keymap))