Skip to content

Commit f9ce04c

Browse files
committed
Allow to forcibly replace a key binding
1 parent ae07d0b commit f9ce04c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

resize-window.el

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,9 @@ See also `resize-window-stack-size'."
632632
(not (resize-window--key-element
633633
key resize-window-dispatch-alist))))
634634

635-
(defun resize-window-add-choice (key func doc &optional allows-capitals)
635+
(defun resize-window-add-choice (key func doc &optional allows-capitals force)
636636
"Register a new binding for `resize-window'.
637-
Refuses to replace an already taken key.
637+
Refuses to replace an already taken key unless FORCE is non-nil.
638638
639639
KEY is the key (e.g. ?c) that invokes the function FUNC. DOC is a
640640
docstring for the help menu. A non-nil ALLOWS-CAPITALS tells FUNC
@@ -643,6 +643,15 @@ allow capitals, otherwise to allow capitals should be of optional
643643
single arity so a capital KEY may be passed to FUNC when pressed.
644644
645645
See also `resize-window--key-str'."
646+
(when force
647+
(setq resize-window-alias-list
648+
(delq (resize-window--key-element
649+
key resize-window-alias-list)
650+
resize-window-alias-list))
651+
(setq resize-window-dispatch-alist
652+
(delq (resize-window--key-element
653+
key resize-window-dispatch-alist)
654+
resize-window-dispatch-alist)))
646655
(if (resize-window--key-available? key)
647656
(push (list key func doc allows-capitals)
648657
resize-window-dispatch-alist)

0 commit comments

Comments
 (0)