bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#12852: 24.2; `exit-function' not supported in completion table's met


From: Leo
Subject: bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
Date: Sun, 11 Nov 2012 14:45:02 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (OS X 10.8.2)

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






reply via email to

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