changeset 90196:82d495f87e7b

Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-64 Merge from emacs--cvs-trunk--0 Patches applied: * emacs--cvs-trunk--0 (patch 424) - Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 15 Jun 2005 23:37:29 +0000
parents a1b34dec1104 (current diff) cdf8e062f1c6 (diff)
children b7da78284d4c
files lisp/ChangeLog lisp/ido.el lispref/ChangeLog lispref/functions.texi lispref/variables.texi
diffstat 5 files changed, 108 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jun 15 23:32:15 2005 +0000
+++ b/lisp/ChangeLog	Wed Jun 15 23:37:29 2005 +0000
@@ -1,3 +1,14 @@
+2005-06-15  Matt Hodges  <MPHodges@member.fsf.org>
+
+	* ido.el (ido-incomplete-regexp): New variable.
+	(ido-set-matches-1): Handle invalid-regexp error and set
+	ido-incomplete-regexp.
+	(ido-incomplete-regexp): New face.
+	(ido-completions): Use it.
+	(ido-complete, ido-exit-minibuffer, ido-completions): Handle
+	incomplete regexps.
+	(ido-completions): Add check for complete match when entering a regexp.
+
 2005-06-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* subr.el (add-to-ordered-list): Use a weak hash-table to avoid leaks.
@@ -28,7 +39,7 @@
 
 	* progmodes/ld-script.el (ld-script-location-counter):
 	Remove "-face" suffix from face name.
-	(ld-script-location-counter-face): 
+	(ld-script-location-counter-face):
 	New backward-compatibility alias for renamed face.
 	(ld-script-location-counter-face): Use renamed face.
 
@@ -103,7 +114,7 @@
 	(ebrowse-tree-mark-face, ebrowse-root-class-face)
 	(ebrowse-file-name-face, ebrowse-default-face)
 	(ebrowse-member-attribute-face, ebrowse-member-class-face)
-	(ebrowse-progress-face): 
+	(ebrowse-progress-face):
 	New backward-compatibility aliases for renamed faces.
 	(ebrowse-show-progress, ebrowse-show-file-name-at-point)
 	(ebrowse-set-mark-props, ebrowse-draw-tree-fn)
--- a/lisp/ido.el	Wed Jun 15 23:32:15 2005 +0000
+++ b/lisp/ido.el	Wed Jun 15 23:37:29 2005 +0000
@@ -770,6 +770,12 @@
   "*Font used by ido for highlighting its indicators."
   :group 'ido)
 
