Change back to corfu (crash was GTK3 mem leak)

This commit is contained in:
Alexander Rosenberg 2024-10-02 17:00:28 -07:00
parent ea8d6bfe57
commit a5672f9284
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 70 additions and 105 deletions

View File

@ -109,72 +109,39 @@
;; "Hook to do stuff in llama buffers." ;; "Hook to do stuff in llama buffers."
;; (auto-fill-mode -1))) ;; (auto-fill-mode -1)))
;; sly ;; company (in buffer auto-complete)
;; (use-package sly ;; (use-package company
;; :hook (lisp-mode . my/-lisp-mode-autoconnect-sly) ;; :defer nil
;; :bind (:map sly-mode-map ;; :bind (("M-TAB" . company-complete)
;; ("C-c e" . my/sly-show-notes-at-point)) ;; ("M-<tab>" . company-complete)
;; :autoload sly-connected-p ;; ("C-c f" . company-files)
;; :init ;; ([remap dabbrev-expand] . company-dabbrev)
;; (defun my/-lisp-mode-autoconnect-sly () ;; :map prog-mode-map
;; (unless (sly-connected-p) ;; ([remap company-dabbrev] . company-dabbrev-code))
;; (sly))) ;; :hook ((company-search-mode . my/-company-search-mode-add-lighter)
;; (defun my/sly-notes-at-point (pos &optional buffer) ;; (sh-mode . my/-company-setup-shell-mode))
;; "Returns the sly notes at POS in BUFFER.
;; If BUFFER is nil, the current buffer is used."
;; (with-current-buffer (or buffer (current-buffer))
;; (cl-loop for overlay in (overlays-at pos)
;; for note = (overlay-get overlay 'sly-note)
;; when note
;; collect note)))
;; (defun my/sly-show-notes-at-point ()
;; "Show all sly notes at point in a floating window."
;; (interactive)
;; (my/floating-tooltip " *sly-note-posframe*"
;; (with-output-to-string
;; (dolist (note (my/sly-notes-at-point (point)))
;; (when-let (msg (plist-get note :message))
;; (princ "·")
;; (princ msg)
;; (terpri))))))
;; (setq inferior-lisp-program "/usr/bin/sbcl")
;; :config ;; :config
;; (sly-symbol-completion-mode -1)) ;; (defun my/-company-setup-shell-mode ()
;; (setq-local company-backends '(company-files company-keywords
;; corfu (autocomplete) ;; company-dabbrev-code)))
;; (use-package corfu ;; (defun my/-company-search-mode-add-lighter ()
;; :bind (("M-<tab>" . completion-at-point) ;; (if company-search-mode
;; :map corfu-map ;; (cl-pushnew company-search-lighter global-mode-string :test 'equal)
;; ("M-SPC" . corfu-insert-separator) ;; (setq global-mode-string
;; ("M-m" . my/corfu-move-to-minibuffer)) ;; (cl-delete company-search-lighter global-mode-string :test 'equal))))
;; :init ;; (defun my/-company-set-completion-styles (oldfun &rest args)
;; (defun my/corfu-move-to-minibuffer () ;; (let ((completion-styles '(basic emacs21 flex)))
;; (interactive) ;; (apply oldfun args)))
;; (when completion-in-region--data ;; (advice-add 'company-capf :around 'my/-company-set-completion-styles)
;; (let ((completion-extra-properties corfu--extra) ;; (setopt company-format-margin-function #'company-text-icons-margin
;; completion-cycle-threshold completion-cycling) ;; company-require-match nil
;; (apply #'consult-completion-in-region completion-in-region--data)))) ;; company-tooltip-align-annotations t)
;; (setq corfu-cycle t ;; (setq company-transformers '(company-sort-by-occurrence))
;; corfu-auto t ;; (global-company-mode 1))
;; corfu-on-exact-match nil ;; (use-package company-quickhelp
;; completion-cycle-threshold nil) ;; :bind (:map company-active-map
;; (global-corfu-mode 1) ;; ("M-h" . company-quickhelp-manual-begin))
;; (corfu-popupinfo-mode 1) ;; :after company
;; :config ;; :config
;; (add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer)) ;; (company-quickhelp-mode 1)
;; (use-package corfu-terminal ;; (setopt company-quickhelp-delay nil))
;; :init
;; (corfu-terminal-mode 1))
;; ;; cape (a bunch of capfs!)
;; (use-package cape
;; :bind (("C-c p" . cape-dabbrev)
;; ([remap dabbrev-expand] . cape-dabbrev)
;; ("C-c P" . cape-line)
;; ("C-c f" . cape-file))
;; :hook (text-mode . my/-cape-setup-text-mode)
;; :init
;; (defun my/-cape-setup-text-mode ()
;; (setq-local completion-at-point-functions
;; '(cape-dict cape-dabbrev)
;; corfu-auto nil)))

74
init.el
View File

@ -522,9 +522,6 @@ visual states."
("M-g i" . consult-imenu) ("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi) ("M-g I" . consult-imenu-multi)
("M-g r" . consult-imenu-multi) ("M-g r" . consult-imenu-multi)
;; these are so that you can still newline even if a completion popup is open
("C-RET" . newline)
("C-<return>" . newline)
:map help-map :map help-map
("TAB". consult-info) ("TAB". consult-info)
("C-m" . consult-man)) ("C-m" . consult-man))
@ -543,42 +540,43 @@ visual states."
(use-package embark-consult (use-package embark-consult
:hook (embark-collect-mode . consult-preview-at-point-mode)) :hook (embark-collect-mode . consult-preview-at-point-mode))
;; company (in buffer auto-complete) ;; corfu (autocomplete)
(use-package company (use-package corfu
:defer nil :bind (("M-<tab>" . completion-at-point)
:bind (("M-TAB" . company-complete) :map corfu-map
("M-<tab>" . company-complete) ("M-SPC" . corfu-insert-separator)
("C-c f" . company-files) ("M-m" . my/corfu-move-to-minibuffer))
([remap dabbrev-expand] . company-dabbrev) :init
:map prog-mode-map (defun my/corfu-move-to-minibuffer ()
([remap company-dabbrev] . company-dabbrev-code)) (interactive)
:hook ((company-search-mode . my/-company-search-mode-add-lighter) (when completion-in-region--data
(sh-mode . my/-company-setup-shell-mode)) (let ((completion-extra-properties corfu--extra)
(completion-cycle-threshold completion-cycling))
(apply #'consult-completion-in-region completion-in-region--data))))
(setq corfu-cycle t
corfu-auto t
corfu-on-exact-match nil
completion-cycle-threshold nil)
(global-corfu-mode 1)
(corfu-popupinfo-mode 1)
:config :config
(defun my/-company-setup-shell-mode () (add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer))
(setq-local company-backends '(company-files company-keywords (use-package corfu-terminal
company-dabbrev-code))) :init
(defun my/-company-search-mode-add-lighter () (corfu-terminal-mode 1))
(if company-search-mode
(cl-pushnew company-search-lighter global-mode-string :test 'equal) ;; cape (a bunch of capfs!)
(setq global-mode-string (use-package cape
(cl-delete company-search-lighter global-mode-string :test 'equal)))) :bind (("C-c p" . cape-dabbrev)
(defun my/-company-set-completion-styles (oldfun &rest args) ([remap dabbrev-expand] . cape-dabbrev)
(let ((completion-styles '(basic emacs21 flex))) ("C-c P" . cape-line)
(apply oldfun args))) ("C-c f" . cape-file))
(advice-add 'company-capf :around 'my/-company-set-completion-styles) :hook (text-mode . my/-cape-setup-text-mode)
(setopt company-format-margin-function #'company-text-icons-margin :init
company-require-match nil (defun my/-cape-setup-text-mode ()
company-tooltip-align-annotations t) (setq-local completion-at-point-functions
(setq company-transformers '(company-sort-by-occurrence)) '(cape-dict cape-dabbrev)
(global-company-mode 1)) corfu-auto nil)))
(use-package company-quickhelp
:bind (:map company-active-map
("M-h" . company-quickhelp-manual-begin))
:after company
:config
(company-quickhelp-mode 1)
(setopt company-quickhelp-delay nil))
;; xref ;; xref
(use-package xref (use-package xref