all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [pcomplete.el (pcomplete-completions-at-point)] Why max?
@ 2019-03-16 22:29 Tadeus Prastowo
  2019-03-19  9:55 ` Tadeus Prastowo
  2019-03-20  2:09 ` Stefan Monnier
  0 siblings, 2 replies; 11+ messages in thread
From: Tadeus Prastowo @ 2019-03-16 22:29 UTC (permalink / raw)
  To: John Wiegley; +Cc: emacs-devel

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
`lisp/pcomplete.el':

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

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,
Tadeus



^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-03-20 23:38 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-16 22:29 [pcomplete.el (pcomplete-completions-at-point)] Why max? Tadeus Prastowo
2019-03-19  9:55 ` Tadeus Prastowo
2019-03-19 16:37   ` Stefan Monnier
2019-03-19 16:40     ` Tadeus Prastowo
2019-03-20  2:09 ` Stefan Monnier
2019-03-20 11:00   ` Tadeus Prastowo
2019-03-20 14:00     ` Stefan Monnier
2019-03-20 16:14       ` Tadeus Prastowo
2019-03-20 17:11         ` Stefan Monnier
2019-03-20 17:17           ` Tadeus Prastowo
2019-03-20 23:38           ` John Wiegley

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.