+(defface ido-incomplete-regexp
+  '((t
+     (:inherit font-lock-warning-face)))
+  "Ido face for indicating incomplete regexps."
+  :group 'ido)
+
 (defcustom ido-make-file-list-hook  nil
   "*List of functions to run when the list of matching files is created.
 Each function on the list may modify the dynamically bound variable
@@ -959,6 +965,8 @@
 Is set by ido functions to the current minibuffer-depth, so that
 it doesn't interfere with other minibuffer usage.")
 
+(defvar ido-incomplete-regexp nil
+  "Non-nil if an incomplete regexp is entered.")
 
 ;;; Variables with dynamic bindings.
 ;;; Declared here to keep the byte compiler quiet.
@@ -2170,6 +2178,9 @@
   (interactive)
   (let (res)
     (cond
+     (ido-incomplete-regexp
+      ;; Do nothing
+      )
      ((and (memq ido-cur-item '(file dir))
 	   (string-match "[$]" ido-text))
       (let ((evar (substitute-in-file-name (concat ido-current-directory ido-text))))
@@ -2394,8 +2405,9 @@
 (defun ido-exit-minibuffer ()
   "Exit minibuffer, but make sure we have a match if one is needed."
   (interactive)
-  (if (or (not ido-require-match)
-	   (ido-existing-item-p))
+  (if (and (or (not ido-require-match)
+               (ido-existing-item-p))
+           (not ido-incomplete-regexp))
       (exit-minibuffer)))
 
 (defun ido-select-text ()
@@ -3275,22 +3287,30 @@
 	 full-matches
 	 prefix-matches
 	 matches)
-    (mapcar
-     (lambda (item)
-       (let ((name (ido-name item)))
-	 (if (and (or non-prefix-dot
-		      (if (= (aref ido-text 0) ?.)
-			  (= (aref name 0) ?.)
-			(/= (aref name 0) ?.)))
-		  (string-match re name))
-	     (cond
-	      ((and full-re (string-match full-re name))
-	       (setq full-matches (cons item full-matches)))
-	      ((and prefix-re (string-match prefix-re name))
-	       (setq prefix-matches (cons item prefix-matches)))
-	      (t (setq matches (cons item matches))))))
-       t)
-     items)
+    (setq ido-incomplete-regexp nil)
+    (condition-case error
+        (mapcar
+         (lambda (item)
+           (let ((name (ido-name item)))
+             (if (and (or non-prefix-dot
+                          (if (= (aref ido-text 0) ?.)
+                              (= (aref name 0) ?.)
+                            (/= (aref name 0) ?.)))
+                      (string-match re name))
+                 (cond
+                  ((and full-re (string-match full-re name))
+                   (setq full-matches (cons item full-matches)))
+                  ((and prefix-re (string-match prefix-re name))
+                   (setq prefix-matches (cons item prefix-matches)))
+                  (t (setq matches (cons item matches))))))
+           t)
+         items)
+      (invalid-regexp
+       (setq ido-incomplete-regexp t
+             ;; Consider the invalid regexp message internally as a
+             ;; special-case single match, and handle appropriately
+             ;; elsewhere.
+             matches (cdr error))))
     (if prefix-matches
 	(setq matches (nconc prefix-matches matches)))
     (if full-matches
@@ -4048,7 +4068,9 @@
 	  (setq first (format "%s" fn))
 	  (put-text-property 0 ln 'face
 			     (if (= (length comps) 1)
-				 'ido-only-match
+                                 (if ido-incomplete-regexp
+                                     'ido-incomplete-regexp
+                                   'ido-only-match)
 			       'ido-first-match)
 			     first)
 	  (if ind (setq first (concat first ind)))
@@ -4063,14 +4085,22 @@
 	    (ido-report-no-match
 	     (nth 6 ido-decorations))  ;; [No match]
 	    (t "")))
-
+	  (ido-incomplete-regexp
+           (concat " " (car comps)))
 	  ((null (cdr comps))		;one match
-	   (concat (if (> (length (ido-name (car comps))) (length name))
-		       ;; when there is one match, show the matching file name in full
-		       (concat (nth 4 ido-decorations)  ;; [ ... ]
-			       (ido-name (car comps))
-			       (nth 5 ido-decorations))
-		     "")
+	   (concat (if (if (not ido-enable-regexp)
+                           (= (length (ido-name (car comps))) (length name))
+                         ;; We can't rely on the length of the input
+                         ;; for regexps, so explicitly check for a
+                         ;; complete match
+                         (string-match name (ido-name (car comps)))
+                         (string-equal (match-string 0 (ido-name (car comps)))
+                                       (ido-name (car comps))))
+                       ""
+                     ;; when there is one match, show the matching file name in full
+                     (concat (nth 4 ido-decorations)  ;; [ ... ]
+                             (ido-name (car comps))
+                             (nth 5 ido-decorations)))
 		   (if (not ido-use-faces) (nth 7 ido-decorations))))  ;; [Matched]
 	  (t				;multiple matches
 	   (let* ((items (if (> ido-max-prospects 0) (1+ ido-max-prospects) 999))
--- a/lispref/ChangeLog	Wed Jun 15 23:32:15 2005 +0000
+++ b/lispref/ChangeLog	Wed Jun 15 23:37:29 2005 +0000
@@ -1,3 +1,12 @@
+2005-06-16  Juanma Barranquero  <lekktu@gmail.com>
+
+	* functions.texi (Obsolete Functions): Update argument names of
+	`make-obsolete' and `define-obsolete-function-alias'.
+
+	* variables.texi (Variable Aliases): Update argument names of
+	`defvaralias', `make-obsolete-variable' and
+	`define-obsolete-variable-alias'.
+
 2005-06-15  Kim F. Storm  <storm@cua.dk>
 
 	* searching.texi (Entire Match Data): Rephrase warnings about
--- a/lispref/functions.texi	Wed Jun 15 23:32:15 2005 +0000
+++ b/lispref/functions.texi	Wed Jun 15 23:37:29 2005 +0000
@@ -1157,13 +1157,14 @@
 You can use @code{make-obsolete} to declare a function obsolete.  This
 indicates that the function may be removed at some stage in the future.
 
-@defun make-obsolete function new &optional when
+@defun make-obsolete obsolete-name current-name &optional when
 This function makes the byte compiler warn that the function
-@var{function} is obsolete.  If @var{new} is a symbol, the warning
-message says to use @var{new} instead of @var{function}.  @var{new}
-does not need to be an alias for @var{function}; it can be a different
-function with similar functionality.  If @var{new} is a string, it is
-the warning message.
+@var{obsolete-name} is obsolete.  If @var{current-name} is a symbol, the
+warning message says to use @var{current-name} instead of
+@var{obsolete-name}.  @var{current-name} does not need to be an alias for
+@var{obsolete-name}; it can be a different function with similar
+functionality.  If @var{current-name} is a string, it is the warning
+message.
 
 If provided, @var{when} should be a string indicating when the function
 was first made obsolete---for example, a date or a release number.
@@ -1172,9 +1173,10 @@
 You can define a function as an alias and declare it obsolete at the
 same time using the macro @code{define-obsolete-function-alias}.
 
-@defmac define-obsolete-function-alias function new &optional when docstring
-This macro marks the function @var{function} obsolete and also defines
-it as an alias for the function @var{new}.  A typical call has the form:
+@defmac define-obsolete-function-alias obsolete-name current-name &optional when docstring
+This macro marks the function @var{obsolete-name} obsolete and also defines
+it as an alias for the function @var{current-name}.  A typical call has the
+form:
 
 @example
 (define-obsolete-function-alias 'old-fun 'new-fun "22.1" "Doc.")
--- a/lispref/variables.texi	Wed Jun 15 23:32:15 2005 +0000
+++ b/lispref/variables.texi	Wed Jun 15 23:37:29 2005 +0000
@@ -1785,19 +1785,19 @@
 to keep the old name as an @emph{alias} of the new one for
 compatibility.  You can do this with @code{defvaralias}.
 
-@defun defvaralias alias-var base-var &optional docstring
-This function defines the symbol @var{alias-var} as a variable alias
-for symbol @var{base-var}. This means that retrieving the value of
-@var{alias-var} returns the value of @var{base-var}, and changing the
-value of @var{alias-var} changes the value of @var{base-var}.
+@defun defvaralias new-alias base-variable &optional docstring
+This function defines the symbol @var{new-alias} as a variable alias
+for symbol @var{base-variable}. This means that retrieving the value of
+@var{new-alias} returns the value of @var{base-variable}, and changing the
+value of @var{new-alias} changes the value of @var{base-variable}.
 
 If the @var{docstring} argument is non-@code{nil}, it specifies the
-documentation for @var{alias-var}; otherwise, the alias gets the same
-documentation as @var{base-var} has, if any, unless @var{base-var} is
-itself an alias, in which case @var{alias-var} gets the documentation
-of the variable at the end of the chain of aliases.
+documentation for @var{new-alias}; otherwise, the alias gets the same
+documentation as @var{base-variable} has, if any, unless
+@var{base-variable} is itself an alias, in which case @var{new-alias} gets
+the documentation of the variable at the end of the chain of aliases.
 
-This function returns @var{base-var}.
+This function returns @var{base-variable}.
 @end defun
 
   Variable aliases are convenient for replacing an old name for a
@@ -1805,12 +1805,12 @@
 the old name is obsolete and therefore that it may be removed at some
 stage in the future.
 
-@defun make-obsolete-variable variable new &optional when
+@defun make-obsolete-variable obsolete-name current-name &optional when
 This function makes the byte-compiler warn that the variable
-@var{variable} is obsolete.  If @var{new} is a symbol, it is the
-variable's new name; then the warning message says to use @var{new}
-instead of @var{variable}.  If @var{new} is a string, this is the
-message and there is no replacement variable.
+@var{obsolete-name} is obsolete.  If @var{current-name} is a symbol, it is
+the variable's new name; then the warning message says to use
+@var{current-name} instead of @var{obsolete-name}.  If @var{current-name}
+is a string, this is the message and there is no replacement variable.
 
 If provided, @var{when} should be a string indicating when the
 variable was first made obsolete---for example, a date or a release
@@ -1820,9 +1820,10 @@
   You can make two variables synonyms and declare one obsolete at the
 same time using the macro @code{define-obsolete-variable-alias}.
 
-@defmac define-obsolete-variable-alias variable new &optional when docstring
-This macro marks the variable @var{variable} as obsolete and also
-makes it an alias for the variable @var{new}.  A typical call has the form:
+@defmac define-obsolete-variable-alias obsolete-name current-name &optional when docstring
+This macro marks the variable @var{obsolete-name} as obsolete and also
+makes it an alias for the variable @var{current-name}.  A typical call has
+the form:
 
 @example
 (define-obsolete-variable-alias 'old-var 'new-var "22.1" "Doc.")