Skip to content

Commit b843dd1

Browse files
committed
Allow to forcibly replace a key binding
1 parent 3d608ba commit b843dd1

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
@@ -631,9 +631,9 @@ See also `resize-window-stack-size'."
631631
(not (resize-window--key-element
632632
key resize-window-dispatch-alist))))
633633

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

0 commit comments

Comments
 (0)