emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r104646: * lisp/minibuffer.el (comple


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104646: * lisp/minibuffer.el (completion-metadata): Prepend the alist with `metadata'.
Date: Mon, 20 Jun 2011 16:16:20 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104646
fixes bug(s): http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8795
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Mon 2011-06-20 16:16:20 -0400
message:
  * lisp/minibuffer.el (completion-metadata): Prepend the alist with `metadata'.
  (completion-try-completion, completion-all-completions): Compute the
  metadata argument if it's missing; make it optional.
modified:
  lisp/ChangeLog
  lisp/minibuffer.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-20 16:02:31 +0000
+++ b/lisp/ChangeLog    2011-06-20 20:16:20 +0000
@@ -1,5 +1,9 @@
 2011-06-20  Stefan Monnier  <address@hidden>
 
+       * minibuffer.el (completion-metadata): Prepend the alist with 
`metadata'.
+       (completion-try-completion, completion-all-completions): Compute the
+       metadata argument if it's missing; make it optional (bug#8795).
+
        * wid-edit.el: Use lexical scoping and move towards completion-at-point.
        (widget-complete): Use new :completion-function property.
        (widget-completions-at-point): New function.

=== modified file 'lisp/minibuffer.el'
--- a/lisp/minibuffer.el        2011-06-01 19:32:04 +0000
+++ b/lisp/minibuffer.el        2011-06-20 20:16:20 +0000
@@ -135,7 +135,8 @@
   (let ((metadata (if (functionp table)
                       (funcall table string pred 'metadata))))
     (if (eq (car-safe metadata) 'metadata)
-        (cdr metadata))))
+        metadata
+      '(metadata))))
 
 (defun completion--field-metadata (field-start)
   (completion-metadata (buffer-substring-no-properties field-start (point))
@@ -513,7 +514,7 @@
         (delete-dups (append (cdr over) (copy-sequence completion-styles)))
        completion-styles)))
 
-(defun completion-try-completion (string table pred point metadata)
+(defun completion-try-completion (string table pred point &optional metadata)
   "Try to complete STRING using completion table TABLE.
 Only the elements of table that satisfy predicate PRED are considered.
 POINT is the position of point within STRING.
@@ -524,9 +525,12 @@
   (completion--some (lambda (style)
                       (funcall (nth 1 (assq style completion-styles-alist))
                                string table pred point))
-                    (completion--styles metadata)))
+                    (completion--styles (or metadata
+                                            (completion-metadata
+                                             (substring string 0 point)
+                                             table pred)))))
 
-(defun completion-all-completions (string table pred point metadata)
+(defun completion-all-completions (string table pred point &optional metadata)
   "List the possible completions of STRING in completion table TABLE.
 Only the elements of table that satisfy predicate PRED are considered.
 POINT is the position of point within STRING.
@@ -537,7 +541,10 @@
   (completion--some (lambda (style)
                       (funcall (nth 2 (assq style completion-styles-alist))
                                string table pred point))
-                    (completion--styles metadata)))
+                    (completion--styles (or metadata
+                                            (completion-metadata
+                                             (substring string 0 point)
+                                             table pred)))))
 
 (defun minibuffer--bitset (modified completions exact)
   (logior (if modified    4 0)


reply via email to

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