From: Emanuel Berg via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: [External] : Re: Lexical vs. dynamic: small examples?
Date: Thu, 26 Aug 2021 02:10:59 +0200 [thread overview]
Message-ID: <87o89ljca4.fsf@zoho.eu> (raw)
In-Reply-To: 87wno9jdp7.fsf@zoho.eu
> Now the byte-compiler instead warns about a reference to
> a free variable. Maybe it shouldn't do that and instead warn
> when one uses `defvar'?
The byte-compiler also warns about the assignment to the same
variable, this is the `setq' line.
geh.el:
In toplevel form:
geh.el:15:7: Warning: assignment to free variable ‘b’
In fun:
geh.el:18:3: Warning: reference to free variable ‘b’
Other byte-compiler questions are, why does it stop warning
after a second compilation? Because there is no change to the
source file, so no compilation happens? But doesn't that mean
you can just compile away the shortcomings of the code?
Also, why does the warnings appear so many times? The file
(geh.el) isn't `require'd or anything from any other file.
Just `load'ed, once. Yet both warnings appear 6 times!
And all the cl warnings, from slime ... slime stuff is
required from two files, `slime' but also
`slime-presentations', `slime-autoloads', `slime-banner', and
`slime-reply'. (I use a/the MELPA version, 2.26.1.)
Anyway, that warning appear 12 times! See output after geh.el,
and last the Makefile.
;;; -*- lexical-binding: t -*-
;;;
;;; this file:
;;; http://user.it.uu.se/~embe8573/emacs-init/geh.el
;;; https://dataswamp.org/~incal/emacs-init/geh.el
(defmacro slet (bindings &rest body)
(unless lexical-binding
(error "`slet' requires `lexical-binding' to be enabled") )
`(funcall
(lambda ,(mapcar #'car bindings)
,@body)
,@(mapcar #'cadr bindings) ))
(setq b 200)
(defun fun ()
b) ; geh.el:18:3: Warning: reference to free variable ‘b’
(slet ((b 1))
(list b (fun)) ) ; (1 200)
(let ((b 2))
(list b (fun))) ; (2 200)
(how-many "Warning: assignment to free variable ‘b’" (point) (point-max)) ; 6
(how-many "Warning: reference to free variable ‘b’" (point) (point-max)) ; 6
(how-many "Warning: Package cl is deprecated" (point) (point-max)) ; 12
erc/erc-kill.el:
erc/erc-iterate.el:
In toplevel form:
geh.el:15:7: Warning: assignment to free variable ‘b’
In fun:
geh.el:18:3: Warning: reference to free variable ‘b’
In toplevel form:
geh.el:15:7: Warning: assignment to free variable ‘b’
In fun:
geh.el:18:3: Warning: reference to free variable ‘b’
frame-size.el:
erc/erc-spell.el:
In toplevel form:
geh.el:15:7: Warning: assignment to free variable ‘b’
In fun:
geh.el:18:3: Warning: reference to free variable ‘b’
geh.el:
get-search-string.el:
In toplevel form:
geh.el:15:7: Warning: assignment to free variable ‘b’
In fun:
geh.el:18:3: Warning: reference to free variable ‘b’
In toplevel form:
geh.el:15:7: Warning: assignment to free variable ‘b’
In fun:
geh.el:18:3: Warning: reference to free variable ‘b’
In toplevel form:
geh.el:15:7: Warning: assignment to free variable ‘b’
In fun:
geh.el:18:3: Warning: reference to free variable ‘b’
gnus/mail.el:
In toplevel form:
ide/slime-incal.el:33:1: Warning: Package cl is deprecated
ide/slime-incal.el:
In toplevel form:
ide/slime-incal.el:33:1: Warning: Package cl is deprecated
global-keys.el:
In toplevel form:
ide/slime-incal.el:33:1: Warning: Package cl is deprecated
face.el:
ide/ide.el:
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
sort-incal.el:
street.el:
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
string.el:
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
navigate-fs-keys.el:
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
super.el:
scroll.el:
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
string-minibuffer.el:
In toplevel form:
face.el:15:1: Warning: Package cl is deprecated
# this file:
# http://user.it.uu.se/~embe8573/emacs-init/Makefile
# https://dataswamp.org/~incal/emacs-init/Makefile
emacs=/usr/local/bin/emacs
ema-path=~/.emacs.d/emacs-init
ema-erc=\"${ema-path}/erc\"
ema-gnus=\"${ema-path}/gnus\"
ema-ide=\"${ema-path}/ide\"
ema-init=\"${ema-path}\"
ema-w3m=\"${ema-path}/w3m\"
ema=${ema-erc} ${ema-gnus} ${ema-ide} ${ema-init} ${ema-w3m}
elpa-path=~/.emacs.d/elpa
markdown-mode=\"${elpa-path}/markdown-mode-20201220.253\"
w3m=\"${elpa-path}/w3m-20210615.103\"
elpa=${markdown-mode} ${w3m}
slime=\"/usr/share/emacs/site-lisp/elpa-src/slime-2.26.1/\"
packs=${ema} ${elpa} ${slime}
byte-compile=$(emacs) \
--batch \
--eval "(setq load-path (append load-path '(${packs})))" \
-f batch-byte-compile
sed-filter=2>&1 | sed '/^\(Loading\|Wrote\)/d' # errors and warnings only
error-file=error.txt
INIT_FILE=~/.emacs
INIT_FILE_BC=$(INIT_FILE).elc
ELS = $(shell zsh -c "ls -1 **/*.el")
ELCS= $(ELS:.el=.elc)
all: $(ELCS) $(INIT_FILE_BC)
rm -f $(error-file)
$(INIT_FILE_BC): $(INIT_FILE)
$(byte-compile) $< $(sed-filter)
%.elc: %.el
$(byte-compile) $< $(sed-filter) > $(error-file)
if [ -s $(error-file) ]; then echo -n "\n$<: "; cat $(error-file); fi
rm -f $<~
clean:
$(shell zsh -c "rm -rf **/*.elc(N)")
rm -f $(INIT_FILE_BC) $(error-file)
again:
${MAKE} clean
${MAKE}
new:
${MAKE} again
--
underground experts united
https://dataswamp.org/~incal
next prev parent reply other threads:[~2021-08-26 0:10 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-14 3:34 Lexical vs. dynamic: small examples? Eduardo Ochs
2021-08-14 3:56 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14 4:12 ` Eduardo Ochs
2021-08-14 7:35 ` tomas
2021-08-14 16:00 ` Eduardo Ochs
2021-08-14 19:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14 20:42 ` tomas
2021-08-14 19:31 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14 20:31 ` tomas
2021-08-14 21:26 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14 21:29 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14 13:35 ` [External] : " Drew Adams
2021-08-14 16:15 ` Eduardo Ochs
2021-08-14 19:00 ` Gregory Heytings
2021-08-14 20:16 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14 20:23 ` Gregory Heytings
2021-08-14 21:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14 21:13 ` tomas
2021-08-14 21:28 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-14 20:41 ` tomas
2021-08-15 0:29 ` [External] : " Drew Adams
2021-08-15 0:52 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 1:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 1:18 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 4:44 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 5:02 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 15:49 ` Drew Adams
2021-08-15 18:49 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 21:55 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-15 22:04 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 21:57 ` Drew Adams
2021-08-15 22:20 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 22:54 ` Drew Adams
2021-08-15 23:16 ` Drew Adams
2022-01-09 7:08 ` Jean Louis
2022-01-09 15:03 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 23:42 ` Arthur Miller
2021-08-15 22:02 ` Lars Ingebrigtsen
2021-08-15 22:22 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 22:44 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-21 3:38 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-24 2:08 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-25 23:34 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-25 23:40 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-26 0:10 ` Emanuel Berg via Users list for the GNU Emacs text editor [this message]
2021-08-26 0:44 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-26 17:01 ` FW: " Drew Adams
2021-08-26 23:05 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-25 23:46 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-25 23:47 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-26 0:57 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-28 1:36 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-28 1:41 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 22:44 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 22:58 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-15 23:13 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 23:56 ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-16 0:43 ` Emanuel Berg via Users list for the GNU Emacs text editor
2021-08-15 15:42 ` FW: " Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o89ljca4.fsf@zoho.eu \
--to=help-gnu-emacs@gnu.org \
--cc=moasenwood@zoho.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.