unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
@ 2012-11-10  7:28 Leo
  2012-11-10 22:33 ` Stefan Monnier
  2022-02-09  9:10 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 11+ messages in thread
From: Leo @ 2012-11-10  7:28 UTC (permalink / raw)
  To: 12852

It seems inconsistent that exit-function is not implemented and
documented like annotation-function. (info "(elisp)Programmed
Completion")

Leo





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-10  7:28 bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist Leo
@ 2012-11-10 22:33 ` Stefan Monnier
  2012-11-11  6:45   ` Leo
  2022-02-09  9:10 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2012-11-10 22:33 UTC (permalink / raw)
  To: Leo; +Cc: 12852

> It seems inconsistent that exit-function is not implemented and
> documented like annotation-function. (info "(elisp)Programmed
> Completion")

AFAIK, the exit-function is a global property that applies to the whole
completion, whereas the annotation function is related to the
all-completions output, which can vary depending on where point is
(e.g. in file-name completion the *Completions* buffer may list files or
envvars, so you may need two different annotation-functions).

Hence the exit-function doesn't make much sense in the completion
table's metadata.


        Stefan





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-10 22:33 ` Stefan Monnier
@ 2012-11-11  6:45   ` Leo
  2012-11-11 15:41     ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Leo @ 2012-11-11  6:45 UTC (permalink / raw)
  To: 12852

On 2012-11-11 06:33 +0800, Stefan Monnier wrote:
> AFAIK, the exit-function is a global property that applies to the whole
> completion, whereas the annotation function is related to the
> all-completions output, which can vary depending on where point is
> (e.g. in file-name completion the *Completions* buffer may list files or
> envvars, so you may need two different annotation-functions).
>
> Hence the exit-function doesn't make much sense in the completion
> table's metadata.

It still seems inconsistent to me.

I am finding myself writing this in order to group related code.

  (cond
   ((eq action 'metadata)
    (make-local-variable 'completion-extra-properties)
    (setq completion-extra-properties
          (plist-put 'completion-extra-properties :exit-function
                     (lambda (comp status)
                       (when (cadr (assoc (car (last (split-string comp "[.]" t)))
                                          python-module--completion-table))
                         (minibuffer-message "package")))))
    '(metadata
      (annotation-function
       . (lambda (comp)
           (when (cadr (assoc comp python-module--completion-table))
             " <P>")))))
    .......)

Otherwise I'd have to go to completing-read, xxxxx-completion-at-point
and the like to install the exit-function on each one of them. This is
repetitive and ugly.

I was hoping I could just write

  (cond
   ((eq action 'metadata)
    '(metadata
      (annotation-function
       . (lambda (comp)
           (when (cadr (assoc comp python-module--completion-table))
             " <P>")))
      (exit-function
       . (lambda (comp status)
                       (when (cadr (assoc (car (last (split-string comp "[.]" t)))
                                          python-module--completion-table))
                         (minibuffer-message "package"))))))
    .......)


Looks like with some change to completion--done we can have this. What
do you think?

Leo






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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-11  6:45   ` Leo
@ 2012-11-11 15:41     ` Stefan Monnier
  2012-11-11 15:56       ` Leo
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2012-11-11 15:41 UTC (permalink / raw)
  To: Leo; +Cc: 12852

> I am finding myself writing this in order to group related code.

