X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/b0126eac41487b9bca5af5cbb2212ff5b2c58b80..68af8d4fc3bcdf9c9123f66283d0005cf91e34b0:/lisp/icomplete.el diff --git a/lisp/icomplete.el b/lisp/icomplete.el index 645981539d..a971965195 100644 --- a/lisp/icomplete.el +++ b/lisp/icomplete.el @@ -1,7 +1,7 @@ ;;; icomplete.el --- minibuffer completion incremental feedback -;; Copyright (C) 1992, 1993, 1994, 1997, 1999, 2001, 2002, 2003, -;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +;; Copyright (C) 1992-1994, 1997, 1999, 2001-2012 +;; Free Software Foundation, Inc. ;; Author: Ken Manheimer ;; Maintainer: Ken Manheimer @@ -172,9 +172,10 @@ except those on this list.") ;;;_ > icomplete-mode (&optional prefix) ;;;###autoload (define-minor-mode icomplete-mode - "Toggle incremental minibuffer completion for this Emacs session. -With a numeric argument, turn Icomplete mode on if ARG is positive, -otherwise turn it off." + "Toggle incremental minibuffer completion (Icomplete mode). +With a prefix argument ARG, enable Icomplete mode if ARG is +positive, and disable it otherwise. If called from Lisp, enable +the mode if ARG is omitted or nil." :global t :group 'icomplete (if icomplete-mode ;; The following is not really necessary after first time - @@ -206,6 +207,7 @@ Conditions are: "Run in minibuffer on activation to establish incremental completion. Usually run by inclusion in `minibuffer-setup-hook'." (when (and icomplete-mode (icomplete-simple-completing-p)) + (set (make-local-variable 'completion-show-inline-help) nil) (add-hook 'pre-command-hook (lambda () (run-hooks 'icomplete-pre-command-hook)) nil t) @@ -284,6 +286,7 @@ matches exist. \(Keybindings for uniquely matched commands are exhibited within the square braces.)" (let* ((non-essential t) + (md (completion--field-metadata (field-beginning))) (comps (completion-all-sorted-completions)) (last (if (consp comps) (last comps))) (base-size (cdr last)) @@ -296,11 +299,11 @@ are exhibited within the square braces.)" (let* ((most-try (if (and base-size (> base-size 0)) (completion-try-completion - name candidates predicate (length name)) + name candidates predicate (length name) md) ;; If the `comps' are 0-based, the result should be ;; the same with `comps'. (completion-try-completion - name comps nil (length name)))) + name comps nil (length name) md))) (most (if (consp most-try) (car most-try) (if most-try (car comps) ""))) ;; Compare name and most, so we can determine if name is @@ -344,7 +347,9 @@ are exhibited within the square braces.)" (setq prospects nil) (while (and comps (not limit)) (setq comp - (if prefix-len (substring (car comps) prefix-len) (car comps)) + (if (and prefix-len (<= prefix-len (length (car comps)))) + (substring (car comps) prefix-len) + (car comps)) comps (cdr comps)) (cond ((string-equal comp "") (setq most-is-exact t)) ((member comp prospects)) @@ -376,5 +381,4 @@ are exhibited within the square braces.)" ;;allout-layout: (-2 :) ;;End: -;; arch-tag: 339ec25a-0741-4eb6-be63-997532e89b0f ;;; icomplete.el ends here