Skip to content

Commit 803f525

Browse files
committed
Allow to forcibly replace a key binding
1 parent ffd6bce commit 803f525

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
@@ -623,9 +623,9 @@ See also `resize-window-stack-size'."
623623
(not (resize-window--key-element
624624
key resize-window-dispatch-alist))))
625625

626-
(defun resize-window-add-choice (key func doc &optional allows-capitals)
626+
(defun resize-window-add-choice (key func doc &optional allows-capitals force)
627627
"Register a new binding for `resize-window'.
628-
Refuses to replace an already taken key.
628+
Refuses to replace an already taken key unless FORCE is non-nil.
629629
630630
KEY is the key (e.g. ?c) that invokes the function FUNC. DOC is a
631631
docstring for the help menu. A non-nil ALLOWS-CAPITALS tells FUNC
@@ -634,6 +634,15 @@ allow capitals, otherwise to allow capitals should be of optional
634634
single arity so a capital KEY may be passed to FUNC when pressed.
635635
636636
See also `resize-window--key-str'."
637+
(when force
638+
(setq resize-window-alias-list
639+
(delq (resize-window--key-element
640+
key resize-window-alias-list)
641+
resize-window-alias-list))
642+
(setq resize-window-dispatch-alist
643+
(delq (resize-window--key-element
644+
key resize-window-dispatch-alist)
645+
resize-window-dispatch-alist)))
637646
(if (resize-window--key-available? key)
638647
(push (list key func doc allows-capitals)
639648
resize-window-dispatch-alist)

0 commit comments

Comments
 (0)