all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: use of minibuffer in interactive spec code
Date: Tue, 18 May 2010 10:11:14 -0700	[thread overview]
Message-ID: <3E79AA18AD2A4001A33DE551781D3CB1@us.oracle.com> (raw)

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.





             reply	other threads:[~2010-05-18 17:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18 17:11 Drew Adams [this message]
2010-05-18 17:27 ` use of minibuffer in interactive spec code 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E79AA18AD2A4001A33DE551781D3CB1@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.