aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2009-10-26 04:06:01 +0000
committerStefan Monnier2009-10-26 04:06:01 +0000
commit0667de2146b9f62e66133f9eca6393e0bb00274c (patch)
treed32a4d9f4881e3c20afda6f3ac0c560f4af611b6
parent4fcc3d324ae3033ec990687ad0d753a8f2a4b868 (diff)
downloademacs-0667de2146b9f62e66133f9eca6393e0bb00274c.tar.gz
emacs-0667de2146b9f62e66133f9eca6393e0bb00274c.zip
(pcomplete-std-complete): Obey pcomplete-use-paring.
(pcomplete, pcomplete-parse-buffer-arguments, pcomplete-opt) (pcomplete--here): Use push.
-rw-r--r--etc/NEWS3
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/pcomplete.el46
3 files changed, 36 insertions, 17 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 1788101ce92..49a645bc47a 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -135,6 +135,9 @@ For instance, this can complete M-x lch to list-command-history.
135 135
136* Changes in Specialized Modes and Packages in Emacs 23.2 136* Changes in Specialized Modes and Packages in Emacs 23.2
137 137
138** pcomplete provides a new command `pcomplete-std-completion' which
139is similar to `pcomplete' but using the standard completion UI code.
140
138** .calc.el and .abbrev_defs obey user-emacs-directory. 141** .calc.el and .abbrev_defs obey user-emacs-directory.
139 142
140** Calc graphing commands (`g f' etc.) now work on MS-Windows, 143** Calc graphing commands (`g f' etc.) now work on MS-Windows,
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4e210449f1f..8a04c228c53 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
12009-10-26 Stefan Monnier <monnier@iro.umontreal.ca> 12009-10-26 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * pcomplete.el (pcomplete-std-complete): Obey pcomplete-use-paring.
4 (pcomplete, pcomplete-parse-buffer-arguments, pcomplete-opt)
5 (pcomplete--here): Use push.
6
3 * subr.el (all-completions): Declare the 4th arg obsolete. 7 * subr.el (all-completions): Declare the 4th arg obsolete.
4 8
52009-10-25 Stefan Monnier <monnier@iro.umontreal.ca> 92009-10-25 Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 371b61eea1b..f0296532ca9 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -448,7 +448,8 @@ in the same way as TABLE completes strings of the form (concat S2 S)."
448 "Provide standard completion using pcomplete's completion tables. 448 "Provide standard completion using pcomplete's completion tables.
449Same as `pcomplete' but using the standard completion UI." 449Same as `pcomplete' but using the standard completion UI."
450 (interactive) 450 (interactive)
451 ;; FIXME: it doesn't implement paring. 451 ;; FIXME: it only completes the text before point, whereas the
452 ;; standard UI may also consider text after point.
452 (catch 'pcompleted 453 (catch 'pcompleted
453 (let* ((pcomplete-stub) 454 (let* ((pcomplete-stub)
454 pcomplete-seen pcomplete-norm-func 455 pcomplete-seen pcomplete-norm-func
@@ -497,7 +498,20 @@ Same as `pcomplete' but using the standard completion UI."
497 action completions string pred))) 498 action completions string pred)))
498 (if (stringp res) 499 (if (stringp res)
499 (pcomplete-quote-argument res) 500 (pcomplete-quote-argument res)
500 res))))))) 501 res))))))
502 (pred
503 ;; pare it down, if applicable
504 (when (and pcomplete-use-paring pcomplete-seen)
505 (setq pcomplete-seen
506 (mapcar (lambda (f)
507 (funcall pcomplete-norm-func
508 (directory-file-name f)))
509 pcomplete-seen))
510 (lambda (f)
511 (not (member
512 (funcall pcomplete-norm-func
513 (directory-file-name f))
514 pcomplete-seen))))))
501 515
502 (let ((ol (make-overlay beg (point) nil nil t)) 516 (let ((ol (make-overlay beg (point) nil nil t))
503 (minibuffer-completion-table 517 (minibuffer-completion-table
@@ -510,7 +524,7 @@ Same as `pcomplete' but using the standard completion UI."
510 (cons pcomplete-termination-string 524 (cons pcomplete-termination-string
511 "\\`a\\`") 525 "\\`a\\`")
512 table))) 526 table)))
513 (minibuffer-completion-predicate nil)) 527 (minibuffer-completion-predicate pred))
514 (overlay-put ol 'field 'pcomplete) 528 (overlay-put ol 'field 'pcomplete)
515 (unwind-protect 529 (unwind-protect
516 (call-interactively 'minibuffer-complete) 530 (call-interactively 'minibuffer-complete)
@@ -534,9 +548,8 @@ completion functions list (it should occur fairly early in the list)."
534 (delete-backward-char pcomplete-last-completion-length) 548 (delete-backward-char pcomplete-last-completion-length)
535 (if (eq this-command 'pcomplete-reverse) 549 (if (eq this-command 'pcomplete-reverse)
536 (progn 550 (progn
537 (setq pcomplete-current-completions 551 (push (car (last pcomplete-current-completions))
538 (cons (car (last pcomplete-current-completions)) 552 pcomplete-current-completions)
539 pcomplete-current-completions))
540 (setcdr (last pcomplete-current-completions 2) nil)) 553 (setcdr (last pcomplete-current-completions 2) nil))
541 (nconc pcomplete-current-completions 554 (nconc pcomplete-current-completions
542 (list (car pcomplete-current-completions))) 555 (list (car pcomplete-current-completions)))
@@ -744,12 +757,12 @@ user actually typed in."
744 (goto-char begin) 757 (goto-char begin)
745 (while (< (point) end) 758 (while (< (point) end)
746 (skip-chars-forward " \t\n") 759 (skip-chars-forward " \t\n")
747 (setq begins (cons (point) begins)) 760 (push (point) begins)
748 (skip-chars-forward "^ \t\n") 761 (skip-chars-forward "^ \t\n")
749 (setq args (cons (buffer-substring-no-properties 762 (push (buffer-substring-no-properties
750 (car begins) (point)) 763 (car begins) (point))
751 args))) 764 args))
752 (cons (reverse args) (reverse begins))))) 765 (cons (nreverse args) (nreverse begins)))))
753 766
754;;;###autoload 767;;;###autoload
755(defun pcomplete-comint-setup (completef-sym) 768(defun pcomplete-comint-setup (completef-sym)
@@ -974,7 +987,7 @@ behaves, for example."
974 (let ((result (read-from-string options index))) 987 (let ((result (read-from-string options index)))
975 (setq index (cdr result))) 988 (setq index (cdr result)))
976 (unless (memq char '(?/ ?* ?? ?.)) 989 (unless (memq char '(?/ ?* ?? ?.))
977 (setq choices (cons (char-to-string char) choices))) 990 (push (char-to-string char) choices))
978 (setq index (1+ index)))) 991 (setq index (1+ index))))
979 (throw 'pcomplete-completions 992 (throw 'pcomplete-completions
980 (mapcar 993 (mapcar
@@ -1022,11 +1035,10 @@ See the documentation for `pcomplete-here'."
1022 (unless (eq paring t) 1035 (unless (eq paring t)
1023 (let ((arg (pcomplete-arg))) 1036 (let ((arg (pcomplete-arg)))
1024 (when (stringp arg) 1037 (when (stringp arg)
1025 (setq pcomplete-seen 1038 (push (if paring
1026 (cons (if paring 1039 (funcall paring arg)
1027 (funcall paring arg) 1040 (file-truename arg))
1028 (file-truename arg)) 1041 pcomplete-seen)))))
1029 pcomplete-seen))))))
1030 (pcomplete-next-arg) 1042 (pcomplete-next-arg)
1031 t) 1043 t)
1032 (when pcomplete-show-help 1044 (when pcomplete-show-help