* Problem when run-hook-with-args with closure
@ 2014-12-18 6:57 Zhongwei Yao
2014-12-19 9:09 ` Michael Heerdegen
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Zhongwei Yao @ 2014-12-18 6:57 UTC (permalink / raw)
To: help-gnu-emacs
Hi, list,
I try following code on both emacs 24.4.1 and 24.3.1:
(setq lexical-binding t)
(let ((x 1))
(setq foo
(lambda (y)
(message "x+y=%d" (+ x y)))))
(run-hook-with-args 'foo 1)
On emacs 24.4.1, it runs and print: "x+y=2" as expected.
On emacs 24.3.1, it gives error:
run-hook-with-args: Symbol's function definition is void: closure
By the way, this problem is from the compile.el and when
compilation-finish-functions is set, emacs 24.3.1 would give same error:
Symbol's function definition is void: closure
And 24.4.1 is OK.
My problem is Why 24.3.1 returns this? How can I solve it on 24.3.1?
Thanks,
Zhongwei
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Problem when run-hook-with-args with closure
2014-12-18 6:57 Problem when run-hook-with-args with closure Zhongwei Yao
@ 2014-12-19 9:09 ` Michael Heerdegen
2014-12-19 9:56 ` Zhongwei Yao
2014-12-19 9:10 ` Michael Heerdegen
2014-12-19 14:11 ` Stefan Monnier
2 siblings, 1 reply; 9+ messages in thread
From: Michael Heerdegen @ 2014-12-19 9:09 UTC (permalink / raw)
To: help-gnu-emacs
Zhongwei Yao <ashi08104@gmail.com> writes:
> Hi, list,
> I try following code on both emacs 24.4.1 and 24.3.1:
>
> (setq lexical-binding t)
> (let ((x 1))
> (setq foo
> (lambda (y)
> (message "x+y=%d" (+ x y)))))
> (run-hook-with-args 'foo 1)
>
> On emacs 24.4.1, it runs and print: "x+y=2" as expected.
> On emacs 24.3.1, it gives error:
> run-hook-with-args: Symbol's function definition is void: closure
That had been a bug in 24.3 IMO.
> And 24.4.1 is OK.
I also can't reproduce it using my trunk built. So it has seemingly be
fixed.
> How can I solve it on 24.3.1?
I can't give an advice better than "try to avoid the problem" or "please
upgrade".
Michael.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Problem when run-hook-with-args with closure
2014-12-18 6:57 Problem when run-hook-with-args with closure Zhongwei Yao
2014-12-19 9:09 ` Michael Heerdegen
@ 2014-12-19 9:10 ` Michael Heerdegen
2014-12-19 14:11 ` Stefan Monnier
2 siblings, 0 replies; 9+ messages in thread
From: Michael Heerdegen @ 2014-12-19 9:10 UTC (permalink / raw)
To: Emacs mailing list
Zhongwei Yao <ashi08104@gmail.com> writes:
> Hi, list,
> I try following code on both emacs 24.4.1 and 24.3.1:
>
> (setq lexical-binding t)
> (let ((x 1))
> (setq foo
> (lambda (y)
> (message "x+y=%d" (+ x y)))))
> (run-hook-with-args 'foo 1)
>
> On emacs 24.4.1, it runs and print: "x+y=2" as expected.
> On emacs 24.3.1, it gives error:
> run-hook-with-args: Symbol's function definition is void: closure
That had been a bug in 24.3 IMO.
> And 24.4.1 is OK.
I also can't reproduce it using my trunk built. So it has seemingly be
fixed.
> How can I solve it on 24.3.1?
I can't give an advice better than "try to avoid the problem" or "please
upgrade".
Michael.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Problem when run-hook-with-args with closure
2014-12-19 9:09 ` Michael Heerdegen
@ 2014-12-19 9:56 ` Zhongwei Yao
2014-12-19 11:13 ` Michael Heerdegen
0 siblings, 1 reply; 9+ messages in thread
From: Zhongwei Yao @ 2014-12-19 9:56 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: help-gnu-emacs
On Fri, Dec 19, 2014 at 5:09 PM, Michael Heerdegen <michael_heerdegen@web.de
> wrote:
>
> Zhongwei Yao <ashi08104@gmail.com> writes:
>
> > Hi, list,
> > I try following code on both emacs 24.4.1 and 24.3.1:
> >
> > (setq lexical-binding t)
> > (let ((x 1))
> > (setq foo
> > (lambda (y)
> > (message "x+y=%d" (+ x y)))))
> > (run-hook-with-args 'foo 1)
> >
> > On emacs 24.4.1, it runs and print: "x+y=2" as expected.
> > On emacs 24.3.1, it gives error:
> > run-hook-with-args: Symbol's function definition is void: closure
>
> That had been a bug in 24.3 IMO.
>
> > And 24.4.1 is OK.
>
> I also can't reproduce it using my trunk built. So it has seemingly be
> fixed.
>
> > How can I solve it on 24.3.1?
>
> I can't give an advice better than "try to avoid the problem" or "please
> upgrade".
>
>
> Michael.
>
>
> Michael, Thanks.
However, a problem (http://sourceforge.net/p/cedet/mailman/message/33153606/)
in latest emacs (24.4.1) prevents me upgrading:(
--
Zhongwei
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Problem when run-hook-with-args with closure
2014-12-19 9:56 ` Zhongwei Yao
@ 2014-12-19 11:13 ` Michael Heerdegen
0 siblings, 0 replies; 9+ messages in thread
From: Michael Heerdegen @ 2014-12-19 11:13 UTC (permalink / raw)
To: help-gnu-emacs
Zhongwei Yao <ashi08104@gmail.com> writes:
> However, a problem
> (http://sourceforge.net/p/cedet/mailman/message/33153606/)
> in latest emacs (24.4.1) prevents me upgrading:(
I see. Have you made a bug report about that issue?
I don't use the related packages. Looking at the code, evaluating
something like this might help as a workaround:
(defalias 'hif-equal (hif-mathify-binop equal))
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Problem when run-hook-with-args with closure
2014-12-18 6:57 Problem when run-hook-with-args with closure Zhongwei Yao
2014-12-19 9:09 ` Michael Heerdegen
2014-12-19 9:10 ` Michael Heerdegen
@ 2014-12-19 14:11 ` Stefan Monnier
2014-12-22 11:20 ` Zhongwei Yao
2 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2014-12-19 14:11 UTC (permalink / raw)
To: help-gnu-emacs
> (setq foo
> (lambda (y)
> (message "x+y=%d" (+ x y)))))
> (run-hook-with-args 'foo 1)
Hooks should contain *lists* of functions. The fact that they can also
just contain a function is an old backward compatibility hack: better
not rely on it.
So, if you do it right, you won't hit the bug:
(setq foo
(list (lambda (y)
(message "x+y=%d" (+ x y))))))
(run-hook-with-args 'foo 1)
Or better yet:
(add-hook 'foo
(lambda (y)
(message "x+y=%d" (+ x y))))))
(run-hook-with-args 'foo 1)
-- Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Problem when run-hook-with-args with closure
2014-12-19 14:11 ` Stefan Monnier
@ 2014-12-22 11:20 ` Zhongwei Yao
2014-12-22 19:07 ` incremental search for "OK " matches "OK" followed by ^M for CR !? ISHIKAWA,Chiaki
0 siblings, 1 reply; 9+ messages in thread
From: Zhongwei Yao @ 2014-12-22 11:20 UTC (permalink / raw)
To: Stefan Monnier; +Cc: help-gnu-emacs
Hi, Stefan,
Thanks, it works!
Best Regards,
Zhongwei
On Fri, Dec 19, 2014 at 10:11 PM, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:
> > (setq foo
> > (lambda (y)
> > (message "x+y=%d" (+ x y)))))
> > (run-hook-with-args 'foo 1)
>
> Hooks should contain *lists* of functions. The fact that they can also
> just contain a function is an old backward compatibility hack: better
> not rely on it.
>
> So, if you do it right, you won't hit the bug:
>
> (setq foo
> (list (lambda (y)
> (message "x+y=%d" (+ x y))))))
> (run-hook-with-args 'foo 1)
>
> Or better yet:
>
> (add-hook 'foo
> (lambda (y)
> (message "x+y=%d" (+ x y))))))
> (run-hook-with-args 'foo 1)
>
>
> -- Stefan
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* incremental search for "OK " matches "OK" followed by ^M for CR !?
2014-12-22 11:20 ` Zhongwei Yao
@ 2014-12-22 19:07 ` ISHIKAWA,Chiaki
2014-12-22 19:10 ` Drew Adams
0 siblings, 1 reply; 9+ messages in thread
From: ISHIKAWA,Chiaki @ 2014-12-22 19:07 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
With the latest released emacs,
I noticed that when editing a file with mixed line ending of LF-only,
and CR-LF variety (I am editing a file that contains an excerpt from
a terminal session recorded by "script" command. These recorded lines
are shown as ending with ^M) ,
incremental search, C-S, for "OK " matches
the string "OK" that is followed by CR which is shown as ^M.
That is, "OK " seems to match
literal "OK " and also "OK" at the end of a line with CRLF ending.
I was surprised to find the "OK^M" as being high-lighted (as possible
matches are these days with font lock or whaever).
I don't think this was the case before, and the extra match
with "OK^M" interfered my search for a meaningful message line that
contains literal "ok ".
Anyone noticed this?
TIA
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: incremental search for "OK " matches "OK" followed by ^M for CR !?
2014-12-22 19:07 ` incremental search for "OK " matches "OK" followed by ^M for CR !? ISHIKAWA,Chiaki
@ 2014-12-22 19:10 ` Drew Adams
0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2014-12-22 19:10 UTC (permalink / raw)
To: ISHIKAWA,Chiaki, help-gnu-emacs
> I don't think this was the case before, and the extra match
> with "OK^M" interfered my search for a meaningful message line that
> contains literal "ok ".
>
> Anyone noticed this?
Yes, the behavior was changed. See option `search-whitespace-regexp'.
Set it to nil to get rid of the new behavior. Or just toggle the
behavior with `M-s SPC'.
And see the Emacs manual, node `Special Search'.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-12-22 19:10 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-18 6:57 Problem when run-hook-with-args with closure Zhongwei Yao
2014-12-19 9:09 ` Michael Heerdegen
2014-12-19 9:56 ` Zhongwei Yao
2014-12-19 11:13 ` Michael Heerdegen
2014-12-19 9:10 ` Michael Heerdegen
2014-12-19 14:11 ` Stefan Monnier
2014-12-22 11:20 ` Zhongwei Yao
2014-12-22 19:07 ` incremental search for "OK " matches "OK" followed by ^M for CR !? ISHIKAWA,Chiaki
2014-12-22 19:10 ` Drew Adams
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).