bug-gnu-emacs
[Top][All Lists]
Advanced

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

Re: completing-read-multiple in Emacs 21.x


From: Kevin Rodgers
Subject: Re: completing-read-multiple in Emacs 21.x
Date: Fri, 05 May 2006 09:11:22 -0600
User-agent: Thunderbird 1.5.0.2 (Windows/20060308)

Kevin Rodgers wrote:
> Sebastian Luque wrote:
> > In both versions though, the DEF argument (last one in the
> > expression above) seems to be completely ignored, as '("")' is
> > returned in the 22.0.50.1 version, and "[No match]" is displayed in
> > the minibuffer of Emacs 21.x.  Can somebody please point out what is
> > going on or suggest an alternative to reading multiple strings from
> > a single minibuffer prompt?
>
> That seems to be a bug in both versions, due to the fact that
> completing-read-multiple assumes the result from calling
> read-from-minibuffer will always be DEF and never "".  But
> read-from-minibuffer's doc string warns:
>
> | Sixth arg DEFAULT-VALUE is the default value. If non-nil, it is available > | for history commands; but, unless READ is non-nil, `read-from-minibuffer' > | does NOT return DEFAULT-VALUE if the user enters empty input! It returns
> |   the empty string.
>
> (And of course READ is nil in this case.)  That bug can be fixed with
> this patch (differences due to re-indentation are suppressed):

Sorry, that patch has its own bug: when DEF is nil, split-string signals
"Wrong type argument: stringp, nil".  Here's the corrected patch:

*** lisp/emacs-lisp/crm.el~     2006-04-22 06:42:06.875000000 -0600
--- lisp/emacs-lisp/crm.el      2006-05-05 09:07:55.249360000 -0600
***************
*** 592,598 ****
  See the documentation for `completing-read' for details on the arguments:
  PROMPT, TABLE, PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF, and
  INHERIT-INPUT-METHOD."
!   (let ((minibuffer-completion-table (function crm-collection-fn))
        (minibuffer-completion-predicate predicate)
        ;; see completing_read in src/minibuf.c
        (minibuffer-completion-confirm
--- 592,598 ----
  See the documentation for `completing-read' for details on the arguments:
  PROMPT, TABLE, PREDICATE, REQUIRE-MATCH, INITIAL-INPUT, HIST, DEF, and
  INHERIT-INPUT-METHOD."
!   (let* ((minibuffer-completion-table (function crm-collection-fn))
         (minibuffer-completion-predicate predicate)
         ;; see completing_read in src/minibuf.c
         (minibuffer-completion-confirm
***************
*** 606,615 ****
        crm-end-of-element
        (map (if require-match
                 crm-local-must-match-map
!              crm-local-completion-map)))
!     (split-string (read-from-minibuffer
!                  prompt initial-input map
!                  nil hist def inherit-input-method)
                  crm-separator)))

  ;; testing and debugging
--- 606,618 ----
         crm-end-of-element
         (map (if require-match
                  crm-local-must-match-map
!               crm-local-completion-map))
!        (minibuffer-string (read-from-minibuffer prompt
!                                                 initial-input map nil hist def
!                                                 inherit-input-method)))
!     (split-string (if (equal minibuffer-string "")
!                     (or def "")
!                   minibuffer-string)
                  crm-separator)))

  ;; testing and debugging

--
Kevin





reply via email to

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