unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#4631: 23.1; Warnings from repeat.el
       [not found] <5DDA07B831D643C5940FEFB414D6D6AF@us.oracle.com>
@ 2009-10-04 16:49 ` Stefan Monnier
  2009-10-04 18:59   ` Drew Adams
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Monnier @ 2009-10-04 16:49 UTC (permalink / raw)
  To: Drew Adams; +Cc: 4631, bug-gnu-emacs

>>>>> "Drew" == Drew Adams <drew.adams@oracle.com> writes:

> emacs -Q
> I have some code that looks like this:
 
> (defun repeat-command (command)
>   "Repeat COMMAND."
>  (let ((repeat-previous-repeated-command  command)
>        (repeat-message-function           'ignore)
>        (last-repeatable-command           'repeat))
>    (repeat nil)))
 
> (defun foo (arg)
>   (interactive "P")
>   (repeat-command 'bar))
 
> When I use `foo', I see these warnings in *Messages* (and briefly in
> the echo area):
 
>  Warning: defvar ignored because repeat-message-function is let-bound
>  Warning: defvar ignored because repeat-previous-repeated-command is let-bound
 
> Is this normal?

Yes: the defvar of those variable (in repeat.el) will be processed when
repeat.el is loaded, which in your case, happens when `repeat' is called
(it's loaded via autoload), i.e. at that point where you've let-bound
them, so when you get out of the let, those variables will be
incorrectly set back to unbound (i.e. the defvar will have had no effect).

> A good idea? Avoidable?

Do (require 'repeat) sometime before the let.

> Dunno which defvars are involved; it seems they are defvars in
> `repeat.el'.  Why not mention the defvar's variable in the
> message, BTW?

It is mentioned.
 

        Stefan





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

* bug#4631: 23.1; Warnings from repeat.el
  2009-10-04 16:49 ` bug#4631: 23.1; Warnings from repeat.el Stefan Monnier
@ 2009-10-04 18:59   ` Drew Adams
  0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2009-10-04 18:59 UTC (permalink / raw)
  To: 'Stefan Monnier'; +Cc: 4631, bug-gnu-emacs

> > Is this normal?
> 
> Yes: the defvar of those variable (in repeat.el) will be 
> processed when
> repeat.el is loaded, which in your case, happens when 
> `repeat' is called
> (it's loaded via autoload), i.e. at that point where you've let-bound
> them, so when you get out of the let, those variables will be
> incorrectly set back to unbound (i.e. the defvar will have 
> had no effect).
> 
> Do (require 'repeat) sometime before the let.

OK, thanks. I closed the bug.







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

end of thread, other threads:[~2009-10-04 18:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5DDA07B831D643C5940FEFB414D6D6AF@us.oracle.com>
2009-10-04 16:49 ` bug#4631: 23.1; Warnings from repeat.el Stefan Monnier
2009-10-04 18:59   ` Drew Adams

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).