all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* byte-compiler warnings
@ 2010-09-12 18:12 Joost Kremers
  0 siblings, 0 replies; 10+ messages in thread
From: Joost Kremers @ 2010-09-12 18:12 UTC (permalink / raw
  To: help-gnu-emacs

hi all,

having upgraded to GNU Emacs 23.2.1, some of my elisp code that used to compile
without any messages now produces some warnings. the first is:

Function `copy-list' from cl package called at runtime

this one appears a couple of times, also for `gensym' and `evenp'.

i do require the cl package at compile time, but since copy-list, gensym and
evenp are functions, that of course doesn't help.

 if i require the package at runtime, the byte compiler complains about it, too:
"cl package required at runtime"...

so isn't one supposed to use these functions at all, except in private code?

the second warning i get is:

`save-excursion' defeated by `set-buffer'

this applies to code chunks like the following:

(save-excursion
  (set-buffer <some-buffe>
  ...

in each case, i can actually take out the save-excursion, i think, because the
save-excursion scopes until the end of the function it's in and that's where the
effect of set-buffer ends anyway. but it does make me curious, why this warning
never appeared in previous emacs versions. and looking at the elisp info files a
bit, i find that besides set-buffer there are also save-current-buffer and
with-current-buffer, which seem to do pretty much the same thing. anyone know
which function is preferred in which situation?

TIA


-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)


^ permalink raw reply	[flat|nested] 10+ messages in thread
* Byte-compiler warnings
@ 2015-06-24  9:29 Marcin Borkowski
  2015-06-24 23:50 ` Emanuel Berg
       [not found] ` <mailman.5606.1435189903.904.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 10+ messages in thread
From: Marcin Borkowski @ 2015-06-24  9:29 UTC (permalink / raw
  To: Help Gnu Emacs mailing list

Hi all,

I remember someone somewhere writing that Emacs byte-compiler is useful
even if you don't want the compiled code, since it issues various
warnings about bad Elisp constructs.  I didn't find much about it in the
manual, which referred to the docstring of the variable
`byte-compile-warnings'.  That docstring gave a list of symbols denoting
various categories of warnings; the most interesting were probably
`mapcar' and `suspicious'.  Grepping the `bytecomp.el' source (GNU Emacs
25.0.50.1) seems to imply that currently the only case where 'suspicious
is used is a combination of `save-excursion' and `set-buffer'.  Am
I right?

Are there other tools that assist in writing good Elisp code?  I know
about checkdoc, is there anything else?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <mailman.5561.1435138202.904.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2015-06-25 12:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-12 18:12 byte-compiler warnings Joost Kremers
  -- strict thread matches above, loose matches on Subject: below --
2015-06-24  9:29 Byte-compiler warnings Marcin Borkowski
2015-06-24 23:50 ` Emanuel Berg
2015-06-25 12:56   ` Nicolas Richard
     [not found] ` <mailman.5606.1435189903.904.help-gnu-emacs@gnu.org>
2015-06-25  3:06   ` Stefan Monnier
     [not found] <mailman.5561.1435138202.904.help-gnu-emacs@gnu.org>
2015-06-24 11:27 ` Pascal J. Bourguignon
2015-06-25  1:52   ` Emanuel Berg
2015-06-25  2:30     ` Emanuel Berg
2015-06-25  3:19   ` Stefan Monnier
2015-06-25  3:42     ` Emanuel Berg

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.