Skip to content

Fix some bugs related to repeating company-mode completion commands - #2033

Open
bcc32 wants to merge 1 commit into
emacs-evil:masterfrom
janestreet:fix-company-complete-repeat
Open

bcc32 wants to merge 1 commit into
emacs-evil:masterfrom
janestreet:fix-company-complete-repeat

Conversation

@bcc32

@bcc32 bcc32 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Repeating company-complete using evil-repeat doesn't work
correctly without some workarounds.

Prior to this PR, I identified two bugs that occur, see below for
reproduction. This change is intended to fix both issues.

When there is a common prefix to complete to

In the *scratch* buffer in lisp-interaction-mode:

(company-mode)
(evil-mode)

(keymap-set company-mode-map "TAB" #'company-complete)

;; Start at the end of the first "req" and hit TAB, which completes to
;; "require".  Hit "j ." and see that repeat doesn't work correctly.
(req)
(req)
(req)

;; Then, evaluate this and see that the above completions work
;; correctly.
(evil-declare-change-repeat #'company-complete)

When there is no common prefix

In the *scratch* buffer in lisp-interaction-mode:

(company-mode)
(evil-mode)

(keymap-set company-mode-map "TAB" #'company-complete)

;; Start at the end of the first "re" and hit TAB, then pick some completion.
;; Observe this error in the *Messages* buffer:

;; Error in post-command-hook (evil-repeat-post-hook): (wrong-type-argument number-or-marker-p nil)

(re)
(re)
(re)

@bcc32

bcc32 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

For context, the post-command-hook issue happens because company-complete uses call-interactively and that causes this-command to be different betwen the pre- and post-hooks. See company-mode/company-mode#383

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant