Files
.emacs.d/modules/completion/siren-company.el
Jim Myhrberg fe6a4e7ce5 fix(elisp): add lexical-binding comment to all files to suppress new Emacs 31 warnings
I've set `lexical-binding` to `nil` in all Emacs Lisp files to suppress
the warnings introduced in Emacs 31 requiring all elisp files to have a
`lexical-binding` comment.

This retains the default behavior of dynamic binding when no
`lexical-binding` comment is present. With it set to `t` across the
board, various things break, and fixing those is a task for another day.
2025-06-29 12:23:03 +01:00

51 lines
1.5 KiB
EmacsLisp

;;; siren-company.el --- jimeh's Emacs Siren: company configuration. -*- lexical-binding: nil; -*-
;;; Commentary:
;; Basic configuration for company. Auto completion on steroids.
;;; Code:
(use-package company
:general
;; Enable indent and complete at point functionality by pressing tab.
("TAB" 'company-indent-or-complete-common)
;; Scroll through company suggestions with C-n and C-p.
(:keymaps 'company-active-map
"C-n" 'company-select-next
"C-p" 'company-select-previous
"<tab>" 'company-complete-selection)
:custom
(company-begin-commands '(self-insert-command))
(company-dabbrev-downcase nil)
(company-echo-delay 0.01)
(company-idle-delay 0.2)
(company-minimum-prefix-length 2)
(company-tooltip-limit 20)
;; invert the navigation direction if the the completion popup-isearch-match
;; is displayed on top (happens near the bottom of windows)
(company-tooltip-flip-when-above t)
:hook
(lsp-completion-mode . siren-company-lsp-mode-setup)
:preface
(defun siren-company-lsp-mode-setup ()
(setq-local company-backends '(company-capf)))
:config
(global-company-mode 1)
;; Disable tab and backtab keybindings in company-active-map, as they are used
;; for Copilot completion, and we have a global TAB keybinding for triggering
;; and accepting company-mode completions.
(unbind-key "<backtab>" company-active-map))
(use-package company-box
:if window-system
:hook (company-mode . company-box-mode))
(provide 'siren-company)
;;; siren-company.el ends here