[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave
From: |
Juri Linkov |
Subject: |
bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer |
Date: |
Tue, 14 Nov 2023 09:39:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
> For example, with (setq completion-use-base-affixes t)
> if there is some text in the current buffer after point,
> then typing 'M-C-i' and selecting a candidate to insert to the buffer,
> it replaces all the text after point with an empty string.
>
> Before this change, the suffix was set to the text after point,
> and after inserting the selected candidate the suffix was
> re-inserted to the same buffer.
Here is a patch that should support 'completion-in-region':
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 07a284134d6..a2d0fabd9c5 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -2405,9 +2410,14 @@ minibuffer-completion-help
(base-prefix (buffer-substring (minibuffer--completion-prompt-end)
(+ start base-size)))
(base-suffix
- (if (eq (alist-get 'category (cdr md)) 'file)
- (buffer-substring (save-excursion (or (search-forward "/"
nil t) (point-max)))
- (point-max))
+ (if (or (eq (alist-get 'category (cdr md)) 'file)
+ completion-in-region-mode-predicate)
+ (buffer-substring
+ (save-excursion
+ (if completion-in-region-mode-predicate
+ (point)
+ (or (search-forward "/" nil t) (point-max))))
+ (point-max))
""))
(all-md (completion--metadata (buffer-substring-no-properties
start (point))
- bug#62700: 29.0.60; minibuffer-{previous,next,choose}-completion behave unintuitively when point is not at end of buffer,
Juri Linkov <=