Subject: Re: bug#54374: 29.0.50; previous-completion fails at beginning of completions buffer

From: Eli Zaretskii <[email-masked]>
Date: Mon, 14 Mar 2022 14:59:14 +0200

> From: Philip Kaludercic <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Mon, 14 Mar 2022 08:20:29 +0000
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> From: Philip Kaludercic <[email-masked]>
> >> Date: Sun, 13 Mar 2022 20:39:53 +0000
> >> Cc: [email-masked]
> >> 
> >> -      (while (< n 0)
> >> +      (while (and (< n 0) (< 1 (point)))
> >
> > Please always use point-min, never a literal 1.
> 
> Can do, but does it make a difference in this case?  The only reason the
> comparison is made is so that (1- (point)) doesn't return an invalid
> point value.

Any buffer position outside of the accessible portion of the buffer is
almost always invalid; the number of APIs which tolerate such values
of buffer position is very small.

Here, try this:

  emacs -Q
  M-: (narrow-to-region 20 (point-max)) RET
  M-: (get-text-property 1 'mouse-face) RET

You will get the same args-out-of-range error.  That's because
get-text-property validates the position against the accessible
portion of the buffer, not against some absolute values.