From d22fa5a67014f49c1e6b732bbde7737fe9e2f33f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 20 Mar 2024 03:09:05 -0400 Subject: [PATCH 1/7] fix(vertico): consult-dir: don't guess user from containers The tramp string used to connect to the container uses the first `container-runtime ps` argument as a username, but the first argument returned is the container ID, not a username. Close: #7674 Co-authored-by: bergmannf Co-authored-by: elken --- modules/completion/vertico/config.el | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index e15bd0fb7..cce40e94f 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -201,7 +201,8 @@ orderless." ("C-x C-j" . consult-dir-jump-file)) :config (when (modulep! :tools docker) - ;; TODO Replace with `tramp-container--completion-function' when we drop support for <29 + ;; TODO: Replace with `tramp-container--completion-function' when we drop + ;; support for <29 (defun +vertico--consult-dir-container-hosts (host) "Get a list of hosts from HOST." (cl-loop for line in (cdr @@ -209,10 +210,7 @@ orderless." (apply #'process-lines +vertico-consult-dir-container-executable (append +vertico-consult-dir-container-args (list "ps"))))) for cand = (split-string line "[[:space:]]+" t) - collect (let ((user (unless (string-empty-p (car cand)) - (concat (car cand) "@"))) - (hostname (car (last cand)))) - (format "/%s:%s%s:/" host user hostname)))) + collect (format "/%s:%s:/" host (car (last cand))))) (defun +vertico--consult-dir-podman-hosts () (let ((+vertico-consult-dir-container-executable "podman")) From 367b6711343a483e2dbc181829d8ebe13cea68db Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 20 Mar 2024 12:28:00 -0400 Subject: [PATCH 2/7] refactor(lsp): suffix advice & remove redundancy - Advice functions ought to have a -a suffix. - `eglot-send-changes-idle-time` is already 0.5 upstream, by default. --- modules/tools/lsp/+eglot.el | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/tools/lsp/+eglot.el b/modules/tools/lsp/+eglot.el index 8bf7ed20f..a020a00c1 100644 --- a/modules/tools/lsp/+eglot.el +++ b/modules/tools/lsp/+eglot.el @@ -4,7 +4,7 @@ :commands eglot eglot-ensure :hook (eglot-managed-mode . +lsp-optimization-mode) :init - (defadvice! +eglot--ensure-available-mode (fn) + (defadvice! +eglot--ensure-available-mode-a (fn) "Run `eglot-ensure' if the current mode has support." :around #'eglot-ensure (when (alist-get major-mode eglot-server-programs nil nil @@ -15,7 +15,6 @@ (funcall fn))) (setq eglot-sync-connect 1 eglot-autoshutdown t - eglot-send-changes-idle-time 0.5 ;; NOTE: We disable eglot-auto-display-help-buffer because :select t in ;; its popup rule causes eglot to steal focus too often. eglot-auto-display-help-buffer nil) @@ -44,8 +43,8 @@ (defadvice! +lsp--defer-server-shutdown-a (fn &optional server) "Defer server shutdown for a few seconds. This gives the user a chance to open other project files before the server is -auto-killed (which is a potentially expensive process). It also prevents the -server getting expensively restarted when reverting buffers." +auto-killed (which is a potentially expensive process). It also spares the +server an expensive restart when its buffer is reverted." :around #'eglot--managed-mode (letf! (defun eglot-shutdown (server) (if (or (null +lsp-defer-shutdown) From cd16150b8024808b394b6ac80eeac19751d81233 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 20 Mar 2024 12:30:23 -0400 Subject: [PATCH 3/7] bump: :lang julia JuliaEditorSupport/julia-emacs@7a8c868e0d3e -> JuliaEditorSupport/julia-emacs@2dfc869ff6b3 gcv/julia-snail@d36653bb9380 -> gcv/julia-snail@a25ce847480a non-Jedi/eglot-jl@7dc604fe42a4 -> non-Jedi/eglot-jl@1d9cab682380 --- modules/lang/julia/packages.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/lang/julia/packages.el b/modules/lang/julia/packages.el index 5892896be..410dc62b9 100644 --- a/modules/lang/julia/packages.el +++ b/modules/lang/julia/packages.el @@ -1,13 +1,13 @@ ;; -*- no-byte-compile: t; -*- ;;; lang/julia/packages.el -(package! julia-mode :pin "7a8c868e0d3e51ba4a2c621ee22ca9599e0e4bbb") +(package! julia-mode :pin "2dfc869ff6b3878407fe7226669dfaae8d38d541") (package! julia-repl :pin "4947319bc948b3f80d61b0d65a719737275949b8") (when (modulep! +lsp) (if (modulep! :tools lsp +eglot) - (package! eglot-jl :pin "7dc604fe42a459a987853d065cd6d0f3c4cbc02a") + (package! eglot-jl :pin "1d9cab682380f37ca1e9e9933cda13164600706d") (package! lsp-julia :pin "c869b2f6c05a97e5495ed3cc6710a33b4faf41a2"))) (when (modulep! +snail) - (package! julia-snail :pin "d36653bb938050cfabbe3c1ea6d4575071085577")) + (package! julia-snail :pin "a25ce847480a0c2bed24fad3f1ee62904c9c93a5")) From 222dc47060e7151b89a6e34e2b1237de42439589 Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Wed, 20 Mar 2024 20:27:17 -0700 Subject: [PATCH 4/7] feat(vertico): add orderless annotation filtering Ref: oantolin/orderless#162 --- modules/completion/vertico/config.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index cce40e94f..b5cda2c5b 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -83,6 +83,9 @@ orderless." ((string= "!" pattern) `(orderless-literal . "")) ;; Without literal ((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1))) + ;; Annotation + ((string-prefix-p "&" pattern) `(orderless-annotation . ,(substring pattern 1))) + ((string-suffix-p "&" pattern) `(orderless-annotation . ,(substring pattern 0 -1))) ;; Character folding ((string-prefix-p "%" pattern) `(char-fold-to-regexp . ,(substring pattern 1))) ((string-suffix-p "%" pattern) `(char-fold-to-regexp . ,(substring pattern 0 -1))) From d3a00ba6af7357f00dd8a99b0a3f46ced766b170 Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Wed, 20 Mar 2024 20:29:06 -0700 Subject: [PATCH 5/7] nit(vertico): fix spelling in some docstrings --- modules/completion/vertico/config.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/completion/vertico/config.el b/modules/completion/vertico/config.el index b5cda2c5b..46656a4c6 100644 --- a/modules/completion/vertico/config.el +++ b/modules/completion/vertico/config.el @@ -230,7 +230,7 @@ orderless." :face consult-file :history file-name-history :items ,#'+vertico--consult-dir-podman-hosts) - "Podman candiadate source for `consult-dir'.") + "Podman candidate source for `consult-dir'.") (defvar +vertico--consult-dir-source-tramp-docker `(:name "Docker" @@ -239,7 +239,7 @@ orderless." :face consult-file :history file-name-history :items ,#'+vertico--consult-dir-docker-hosts) - "Docker candiadate source for `consult-dir'.") + "Docker candidate source for `consult-dir'.") (add-to-list 'consult-dir-sources '+vertico--consult-dir-source-tramp-podman t) (add-to-list 'consult-dir-sources '+vertico--consult-dir-source-tramp-docker t)) From 2bdeabb0cf2b8a5bd4798a47da9b598ab46609e3 Mon Sep 17 00:00:00 2001 From: Sean Farley Date: Wed, 20 Mar 2024 19:54:05 -0700 Subject: [PATCH 6/7] refactor(corfu): consolidate +orderless logic without vertico This tidy ups the corfu module to use the logic when a user enables corfu +orderless without enabling vertico. Since that's probably a niche situation, we only specify commit to pin to orderless in the vertico module so that contributors aren't tripped up with trying to remember to update orderless in two different code locations. Of course, if this turns out to be a more popular use-case we can re-evaluate this logic. --- modules/completion/corfu/config.el | 6 ++++-- modules/completion/corfu/packages.el | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/modules/completion/corfu/config.el b/modules/completion/corfu/config.el index 475894fa5..7cd7b5173 100644 --- a/modules/completion/corfu/config.el +++ b/modules/completion/corfu/config.el @@ -55,8 +55,10 @@ use the minibuffer such as `query-replace'.") corfu-count 16 corfu-max-width 120 corfu-on-exact-match nil - corfu-quit-at-boundary (if (modulep! +orderless) 'separator t) - corfu-quit-no-match (if (modulep! +orderless) 'separator t) + corfu-quit-at-boundary (if (or (modulep! :completion vertico) + (modulep! +orderless)) + 'separator t) + corfu-quit-no-match corfu-quit-at-boundary tab-always-indent 'complete) (add-to-list 'completion-category-overrides `(lsp-capf (styles ,@completion-styles))) (add-to-list 'corfu-auto-commands #'lispy-colon) diff --git a/modules/completion/corfu/packages.el b/modules/completion/corfu/packages.el index cf45a992f..3c0e58714 100644 --- a/modules/completion/corfu/packages.el +++ b/modules/completion/corfu/packages.el @@ -5,8 +5,12 @@ (package! cape :pin "a397a0c92de38277b7f835fa999fac400a764908") (when (modulep! +icons) (package! nerd-icons-corfu :pin "7077bb76fefc15aed967476406a19dc5c2500b3c")) -(when (modulep! +orderless) - (package! orderless :pin "b24748093b00b37c3a572c4909f61c08fa27504f")) +(when (and (not (modulep! :completion vertico)) + (modulep! +orderless)) + ;; enabling +orderless without vertico should be fairly niche enough that to + ;; save contributor headaches we should only pin vertico's orderless and leave + ;; this one unpinned + (package! orderless)) (when (modulep! :os tty) (package! corfu-terminal :pin "501548c3d51f926c687e8cd838c5865ec45d03cc")) (when (modulep! :editor snippets) From a83091469b317812be2fe408f5edce665d018a7c Mon Sep 17 00:00:00 2001 From: StrawberryTea Date: Thu, 21 Mar 2024 10:29:50 -0500 Subject: [PATCH 7/7] docs(corfu): debugging cape-dabbrev --- modules/completion/corfu/README.org | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/modules/completion/corfu/README.org b/modules/completion/corfu/README.org index e10d1b17d..541510cb5 100644 --- a/modules/completion/corfu/README.org +++ b/modules/completion/corfu/README.org @@ -244,6 +244,22 @@ doing is to look at the list of buffers Dabbrev is scanning: ... and modify ~dabbrev-ignored-buffer-regexps~ or ~dabbrev-ignored-buffer-modes~ accordingly. +If you see garbage completion candidates, you can use the following command to +debug the issue: + +#+begin_src emacs-lisp +;;;###autoload +(defun search-in-dabbrev-buffers (search-string) + "Search for SEARCH-STRING in all buffers returned by `dabbrev--select-buffers'." + (interactive "sSearch string: ") + (let ((buffers (dabbrev--select-buffers))) + (multi-occur buffers search-string))) + +;; Example usage: +;; Why are these weird characters appearing in my completions? +(search-in-dabbrev-buffers "\342\200\231") +#+end_src + * Frequently asked questions /This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]