bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61535: 29.0.60; choose-completion erases in-region buffer


From: Juri Linkov
Subject: bug#61535: 29.0.60; choose-completion erases in-region buffer
Date: Sun, 19 Feb 2023 19:31:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> >> >> >> 1. type: (with-c C-M-i
>> >> >> >> 2. type: M-down ... M-RET
>>
>> 'M-RET' above is new.  It's bound to the new function
>> 'minibuffer-choose-completion' that let-binds
>> 'completion-use-base-affixes' to t that works
>> only in the minibuffer, not in 'completion-in-region-mode'.
>
> Sorry, I'm still confused.  The patch you want to install is
>
> diff --git a/lisp/simple.el b/lisp/simple.el
> index c58acfe3adc..1924567cc3f 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -9882,7 +9882,8 @@ choose-completion
>        (with-current-buffer buffer
>          (choose-completion-string
>           choice buffer
> -         (or (and completion-use-base-affixes base-affixes)
> +         (or (and (not completion-in-region-mode)
> +                  completion-use-base-affixes base-affixes)
>               base-position
>               ;; If all else fails, just guess.
>               (list (choose-completion-guess-base-position choice)))
>
> But by default, completion-in-region-mode is t and
> completion-use-base-affixes is nil.  So this code is never executed in
> the recipe you posted, right?

M-RET is bound to minibuffer-choose-completion in completion-in-region-mode-map.
minibuffer-choose-completion let-binds completion-use-base-affixes to t
before calling choose-completion.  Therefore completion-use-base-affixes
should be ignored in choose-completion for completion-in-region-mode.

> Moreover, if I look at buffer-undo-list, I don't think I see there
> that the entire buffer text of *scratch* was deleted and recreated.
>
> So what am I missing, and what is the problem you are trying to fix?

Here is the output of 'C-h v buffer-undo-list' after typing M-RET
in the *scratch* buffer:

  buffer-undo-list is a variable defined in ‘C source code’.

  Its value is shown below.

  Value:
  (nil
   (1 . 166)
   (#(";; This buffer is for text that is not saved, and for Lisp evaluation.
  ;; To create a file, visit it with C-x C-f and enter text in its buffer.

  (with-c" 0 3
  ...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]