emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/pcomplete.el


From: Stefan Monnier
Subject: [Emacs-diffs] emacs etc/NEWS lisp/ChangeLog lisp/pcomplete.el
Date: Mon, 26 Oct 2009 04:06:05 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Stefan Monnier <monnier>        09/10/26 04:06:05

Modified files:
        etc            : NEWS 
        lisp           : ChangeLog pcomplete.el 

Log message:
        (pcomplete-std-complete): Obey pcomplete-use-paring.
        (pcomplete, pcomplete-parse-buffer-arguments, pcomplete-opt)
        (pcomplete--here): Use push.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/etc/NEWS?cvsroot=emacs&r1=1.2108&r2=1.2109
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16510&r2=1.16511
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/pcomplete.el?cvsroot=emacs&r1=1.43&r2=1.44

Patches:
Index: etc/NEWS
===================================================================
RCS file: /sources/emacs/emacs/etc/NEWS,v
retrieving revision 1.2108
retrieving revision 1.2109
diff -u -b -r1.2108 -r1.2109
--- etc/NEWS    26 Oct 2009 03:39:15 -0000      1.2108
+++ etc/NEWS    26 Oct 2009 04:06:01 -0000      1.2109
@@ -135,6 +135,9 @@
 
 * Changes in Specialized Modes and Packages in Emacs 23.2
 
+** pcomplete provides a new command `pcomplete-std-completion' which
+is similar to `pcomplete' but using the standard completion UI code.
+
 ** .calc.el and .abbrev_defs obey user-emacs-directory.
 
 ** Calc graphing commands (`g f' etc.) now work on MS-Windows,

Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16510
retrieving revision 1.16511
diff -u -b -r1.16510 -r1.16511
--- lisp/ChangeLog      26 Oct 2009 03:39:16 -0000      1.16510
+++ lisp/ChangeLog      26 Oct 2009 04:06:02 -0000      1.16511
@@ -1,5 +1,9 @@
 2009-10-26  Stefan Monnier  <address@hidden>
 
+       * pcomplete.el (pcomplete-std-complete): Obey pcomplete-use-paring.
+       (pcomplete, pcomplete-parse-buffer-arguments, pcomplete-opt)
+       (pcomplete--here): Use push.
+
        * subr.el (all-completions): Declare the 4th arg obsolete.
 
 2009-10-25  Stefan Monnier  <address@hidden>

Index: lisp/pcomplete.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/pcomplete.el,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- lisp/pcomplete.el   25 Oct 2009 20:38:09 -0000      1.43
+++ lisp/pcomplete.el   26 Oct 2009 04:06:05 -0000      1.44
@@ -448,7 +448,8 @@
   "Provide standard completion using pcomplete's completion tables.
 Same as `pcomplete' but using the standard completion UI."
   (interactive)
-  ;; FIXME: it doesn't implement paring.
+  ;; FIXME: it only completes the text before point, whereas the
+  ;; standard UI may also consider text after point.
   (catch 'pcompleted
     (let* ((pcomplete-stub)
            pcomplete-seen pcomplete-norm-func
@@ -497,7 +498,20 @@
                               action completions string pred)))
                     (if (stringp res)
                         (pcomplete-quote-argument res)
-                      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 (member
+                      (funcall pcomplete-norm-func
+                               (directory-file-name f))
+                      pcomplete-seen))))))
 
       (let ((ol (make-overlay beg (point) nil nil t))
             (minibuffer-completion-table
@@ -510,7 +524,7 @@
                                 (cons pcomplete-termination-string
                                       "\\`a\\`")
                                 table)))
-            (minibuffer-completion-predicate nil))
+            (minibuffer-completion-predicate pred))
         (overlay-put ol 'field 'pcomplete)
         (unwind-protect
             (call-interactively 'minibuffer-complete)
@@ -534,9 +548,8 @@
        (delete-backward-char pcomplete-last-completion-length)
        (if (eq this-command 'pcomplete-reverse)
            (progn
-             (setq pcomplete-current-completions
-                   (cons (car (last pcomplete-current-completions))
-                         pcomplete-current-completions))
+              (push (car (last pcomplete-current-completions))
+                    pcomplete-current-completions)
              (setcdr (last pcomplete-current-completions 2) nil))
          (nconc pcomplete-current-completions
                 (list (car pcomplete-current-completions)))
@@ -744,12 +757,12 @@
       (goto-char begin)
       (while (< (point) end)
        (skip-chars-forward " \t\n")
-       (setq begins (cons (point) begins))
+       (push (point) begins)
        (skip-chars-forward "^ \t\n")
-       (setq args (cons (buffer-substring-no-properties
+       (push (buffer-substring-no-properties
                          (car begins) (point))
-                        args)))
-      (cons (reverse args) (reverse begins)))))
+              args))
+      (cons (nreverse args) (nreverse begins)))))
 
 ;;;###autoload
 (defun pcomplete-comint-setup (completef-sym)
@@ -974,7 +987,7 @@
              (let ((result (read-from-string options index)))
                (setq index (cdr result)))
            (unless (memq char '(?/ ?* ?? ?.))
-             (setq choices (cons (char-to-string char) choices)))
+             (push (char-to-string char) choices))
            (setq index (1+ index))))
        (throw 'pcomplete-completions
               (mapcar
@@ -1022,11 +1035,10 @@
          (unless (eq paring t)
            (let ((arg (pcomplete-arg)))
              (when (stringp arg)
-               (setq pcomplete-seen
-                     (cons (if paring
+                (push (if paring
                                (funcall paring arg)
                              (file-truename arg))
-                           pcomplete-seen))))))
+                      pcomplete-seen)))))
        (pcomplete-next-arg)
        t)
     (when pcomplete-show-help




reply via email to

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