emacs-devel
[Top][All Lists]
Advanced

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

Re: Recommendation for CAPF setup when you don't know completion string


From: JD Smith
Subject: Re: Recommendation for CAPF setup when you don't know completion string in advance
Date: Tue, 11 May 2021 09:42:21 -0400


There's `completion-table-with-context`.
Note that it comes with the following:

   ;; TODO: add `suffix' maybe?

so you probably won't be able to use it as-is and you'll need to write
your function instead.  But hopefully it should be enough to get
you started. 

Looking at `completion-table-with-context’, it seems just to prepend the prefix after the completion happens, if a string is returned from `complete-with-action'.  I’m struggling then to understand the point of completion-boundaries lookup at all.  I presume the boundaries returned by a table function are relative to the string enclosed by then original START…END range originally returned by the CAPF.  

To make this concrete, suppose you are completing this string:

/path/to/some[Tab]

and your CAPF indicates the range of the entire string, but then its table function returns non-trivial boundaries: `(boundaries 9 . 0).  In this case, the `completion-file-name-table’ still also trims the full path string to its non-directory end component (‘some’) before passing on to `file-name-completion`.  Then finally it prepends the directory back on again. So what good did returning boundaries do it, if it had to cut out the completion string of interest, find completions for it, then glue the prefix back on anyway?

reply via email to

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