Subject: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first

From: "Drew Adams" <[email-masked]>
Date: Sat, 9 Mar 2013 09:14:41 -0800

> > Do you at least see why your *Messages* logged `exit-minibuffer'?
> 
> ,---- In `read-regexp'
> | +  (let ((user-defaults (read-regexp-defaults)))
> | +    (unless (eq user-defaults t)
> | +      (setq defaults user-defaults)
> | +      (message "cmd: %s defaults: %S" this-command defaults)))
> | +
> `----
> 
> cmd: exit-minibuffer defaults: nil
> 
> > Your code checks only (eq user-defaults t).  When 
> > `user-defaults' is nil, this returns nil.
> 
> The cmd is `exit-minibuffer'.  That corresponds to RET in minibuffer
> map.  I have no other explanation.
> 
> Btw, your explanation is *totally* off the mark.  It talks about
> defaults in my snippet and not the cmd.

NOW I suppose I AM dealing with a dead horse.  But in hopes of helping and at
the risk of being told once more to f___ off, let me try once more:

+(defun read-regexp-defaults ()
+  (if (not read-regexp-user-defaults) t
+    (let ((user-default (assoc this-command read-regexp-user-defaults)))
+      (pcase user-default
+	  (`(,cmd ,(and (pred functionp) getter))
+	   (funcall getter))
+	  (`nil nil)
+	  (_ t)))))

Don't you think that that will return nil when `this-command' =
`exit-minibuffer', since `exit-minibuffer' is not in your value of alist
`read-regexp-user-defaults'?

And if it returns nil, don't you think that the following will then print `cmd:
exit-minibuffer defaults: nil'?

+  (let ((user-defaults (read-regexp-defaults)))
+    (unless (eq user-defaults t)
+      (setq defaults user-defaults)
+      (message "cmd: %s defaults: %S" this-command defaults)))

If this doesn't help, I give up and lie down next to your dead horse.