emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog minibuffer.el


From: Stefan Monnier
Subject: [Emacs-diffs] emacs/lisp ChangeLog minibuffer.el
Date: Sat, 24 Oct 2009 00:46:23 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/10/24 00:46:23

Modified files:
        lisp           : ChangeLog minibuffer.el 

Log message:
        (completion--embedded-envvar-table): Fix last change.
        Ignore `pred' now that we receive one.  Handle test-completion 
specially.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16490&r2=1.16491
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/minibuffer.el?cvsroot=emacs&r1=1.90&r2=1.91

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16490
retrieving revision 1.16491
diff -u -b -r1.16490 -r1.16491
--- ChangeLog   23 Oct 2009 18:07:38 -0000      1.16490
+++ ChangeLog   24 Oct 2009 00:46:17 -0000      1.16491
@@ -1,3 +1,9 @@
+2009-10-24  Stefan Monnier  <address@hidden>
+
+       * minibuffer.el (completion--embedded-envvar-table): Fix last change.
+       Ignore `pred' now that we receive one.
+       Handle test-completion specially.
+
 2009-10-23  Dan Nicolaescu  <address@hidden>
 
        * vc.el (vc-responsible-backend): Throw an error if not backend is

Index: minibuffer.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/minibuffer.el,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -b -r1.90 -r1.91
--- minibuffer.el       22 Oct 2009 16:14:52 -0000      1.90
+++ minibuffer.el       24 Oct 2009 00:46:23 -0000      1.91
@@ -1068,11 +1068,25 @@
           "$\\([[:alnum:]_]*\\|{\\([^}]*\\)\\)\\'"))
 
 (defun completion--embedded-envvar-table (string pred action)
+  "Completion table for envvars embedded in a string.
+The envvar syntax (and escaping) rules followed by this table are the
+same as `substitute-in-file-name'."
+  ;; We ignore `pred', because the predicates passed to us via
+  ;; read-file-name-internal are not 100% correct and fail here:
+  ;; e.g. we get predicates like file-directory-p there, whereas the filename
+  ;; completed needs to be passed through substitute-in-file-name before it
+  ;; can be passed to file-directory-p.
   (when (string-match completion--embedded-envvar-re string)
     (let* ((beg (or (match-beginning 2) (match-beginning 1)))
            (table (completion--make-envvar-table))
            (prefix (substring string 0 beg)))
-      (if (eq (car-safe action) 'boundaries)
+      (cond
+       ((eq action 'lambda)
+        ;; This table is expected to be used in conjunction with some
+        ;; other table that provides the "main" completion.  Let the
+        ;; other table handle the test-completion case.
+        nil)
+       ((eq (car-safe action) 'boundaries)
           ;; Only return boundaries if there's something to complete,
           ;; since otherwise when we're used in
           ;; completion-table-in-turn, we could return boundaries and
@@ -1080,14 +1094,15 @@
           ;; FIXME: Maybe it should rather be fixed in
           ;; completion-table-in-turn instead, but it's difficult to
           ;; do it efficiently there.
-          (when (try-completion prefix table pred)
+        (when (try-completion (substring string beg) table nil)
             ;; Compute the boundaries of the subfield to which this
             ;; completion applies.
             (let ((suffix (cdr action)))
               (list* 'boundaries
                      (or (match-beginning 2) (match-beginning 1))
                      (when (string-match "[^[:alnum:]_]" suffix)
-                       (match-beginning 0)))))
+                     (match-beginning 0))))))
+       (t
         (if (eq (aref string (1- beg)) ?{)
             (setq table (apply-partially 'completion-table-with-terminator
                                          "}" table)))
@@ -1095,7 +1110,7 @@
         ;; envvar completion to be case-sensitive.
         (let ((completion-ignore-case nil))
           (completion-table-with-context
-           prefix table (substring string beg) pred action))))))
+           prefix table (substring string beg) nil action)))))))
 
 (defun completion-file-name-table (string pred action)
   "Completion table for file names."




reply via email to

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