From a5672f928403b9f427c60ccc2d930aa8140675ef Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Wed, 2 Oct 2024 17:00:28 -0700 Subject: [PATCH] Change back to corfu (crash was GTK3 mem leak) --- disabled.el | 101 ++++++++++++++++++---------------------------------- init.el | 74 +++++++++++++++++++------------------- 2 files changed, 70 insertions(+), 105 deletions(-) diff --git a/disabled.el b/disabled.el index 11aa953..0bdaef3 100644 --- a/disabled.el +++ b/disabled.el @@ -109,72 +109,39 @@ ;; "Hook to do stuff in llama buffers." ;; (auto-fill-mode -1))) -;; sly -;; (use-package sly -;; :hook (lisp-mode . my/-lisp-mode-autoconnect-sly) -;; :bind (:map sly-mode-map -;; ("C-c e" . my/sly-show-notes-at-point)) -;; :autoload sly-connected-p -;; :init -;; (defun my/-lisp-mode-autoconnect-sly () -;; (unless (sly-connected-p) -;; (sly))) -;; (defun my/sly-notes-at-point (pos &optional buffer) -;; "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") +;; company (in buffer auto-complete) +;; (use-package company +;; :defer nil +;; :bind (("M-TAB" . company-complete) +;; ("M-" . company-complete) +;; ("C-c f" . company-files) +;; ([remap dabbrev-expand] . company-dabbrev) +;; :map prog-mode-map +;; ([remap company-dabbrev] . company-dabbrev-code)) +;; :hook ((company-search-mode . my/-company-search-mode-add-lighter) +;; (sh-mode . my/-company-setup-shell-mode)) ;; :config -;; (sly-symbol-completion-mode -1)) - -;; corfu (autocomplete) -;; (use-package corfu -;; :bind (("M-" . completion-at-point) -;; :map corfu-map -;; ("M-SPC" . corfu-insert-separator) -;; ("M-m" . my/corfu-move-to-minibuffer)) -;; :init -;; (defun my/corfu-move-to-minibuffer () -;; (interactive) -;; (when completion-in-region--data -;; (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) +;; (defun my/-company-setup-shell-mode () +;; (setq-local company-backends '(company-files company-keywords +;; company-dabbrev-code))) +;; (defun my/-company-search-mode-add-lighter () +;; (if company-search-mode +;; (cl-pushnew company-search-lighter global-mode-string :test 'equal) +;; (setq global-mode-string +;; (cl-delete company-search-lighter global-mode-string :test 'equal)))) +;; (defun my/-company-set-completion-styles (oldfun &rest args) +;; (let ((completion-styles '(basic emacs21 flex))) +;; (apply oldfun args))) +;; (advice-add 'company-capf :around 'my/-company-set-completion-styles) +;; (setopt company-format-margin-function #'company-text-icons-margin +;; company-require-match nil +;; company-tooltip-align-annotations t) +;; (setq company-transformers '(company-sort-by-occurrence)) +;; (global-company-mode 1)) +;; (use-package company-quickhelp +;; :bind (:map company-active-map +;; ("M-h" . company-quickhelp-manual-begin)) +;; :after company ;; :config -;; (add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer)) -;; (use-package corfu-terminal -;; :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))) +;; (company-quickhelp-mode 1) +;; (setopt company-quickhelp-delay nil)) diff --git a/init.el b/init.el index 41b3952..1212e2c 100644 --- a/init.el +++ b/init.el @@ -522,9 +522,6 @@ visual states." ("M-g i" . consult-imenu) ("M-g I" . 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-" . newline) :map help-map ("TAB". consult-info) ("C-m" . consult-man)) @@ -543,42 +540,43 @@ visual states." (use-package embark-consult :hook (embark-collect-mode . consult-preview-at-point-mode)) -;; company (in buffer auto-complete) -(use-package company - :defer nil - :bind (("M-TAB" . company-complete) - ("M-" . company-complete) - ("C-c f" . company-files) - ([remap dabbrev-expand] . company-dabbrev) - :map prog-mode-map - ([remap company-dabbrev] . company-dabbrev-code)) - :hook ((company-search-mode . my/-company-search-mode-add-lighter) - (sh-mode . my/-company-setup-shell-mode)) +;; corfu (autocomplete) +(use-package corfu + :bind (("M-" . completion-at-point) + :map corfu-map + ("M-SPC" . corfu-insert-separator) + ("M-m" . my/corfu-move-to-minibuffer)) + :init + (defun my/corfu-move-to-minibuffer () + (interactive) + (when completion-in-region--data + (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 - (defun my/-company-setup-shell-mode () - (setq-local company-backends '(company-files company-keywords - company-dabbrev-code))) - (defun my/-company-search-mode-add-lighter () - (if company-search-mode - (cl-pushnew company-search-lighter global-mode-string :test 'equal) - (setq global-mode-string - (cl-delete company-search-lighter global-mode-string :test 'equal)))) - (defun my/-company-set-completion-styles (oldfun &rest args) - (let ((completion-styles '(basic emacs21 flex))) - (apply oldfun args))) - (advice-add 'company-capf :around 'my/-company-set-completion-styles) - (setopt company-format-margin-function #'company-text-icons-margin - company-require-match nil - company-tooltip-align-annotations t) - (setq company-transformers '(company-sort-by-occurrence)) - (global-company-mode 1)) -(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)) + (add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer)) +(use-package corfu-terminal + :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))) ;; xref (use-package xref