help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Byte-compiler warnings


From: Emanuel Berg
Subject: Re: Byte-compiler warnings
Date: Thu, 25 Jun 2015 01:50:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Marcin Borkowski <mbork@mbork.pl> writes:

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

Whoever said that must have been pretty cool :))

But yes. There are many such cases. The help should
have the exact same message, is the way I would do it.
But its not a big issue if it is there in some
other phrasing.

E.g.,

    (defun compile-me ()
      (beginning-of-buffer) )

The help says:

    Don't use this command in Lisp programs!
    (goto-char (point-min)) is faster.

The byte-compiler says:

    ~/.emacs:6:8:Warning: `beginning-of-buffer' is for
    interactive use only; use `(goto-char
    (point-min))' instead.

One question is: if (goto-char (point-min)) is
equivalent, why cannot the byte-compiler just use that
instead for the compiled version? (Granted, there
might be more complicated examples that
`beginning-of-buffer' vs. (goto-char (point-min))...)

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

When you have your program you can set up automatic
testing to test all possible arg values, and such
things. It won't have anything to do with good Lisp
but it will find the bugs. Which is much more
important. But I agree a set of such tools would be
cool insofar as what is needed cannot be incorporated
into either of the components already mentioned...

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]