all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Leo Liu <sdl.web@gmail.com>
Cc: 18643@debbugs.gnu.org
Subject: bug#18643: 25.0.50; elisp--expect-function-p
Date: Thu, 09 Oct 2014 06:50:55 +0400	[thread overview]
Message-ID: <86oatmq7lc.fsf@yandex.ru> (raw)
In-Reply-To: <m3r3yleq72.fsf@gmail.com> (Leo Liu's message of "Mon, 06 Oct 2014 13:13:05 +0800")

Hi Leo,

Leo Liu <sdl.web@gmail.com> writes:
> emacs should only constrain itself to function completion when
> absolutely sure.

How can we make sure? I think macro-expansion could help in some cases,
but implementing that approach is a bit beyond me.

> It is not a big deal if function names creep into variable completion or
> vice versa. Often it is handy to complete to an existing symbol and then
> edit it into something else.

IME, context-sensitive completion is useful, and people like it.

Narrowing down the list of possible completions is often quite useful,
especially when it can turn 2-3 completions into just one, which can be
inserted with one key. I think we can sacrifice completion in certain
rare cases to retain this advantage in general.

> For example, one might need to create a variable name based on a
> function name.

I'm pretty sure writing a new variable definition is a much less
frequent operation than referring to a variable in a function, or
writing a function call. And code completion is most useful when one is
referring to existing variables and functions.

> There are a few places where I expect to have a completion based on my
> past experience but fail now. For example, in (pred ...) pattern of
> pcase. Other failures, (let (|)) and (let ((|))) where | is point.

If you care to enumerate the main problem cases, and how they fail, it
shouldn't be too hard to add support for them. But of course, we'll
continue to have false negatives in some cases, like third-party macros.

> I have experienced annoyances here and there and I think the fundamental
> solution is not to second guess but complete liberally as we did before.

That suggestions sounds like giving up to me.

For what you're describing, you might like dabbrev-style completion, or
a simple function that looks up symbols in obarray. If you're not using
company-mode, maybe try porting company-dabbrev-code to
completion-at-point-functions, and use that.

I haven't spent a lot of time using the current trunk, but the recent
changes replicate the logic from company-elisp, and I quite liked it
(before it was deprecated in favor of company-capf). I haven't seen many
complaints about function-variable separation there.

That backend does have a `company-elisp-detect-function-context' user
option (so that's another solution for the issue discussed here), but it
doesn't seem to be used much (if at all), judging by the publicly
available configurations.

-- Dmitry





  reply	other threads:[~2014-10-09  2:50 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-06  5:13 bug#18643: 25.0.50; elisp--expect-function-p Leo Liu
2014-10-09  2:50 ` Dmitry Gutov [this message]
2014-10-09  3:31   ` Leo Liu
2014-10-09  6:17     ` Dmitry Gutov
2014-10-09 15:27     ` Stefan Monnier
2014-10-09 23:43       ` Leo Liu
2014-10-10  1:16         ` Stefan Monnier
2014-10-10  4:07           ` Leo Liu
2014-10-10 13:25             ` Stefan Monnier
2014-10-10 20:53               ` Dmitry Gutov
2014-10-11  0:25                 ` Leo Liu
2014-10-11 13:48                   ` Stefan Monnier
2014-10-11 14:21                     ` Leo Liu
2014-10-14 18:32                       ` Stefan Monnier
2014-10-16  2:42                         ` Dmitry Gutov
2014-10-16 13:10                           ` Stefan Monnier
2014-10-11 13:47                 ` Stefan Monnier
2014-10-11 16:18                   ` Dmitry Gutov
2014-10-14 18:34                     ` Stefan Monnier
2014-10-16  2:35                       ` Dmitry Gutov
2014-10-16  3:36                         ` Leo Liu
2014-10-16  9:59                           ` Dmitry Gutov
2014-10-11  0:16               ` Leo Liu
2014-10-10  3:56         ` Dmitry Gutov
2014-10-10  4:33           ` Leo Liu
2014-10-11 16:31             ` Dmitry Gutov
2014-10-10  3:34       ` Dmitry Gutov
2014-10-10 13:20         ` Stefan Monnier
2014-10-11 17:07           ` Dmitry Gutov
2022-04-26 13:44 ` Lars Ingebrigtsen
2022-04-26 15:46   ` Leo Liu
2022-04-27 11:52     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86oatmq7lc.fsf@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=18643@debbugs.gnu.org \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.