Subject: Re: bug#18265: 24.3.92; lisp-completion-at-point should return nil in comments, unless after `

From: Dmitry Gutov <[email-masked]>
Date: Fri, 15 Aug 2014 07:13:04 +0400

On 08/15/2014 07:04 AM, Stefan Monnier wrote:

> Good point.  Makes me wonder how to extend completion-at-point-functions
> such that a function like lisp-completion-at-point could behave
> differently for something like Company (which calls it without the user
> making an explicit completion request) than for an explicit M-TAB.

Sometimes the user makes an explicit request, though. So it's "idle mode 
vs manual mode", not "Company vs complete-symbol".

Still, the fact that user called `M-x company-complete' inside a comment 
doesn't tell me that they actually want to see completions from 
`company-capf' and not some other backend like `company-dabbrev'.

Likewise, user pressing C-M-i inside a comment might prefer not to talk 
`lisp-completion-at-point', but some other completion function that goes 
after it that's more suited for completion in comments.

If we really want to use `lisp-completion-at-point' in comments in more 
cases, I'd try to detect whether we're probably in a code sample (by the 
extra indentation, maybe), and otherwise return nil.