branch: externals/minuet commit 74194a182ea64c61528202b37484d31d0b6b3e15 Author: Milan Glacier <d...@milanglacier.com> Commit: Milan Glacier <d...@milanglacier.com>
feat!: replace `minuet-completion-in-region` with `minuet-complete-with-mini-buffer`. Also replace completion-in-region with completing-read. --- README.md | 7 ++++--- minuet.el | 20 +++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8332798902..247e4fa546 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Just as dancers move during a minuet. - Streaming support to enable completion delivery even with slower LLMs -**With completion-in-region**: +**With minibuffer frontend**:  @@ -66,7 +66,7 @@ Currently you need to install from github via `package-vc` or (straight-use-package '(minuet :host github :repo "milanglacier/minuet-ai.el")) (use-package minuet - :bind (("M-y" . #'minuet-completion-in-region) ;; use completion-in-region for completion + :bind (("M-y" . #'minuet-complete-with-minibuffer) ;; use minibuffer for completion ("M-i" . #'minuet-show-suggestion) ;; use overlay for completion :map minuet-active-mode-map ("M-p" . #'minuet-previous-suggestion) ;; invoke completion or cycle to next completion @@ -88,6 +88,7 @@ Currently you need to install from github via `package-vc` or (add-hook 'minuet-active-mode-hook #'evil-normalize-keymaps) (minuet-set-optional-options minuet-openai-fim-compatible-options :max_tokens 256)) + ``` Example for Ollama: @@ -216,7 +217,7 @@ default is `3`. ## minuet-add-single-line-entry -For `minuet-completion-in-region` function, Whether to create +For `minuet-complete-with-minibuffer` function, Whether to create additional single-line completion items. When non-nil and a completion item has multiple lines, create another completion item containing only its first line. This option has no impact for diff --git a/minuet.el b/minuet.el index e8ac19f2db..445906349d 100644 --- a/minuet.el +++ b/minuet.el @@ -629,8 +629,8 @@ used to accumulate text output from a process. After execution, (insert first-line)))) ;;;###autoload -(defun minuet-completion-in-region () - "Complete code in region with LLM." +(defun minuet-complete-with-minibuffer () + "Complete using minibuffer interface." (interactive) (let ((current-buffer (current-buffer)) (available-p-fn (intern (format "minuet--%s-available-p" minuet-provider))) @@ -647,18 +647,13 @@ used to accumulate text output from a process. After execution, (minuet--add-single-line-entry items) items) items (-distinct items)) - ;; When there is only one completion item, - ;; the completion-in-region function - ;; automatically inserts the text into the - ;; buffer. We want to prevent this automatic - ;; behavior to ensure users can dismiss the - ;; completion item if desired. - (when (length= items 1) - (push "" items)) ;; close current minibuffer session, if any (when (active-minibuffer-window) (abort-recursive-edit)) - (completion-in-region (point) (point) items)))))) + (when items + (when-let ((selected (completing-read "Complete: " items nil t))) + (unless (string-empty-p selected) + (insert selected))))))))) (defun minuet--get-api-key (api-key) "Get the api-key from API-KEY. @@ -1043,5 +1038,8 @@ When enabled, Minuet will automatically show suggestions while you type." :init-value nil :keymap minuet-active-mode-map) +;;;###autoload +(define-obsolete-function-alias 'minuet-completion-in-region 'minuet-complete-with-minibuffer "0.2") + (provide 'minuet) ;;; minuet.el ends here