unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Leo <sdl.web@gmail.com>
To: 12852@debbugs.gnu.org
Subject: bug#12852: 24.2; `exit-function' not supported in completion table's metadata alist
Date: Sun, 11 Nov 2012 14:45:02 +0800	[thread overview]
Message-ID: <m2txswzlht.fsf@gmail.com> (raw)
In-Reply-To: <m2sj8hvrva.fsf@gmail.com>

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	other threads:[~2012-11-11  6:45 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m2txswzlht.fsf@gmail.com \
    --to=sdl.web@gmail.com \
    --cc=12852@debbugs.gnu.org \
    /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 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).