* How to avoid introducing global symbols by setq in function?
@ 2016-11-18 1:10 zhanghj
2016-11-18 8:33 ` Marcin Borkowski
0 siblings, 1 reply; 3+ messages in thread
From: zhanghj @ 2016-11-18 1:10 UTC (permalink / raw)
To: help-gnu-emacs
As in the following code:
(let ((var1 100)) ;; default value
(when some_condition
;; new value
(setq varl 200))
(message "value: %d" varl))
Should use "var1", but write "varl" by typo.
If some_condition is non-nil, there will be no error and no warnning.
How to check these mistakes?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to avoid introducing global symbols by setq in function?
2016-11-18 1:10 How to avoid introducing global symbols by setq in function? zhanghj
@ 2016-11-18 8:33 ` Marcin Borkowski
2016-11-21 8:30 ` zhanghj
0 siblings, 1 reply; 3+ messages in thread
From: Marcin Borkowski @ 2016-11-18 8:33 UTC (permalink / raw)
To: zhanghj; +Cc: help-gnu-emacs
On 2016-11-18, at 02:10, zhanghj <netjunegg@gmail.com> wrote:
> As in the following code:
>
> (let ((var1 100)) ;; default value
> (when some_condition
> ;; new value
> (setq varl 200))
> (message "value: %d" varl))
>
> Should use "var1", but write "varl" by typo.
> If some_condition is non-nil, there will be no error and no warnning.
>
> How to check these mistakes?
Have you tried to byte-compile that code?
Best,
--
Marcin Borkowski
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: How to avoid introducing global symbols by setq in function?
2016-11-18 8:33 ` Marcin Borkowski
@ 2016-11-21 8:30 ` zhanghj
0 siblings, 0 replies; 3+ messages in thread
From: zhanghj @ 2016-11-21 8:30 UTC (permalink / raw)
To: Marcin Borkowski; +Cc: help-gnu-emacs
I just tried. The warnning message told me what I want. Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-21 8:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-18 1:10 How to avoid introducing global symbols by setq in function? zhanghj
2016-11-18 8:33 ` Marcin Borkowski
2016-11-21 8:30 ` zhanghj
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).