GNU bug report logs - #13687
24.3.50; `read-regexp' should provide regex for symbol at point as defaults

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Mon, 11 Feb 2013 06:30:02 UTC

Severity: wishlist

Found in version 24.3.50

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Jambunathan K'" <kjambunathan <at> gmail.com>
Cc: 'Juri Linkov' <juri <at> jurta.org>, 13687 <at> debbugs.gnu.org
Subject: bug#13687: /srv/bzr/emacs/trunk r111878: * lisp/replace.el(read-regexp): Let-bind `default' to the first
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.





This bug report was last modified 12 years and 68 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.