unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Stefan Monnier'" <monnier@iro.umontreal.ca>
Cc: 8795@debbugs.gnu.org
Subject: bug#8795: 24.0.50; `completion-try-completion' addition of METADATA arg
Date: Mon, 6 Jun 2011 08:29:51 -0700	[thread overview]
Message-ID: <ABA11BBC16DC471393686AE36C54B446@us.oracle.com> (raw)
In-Reply-To: <jwv8vtfauei.fsf-monnier+emacs@gnu.org>

> > 1. The addition of arg METADATA, without making it optional, breaks
> > existing code that calls the function with only the first four args.
>  
> Indeed, it was meant as an internal function, tho clearly it was never
> fully internal since icomplete uses it.
> 
> I'll see how I can fix it, but in the mean time, could you tell me how
> you use it (I can guess the "where" is "icicles")?

I use it here:

1. icomplete+.el
http://www.emacswiki.org/emacs/icomplete%2b.el
in the Emacs 23+ definition of `icomplete-completions':

(let* ((mdata  (and (fboundp 'completion--field-metadata)
                    (completion--field-metadata
                     (field-beginning))))
       (most-try
        (if (fboundp 'completion--field-metadata) ; Emacs 24
            (completion-try-completion
             name comps nil (length name) mdata)
          (completion-try-completion
           name comps nil (length name))))
...

2. icicles-fn.el
http://www.emacswiki.org/emacs/icicles-fn.el
in the definitions of `icicle-completion-(all|try)-completion(s)':

(let* ((mdata  (and (fboundp 'completion--field-metadata)
                    (or metadata  (completion--field-metadata
                                   (field-beginning)))))
       (res    (if (fboundp 'completion--field-metadata) ; Emacs 24
                   (completion-all-completions
                    string table pred point mdata)
                 (completion-all-completions
                  string table pred point))))
...

[similarly for `...try...']

Functions `icicle-completion-(all|try)-completion(s)' are used by functions
`icicle-unsorted(-file-name)-prefix-candidates',
`icicle-prefix-any(-file-name)-candidates-p' (in the same file).

Here is a typical use:

(if (icicle-not-basic-prefix-completion-p)
    (icicle-completion-try-completion
     input minibuffer-completion-table
     minibuffer-completion-predicate
     (length input)
     (and (fboundp 'completion--field-metadata)
          (completion--field-metadata ; Emacs 24
           (field-beginning))))
  (try-completion input minibuffer-completion-table
                  minibuffer-completion-predicate))

`icicle-not-basic-prefix-completion-p' returns non-nil if the user chooses to
take advantage of Emacs 23+ `completion-styles' etc.






  reply	other threads:[~2011-06-06 15:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-03 17:44 bug#8795: 24.0.50; `completion-try-completion' addition of METADATA arg Drew Adams
2011-06-03 19:27 ` Drew Adams
2011-06-06 14:49 ` Stefan Monnier
2011-06-06 15:29   ` Drew Adams [this message]
2011-06-20 20:16 ` Stefan Monnier
     [not found]   ` <CBB8C9CCD5D24CE0B43657090D9EF126@us.oracle.com>
2011-10-12 21:28     ` Stefan Monnier
     [not found]       ` <CB9E90F42A1A4834BE0F4DBCC3D522B1@us.oracle.com>
     [not found]         ` <jwvy5wpbpkr.fsf-monnier+emacs@gnu.org>
2011-10-13 20:36           ` Drew Adams
2011-10-13 20:45 ` bug#8795: FW: " Drew Adams

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=ABA11BBC16DC471393686AE36C54B446@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=8795@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).