[Top][All Lists]

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

[pcomplete.el (pcomplete-completions-at-point)] Why max?

From: Tadeus Prastowo
Subject: [pcomplete.el (pcomplete-completions-at-point)] Why max?
Date: Sat, 16 Mar 2019 23:29:38 +0100

Hi John,

I am using Emacs at commit 4633b0e and see a problem that can be
solved ad-hoc by using `min' instead of `max' in the following code
within function `pcomplete-completions-at-point' in file

           (beg (max (- (point) (length pcomplete-stub))

What do you think will break if `min' is used instead of `max' to
repair the following problem seen using `emacs -Q' at the said commit?

M-x shell
cd /tmp
mkdir AAAA\ BB\ CCCC
cd AAAA\ BB<tab>

Autocomplete fails because (pcomplete-begin) returns the position of
the first letter A but (length pcomplete-stub) is the length of "AAAA
BB", which gives the position of the second letter A.  The function
`max', therefore, sets `beg' to the start of the second letter A.
Consequently, file-name-completion will be asked to complete "AAA BB"
instead of the correct one "AAAA BB".

Thank you.

Best regards,

reply via email to

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