>   (cond
>    ((eq action 'metadata)
>     (make-local-variable 'completion-extra-properties)
>     (setq completion-extra-properties
>           (plist-put 'completion-extra-properties :exit-function
>                      (lambda (comp status)
>                        (when (cadr (assoc (car (last (split-string comp "[.]" t)))
>                                           python-module--completion-table))
>                          (minibuffer-message "package")))))

Hmm.. I don't really understand what this is trying to do.
Can you explain to me what should be the end result?

> Looks like with some change to completion--done we can have this.
> What do you think?

I have the impression that you're subverting exit-function.
I"m not sure yet if it's a neat hack, or if there's a better way to do it,


        Stefan





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-11 15:41     ` Stefan Monnier
@ 2012-11-11 15:56       ` Leo
  2012-11-11 16:21         ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Leo @ 2012-11-11 15:56 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12852

On 2012-11-11 23:41 +0800, Stefan Monnier wrote:
> Hmm.. I don't really understand what this is trying to do.
> Can you explain to me what should be the end result?

I am writing a programmed completion table for python modules which
should work like file name completion but separated by . instead of /.

After each completion it should tell me whether the completion is a
package to help me decide whether to type . and get further completions.

So for example, twisted.inte should complete to twisted.internet with
minibuffer message [package] to mean that twisted.internet is a package.

>> Looks like with some change to completion--done we can have this.
>> What do you think?
>
> I have the impression that you're subverting exit-function.
> I"m not sure yet if it's a neat hack, or if there's a better way to do it,

Probably.

Leo





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-11 15:56       ` Leo
@ 2012-11-11 16:21         ` Stefan Monnier
  2012-11-11 16:50           ` Leo
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2012-11-11 16:21 UTC (permalink / raw)
  To: Leo; +Cc: 12852

>> Hmm.. I don't really understand what this is trying to do.
>> Can you explain to me what should be the end result?
> I am writing a programmed completion table for python modules which
> should work like file name completion but separated by . instead of /.
> After each completion it should tell me whether the completion is a
> package to help me decide whether to type . and get further completions.

Any reason not actually add the ".", just like file-name completion
actually adds the / ?

> So for example, twisted.inte should complete to twisted.internet with
> minibuffer message [package] to mean that twisted.internet is a package.

Right, so it's like an annotation but only displayed when you select
that particular entry.

>>> Looks like with some change to completion--done we can have this.
>>> What do you think?
>> I have the impression that you're subverting exit-function.
>> I"m not sure yet if it's a neat hack, or if there's a better way to do it,
> Probably.

Not sure which of the two you think is probable.  Maybe the "neat hack"
is the more probable one.


        Stefan





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-11 16:21         ` Stefan Monnier
@ 2012-11-11 16:50           ` Leo
  2012-11-23  3:22             ` Leo
  0 siblings, 1 reply; 11+ messages in thread
From: Leo @ 2012-11-11 16:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12852

On 2012-11-12 00:21 +0800, Stefan Monnier wrote:
> Any reason not actually add the ".", just like file-name completion
> actually adds the / ?

This is another way to do it. But it looks unnatural. For example, it is
not uncommon to use /usr/bin/ for a directory name but not usr.bin. for
a python pkg.

>> So for example, twisted.inte should complete to twisted.internet with
>> minibuffer message [package] to mean that twisted.internet is a package.
>
> Right, so it's like an annotation but only displayed when you select
> that particular entry.
>
>>>> Looks like with some change to completion--done we can have this.
>>>> What do you think?
>>> I have the impression that you're subverting exit-function.
>>> I"m not sure yet if it's a neat hack, or if there's a better way to do it,
>> Probably.
>
> Not sure which of the two you think is probable.  Maybe the "neat hack"
> is the more probable one.

I mean I might be subverting the exit-function. Any suggestions?

Leo





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-11 16:50           ` Leo
@ 2012-11-23  3:22             ` Leo
  2012-11-23  3:58               ` Stefan Monnier
  0 siblings, 1 reply; 11+ messages in thread
From: Leo @ 2012-11-23  3:22 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12852

On 2012-11-12 00:50 +0800, Leo wrote:
>> Not sure which of the two you think is probable.  Maybe the "neat hack"
>> is the more probable one.
>
> I mean I might be subverting the exit-function. Any suggestions?

Hello Stefan,

Any comments on what is the best thing to do?

Leo





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-23  3:22             ` Leo
@ 2012-11-23  3:58               ` Stefan Monnier
  2012-12-02  5:41                 ` Leo
  0 siblings, 1 reply; 11+ messages in thread
From: Stefan Monnier @ 2012-11-23  3:58 UTC (permalink / raw)
  To: Leo; +Cc: 12852

>> I mean I might be subverting the exit-function.  Any suggestions?
> Any comments on what is the best thing to do?

Clearly, with the current code base, adding "." is the
easiest solution.  You can also strip any final dot in the user's input,
so the odd final dot is only a temporary artifact in the minibuffer.

But you do have some good points about exit-function, which might
justify redesigning it, or providing some similar functionality in
completion-metadata.  But I need to think more about what that should
look like.


        Stefan





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-23  3:58               ` Stefan Monnier
@ 2012-12-02  5:41                 ` Leo
  0 siblings, 0 replies; 11+ messages in thread
From: Leo @ 2012-12-02  5:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12852

On 2012-11-23 11:58 +0800, Stefan Monnier wrote:
> Clearly, with the current code base, adding "." is the
> easiest solution.  You can also strip any final dot in the user's input,
> so the odd final dot is only a temporary artifact in the minibuffer.

This seems to get in the way if you use the table for
completion-at-point.

>
> But you do have some good points about exit-function, which might
> justify redesigning it, or providing some similar functionality in
> completion-metadata.  But I need to think more about what that should
> look like.

OK, thanks for the thinking ;)

Leo





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

* bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
  2012-11-10  7:28 bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist Leo
  2012-11-10 22:33 ` Stefan Monnier
@ 2022-02-09  9:10 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 11+ messages in thread
From: Lars Ingebrigtsen @ 2022-02-09  9:10 UTC (permalink / raw)
  To: Leo; +Cc: 12852, Stefan Monnier

Leo <sdl.web@gmail.com> writes:

> It seems inconsistent that exit-function is not implemented and
> documented like annotation-function. (info "(elisp)Programmed
> Completion")

(I'm going through old bug reports that unfortunately weren't resolved
at the time.)

This was a decade ago, and apparently :exit-function wasn't changed, so
it seems unlikely to happen now, so I'm therefore closing this bug
report.  If I misunderstood the situation, please respond to the debbugs
address and we'll reopen.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2022-02-09  9:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-10  7:28 bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist Leo
2012-11-10 22:33 ` Stefan Monnier
2012-11-11  6:45   ` Leo
2012-11-11 15:41     ` Stefan Monnier
2012-11-11 15:56       ` Leo
2012-11-11 16:21         ` Stefan Monnier
2012-11-11 16:50           ` Leo
2012-11-23  3:22             ` Leo
2012-11-23  3:58               ` Stefan Monnier
2012-12-02  5:41                 ` Leo
2022-02-09  9:10 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).