Subject: Re: bug#48669: Inconsistent overlay placement between minibuffer-message and set-minibuffer-message

From: Eli Zaretskii <[email-masked]>
Date: Sun, 06 Jun 2021 08:58:27 +0300

> From: Juri Linkov <[email-masked]>
> Date: Sun, 06 Jun 2021 00:43:54 +0300
> Cc: [email-masked]
> 
> 
> [1:text/plain Hide]
> 
> > Would it make sense to change this behaviour (i.e. overlay
> > configuration) so that it is consistent in both functions?
> 
> Thanks for the very useful suggestion.  This could be fixed
> with the following patch where I tried to sync everything
> overlay-related from set-minibuffer-message to minibuffer-message:
> 
> 
> [2:text/x-diff Hide]
> 
> diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
> index ffb74235e8..cb12226c07 100644
> --- a/lisp/minibuffer.el
> +++ b/lisp/minibuffer.el
> @@ -741,7 +741,8 @@ minibuffer-message
>                  ;; Don't overwrite the face properties the caller has set
>                  (text-properties-at 0 message))
>        (setq message (apply #'propertize message minibuffer-message-properties)))
> -    (let ((ol (make-overlay (point-max) (point-max) nil t t))
> +    (let* ((ovpos (minibuffer--message-overlay-pos))
> +           (ol (make-overlay ovpos ovpos nil t t))

Doesn't this rely too much on the internal details of
minibuffer--message-overlay-pos?  At least, without any comments, this
call looks like a riddle that isn't easy to unlock.

> -              (put-text-property 0 1 'cursor t message))
> +              (put-text-property 0 1 'cursor 1 message))

Why this change?