minad / cape

🦸cape.el - Completion At Point Extensions
GNU General Public License v3.0
603 stars 22 forks source link

'cape-file' completion inside a wiki-style link #114

Closed woolsweater closed 6 months ago

woolsweater commented 6 months ago

cape-file has a little special check for Org links. I don't use Org, but I do use Markdown with wiki-style links: [[Some file name.md]]. Would you consider extending cape-file to support this link type as well? The condition would be "are the two characters immediately before the filename-at-point [[?". Since square brackets are often used in code, it might be good to combine that with (not (derived-mode-p 'prog-mode)). Or, even more refined, to only check for [[ in prog-modes when in a comment.

Alternatively and much simpler for Cape: a buffer-local cape-file-complete-p variable would solve this very well. It would be a function receiving the beg buffer position (the start of the filename-at-point) and returning non-nil if file completion should be attempted.