emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r104041: * lisp/pcomplete.el (pcomple


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104041: * lisp/pcomplete.el (pcomplete-completions-at-point): Return nil if there
Date: Thu, 28 Apr 2011 16:39:11 -0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104041
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2011-04-28 16:39:11 -0300
message:
  * lisp/pcomplete.el (pcomplete-completions-at-point): Return nil if there
  aren't any completions at point.
modified:
  lisp/ChangeLog
  lisp/pcomplete.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-28 19:35:20 +0000
+++ b/lisp/ChangeLog    2011-04-28 19:39:11 +0000
@@ -1,3 +1,8 @@
+2011-04-28  Stefan Monnier  <address@hidden>
+
+       * pcomplete.el (pcomplete-completions-at-point): Return nil if there
+       aren't any completions at point.
+
 2011-04-28  Juanma Barranquero  <address@hidden>
 
        * subr.el (display-delayed-warnings): New function.
@@ -5,6 +10,10 @@
 
 2011-04-28  Stefan Monnier  <address@hidden>
 
+       * minibuffer.el (completion-at-point, completion-help-at-point):
+       Don't presume that a given completion-at-point-function will always
+       use the same calling convention.
+
        * pcomplete.el (pcomplete-completions-at-point):
        Obey pcomplete-ignore-case.  Don't call pcomplete-norm-func unless
        pcomplete-seen is non-nil.

=== modified file 'lisp/pcomplete.el'
--- a/lisp/pcomplete.el 2011-04-28 00:18:12 +0000
+++ b/lisp/pcomplete.el 2011-04-28 19:39:11 +0000
@@ -489,57 +489,57 @@
            ;; prefix from pcomplete-stub.
            (beg (max (- (point) (length pcomplete-stub))
                      (pcomplete-begin)))
-           (buftext (buffer-substring beg (point)))
-           (table
-            (cond
-             ((null completions) nil)
-             ((not (equal pcomplete-stub buftext))
-              ;; This isn't always strictly right (e.g. if
-              ;; FOO="toto/$FOO", then completion of /$FOO/bar may
-              ;; result in something incorrect), but given the lack of
-              ;; any other info, it's about as good as it gets, and in
-              ;; practice it should work just fine (fingers crossed).
-              (let ((prefixes (pcomplete--common-quoted-suffix
-                               pcomplete-stub buftext)))
-                (apply-partially
-                 'pcomplete--table-subvert
-                 completions
-                 (cdr prefixes) (car prefixes))))
-             (t
-              (lexical-let ((completions completions))
-                (lambda (string pred action)
-                  (let ((res (complete-with-action
-                              action completions string pred)))
-                    (if (stringp res)
-                        (pcomplete-quote-argument res)
-                      res)))))))
-           (pred
-            ;; pare it down, if applicable
-            (when (and table pcomplete-use-paring pcomplete-seen)
-              (setq pcomplete-seen
-                    (mapcar (lambda (f)
-                              (funcall pcomplete-norm-func
-                                       (directory-file-name f)))
-                            pcomplete-seen))
-              (lambda (f)
-                (not (when pcomplete-seen
-                       (member
-                        (funcall pcomplete-norm-func
-                                 (directory-file-name f))
-                        pcomplete-seen)))))))
-      (unless (zerop (length pcomplete-termination-string))
-        ;; Add a space at the end of completion.  Use a terminator-regexp
-        ;; that never matches since the terminator cannot appear
-        ;; within the completion field anyway.
-        (setq table
-              (apply-partially #'completion-table-with-terminator
-                               (cons pcomplete-termination-string
-                                     "\\`a\\`")
-                               table)))
-      (when pcomplete-ignore-case
-        (setq table
-              (apply-partially #'completion-table-case-fold table)))
-      (list beg (point) table :predicate pred))))
+           (buftext (buffer-substring beg (point))))
+      (when completions
+        (let ((table
+               (cond
+                ((not (equal pcomplete-stub buftext))
+                 ;; This isn't always strictly right (e.g. if
+                 ;; FOO="toto/$FOO", then completion of /$FOO/bar may
+                 ;; result in something incorrect), but given the lack of
+                 ;; any other info, it's about as good as it gets, and in
+                 ;; practice it should work just fine (fingers crossed).
+                 (let ((prefixes (pcomplete--common-quoted-suffix
+                                  pcomplete-stub buftext)))
+                   (apply-partially
+                    'pcomplete--table-subvert
+                    completions
+                    (cdr prefixes) (car prefixes))))
+                (t
+                 (lexical-let ((completions completions))
+                   (lambda (string pred action)
+                     (let ((res (complete-with-action
+                                 action completions string pred)))
+                       (if (stringp res)
+                           (pcomplete-quote-argument res)
+                         res)))))))
+              (pred
+               ;; Pare it down, if applicable.
+               (when (and pcomplete-use-paring pcomplete-seen)
+                 (setq pcomplete-seen
+                       (mapcar (lambda (f)
+                                 (funcall pcomplete-norm-func
+                                          (directory-file-name f)))
+                               pcomplete-seen))
+                 (lambda (f)
+                   (not (when pcomplete-seen
+                          (member
+                           (funcall pcomplete-norm-func
+                                    (directory-file-name f))
+                           pcomplete-seen)))))))
+          (unless (zerop (length pcomplete-termination-string))
+            ;; Add a space at the end of completion.  Use a terminator-regexp
+            ;; that never matches since the terminator cannot appear
+            ;; within the completion field anyway.
+            (setq table
+                  (apply-partially #'completion-table-with-terminator
+                                   (cons pcomplete-termination-string
+                                         "\\`a\\`")
+                                   table)))
+          (when pcomplete-ignore-case
+            (setq table
+                  (apply-partially #'completion-table-case-fold table)))
+          (list beg (point) table :predicate pred))))))
 
  ;; I don't think such commands are usable before first setting up buffer-local
  ;; variables to parse args, so there's no point autoloading it.


reply via email to

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