unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* use of minibuffer in interactive spec code
@ 2010-05-18 17:11 Drew Adams
  2010-05-18 17:27 ` Drew Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Drew Adams @ 2010-05-18 17:11 UTC (permalink / raw)
  To: emacs-devel

I don't know if this is a bug or a bug fix. I would like to get some info about
it, if possible, to understand better. The behavior in this respect is new in
Emacs 23.2. It changed apparently sometime after this build:

GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2009-01-15 on LENNART-69DE564

I have this command, which is bound to a key during minibuffer completion in a
couple of cases:

(defun foo (dir)
  (interactive
   (list (read-directory-name
          "Dir: " nil nil
          (and (member cd-path '(nil ("./")))
               (null (getenv "CDPATH"))))))
  (cd dir)
  (...))

The `...' part makes use of the current value of
`minibuffer-completion-predicate'. It expects the value that that variable had
before this command was entered.

It turns out that I now need to bind `minibuffer-completion-predicate' in the
interactive spec. Otherwise, it has the value that is used for
`read-directory-name', which is `file-directory-p'.

(defun foo (dir)
  (interactive
   (let ((minibuffer-completion-predicate ; PROTECT IT
          minibuffer-completion-predicate))
     (list (read-directory-name
            "Dir: " default-directory default-directory
            (and (member cd-path '(nil ("./")))
                 (null (getenv "CDPATH")))))))
  (cd dir)
  (...))

It took me a while to discover this.

There was no change in the definition of `read-directory-name' between the two
Emacs builds mentioned. There was apparently a change in how the `interactive'
code is treated.

Previously, any recursive minibuffer use in the `interactive' spec was
apparently walled off from the body of the command, in the sense that
`minibuffer-completion-predicate' was not changed by that recursive minibuffer
read. That is no longer the case.

Is the new behavior intended?  Was it changed to fix some bug, as an enhancement
somehow, or by mistake?  Thx.





^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2010-05-20 21:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-18 17:11 use of minibuffer in interactive spec code Drew Adams
2010-05-18 17:27 ` Drew Adams
2010-05-18 20:39 ` Stefan Monnier
2010-05-19  3:27 ` Stefan Monnier
2010-05-19 12:44   ` Drew Adams
2010-05-19 15:39     ` Stefan Monnier
2010-05-19 16:40       ` Drew Adams
2010-05-19 17:41         ` Stefan Monnier
2010-05-19 16:04     ` Sean Sieger
2010-05-19 16:16       ` Eli Zaretskii
2010-05-19 16:21       ` posting Windows binaries of latest trunk dev code [was: use of minibuffer in interactive spec code] Drew Adams
2010-05-19 17:25         ` Eli Zaretskii
2010-05-19 17:48           ` Drew Adams
2010-05-20 21:19           ` posting Windows binaries of latest trunk dev code Sean Sieger

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).