Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Commit

Permalink
Fix paging when used with God mode
Browse files Browse the repository at this point in the history
  • Loading branch information
darth10 committed Jun 15, 2020
1 parent cf0a453 commit 87badef
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions which-key.el
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,19 @@ problems at github.")
(when (bound-and-true-p which-key-mode)
(which-key--hide-popup))))

(defun which-key--god-mode-help-char-dispatch (orig-fn &rest args)
"Advice function for `god-mode-help-char-dispatch'."
(message "DEBUG: Advice called")
(if (not (which-key--popup-showing-p))
(apply orig-fn args)
(which-key-C-h-dispatch)
;; Discard last prefix input. `discard-input' cannot be used
;; here as it ends any macro being defined.
(setq unread-command-events nil)
;; Return keys entered so far to prevent quitting current key
;; sequence.
(cadr args)))

(defun which-key-enable-god-mode-support (&optional disable)
"Enable support for god-mode if non-nil. This is experimental,
so you need to explicitly opt-in for now. Please report any
Expand All @@ -779,9 +792,13 @@ problems at github. If DISABLE is non-nil disable support."
(setq which-key--god-mode-support-enabled (null disable))
(cond (which-key--god-mode-support-enabled
(advice-add 'god-mode-lookup-command
:around #'which-key--god-mode-lookup-command-advice))
:around #'which-key--god-mode-lookup-command-advice)
(advice-add 'god-mode-help-char-dispatch
:around #'which-key--god-mode-help-char-dispatch))
(t (advice-remove 'god-mode-lookup-command
#'which-key--god-mode-lookup-command-advice))))
#'which-key--god-mode-lookup-command-advice)
(advice-remove 'god-mode-help-char-dispatch
#'which-key--god-mode-help-char-dispatch))))

;;; Mode

Expand Down

0 comments on commit 87badef

Please sign in to comment.