Fix some byte-compilation warnings #12

Merged
merged 1 commit into from Nov 21, 2012

Conversation

Projects
None yet
2 participants
@purcell
Contributor

purcell commented Nov 20, 2012

This commit fixes the following warnings:

autopair.el:182:1:Warning: cl package required at runtime
autopair.el:204:34:Warning: `make-variable-buffer-local' should be called at
    toplevel
In autopair-pair-p:
autopair.el:841:23:Warning: autopair-escaped-p called with 0 arguments, but
    requires 1
Fix some byte-compilation warnings
This commit fixes the following warnings:

    autopair.el:182:1:Warning: cl package required at runtime
    autopair.el:204:34:Warning: `make-variable-buffer-local' should be called at
        toplevel
    In autopair-pair-p:
    autopair.el:841:23:Warning: autopair-escaped-p called with 0 arguments, but
        requires 1
@joaotavora

This comment has been minimized.

Show comment Hide comment
@joaotavora

joaotavora Nov 20, 2012

I'm confused. Can you explain why this ifixes the make-variable-buffer-local compile-time error? Won't this break when you move an .elc across emacsen?

I'm confused. Can you explain why this ifixes the make-variable-buffer-local compile-time error? Won't this break when you move an .elc across emacsen?

This comment has been minimized.

Show comment Hide comment
@joaotavora

joaotavora Nov 21, 2012

Ohhhhh I see. This compiles to (unless t) or something deterministic and it's like defvar was called at toplevel. Am I right? is this a common technique?

Ohhhhh I see. This compiles to (unless t) or something deterministic and it's like defvar was called at toplevel. Am I right? is this a common technique?

This comment has been minimized.

Show comment Hide comment
@purcell

purcell Nov 21, 2012

Owner

Yes. I think I saw it in ruby-mode originally, and it's recommended for things that can be determined at compile-time, like availability of certain emacs-specific features.

It does mean that the .elc will be different depending on the version of the Emacs instance in which it was compiled, but .elc files are usually (always?) incompatible between major versions. And even when they're not, imagine that a core Emacs macro definition changes between Emacs 23 and Emacs 24, and that a user compiles a library which uses it inside Emacs23; now, even if Emacs 24 can read the .elc file, it will see bytecode for the old macro expansion. So really, trying to use the same .elc file with different versions is a recipe for obscure bugs. :-)

-Steve

Owner

purcell replied Nov 21, 2012

Yes. I think I saw it in ruby-mode originally, and it's recommended for things that can be determined at compile-time, like availability of certain emacs-specific features.

It does mean that the .elc will be different depending on the version of the Emacs instance in which it was compiled, but .elc files are usually (always?) incompatible between major versions. And even when they're not, imagine that a core Emacs macro definition changes between Emacs 23 and Emacs 24, and that a user compiles a library which uses it inside Emacs23; now, even if Emacs 24 can read the .elc file, it will see bytecode for the old macro expansion. So really, trying to use the same .elc file with different versions is a recipe for obscure bugs. :-)

-Steve

This comment has been minimized.

Show comment Hide comment
@joaotavora

joaotavora Nov 21, 2012

Yes, you're right. In Common Lisp, one do this is a conditional comment reader macro, I guess this is the closest thing.

Yes, you're right. In Common Lisp, one do this is a conditional comment reader macro, I guess this is the closest thing.

This comment has been minimized.

Show comment Hide comment
@purcell

purcell Nov 21, 2012

Owner

The Emacs docs describe how eval-when-compile is related to the Common Lisp equivalents: http://www.gnu.org/software/emacs/manual/html_node/elisp/Eval-During-Compile.html

Owner

purcell replied Nov 21, 2012

The Emacs docs describe how eval-when-compile is related to the Common Lisp equivalents: http://www.gnu.org/software/emacs/manual/html_node/elisp/Eval-During-Compile.html

@joaotavora

This comment has been minimized.

Show comment Hide comment
@joaotavora

joaotavora Nov 20, 2012

Nice, this probably never broke because of dynamic binding and because autopair-escaped-p uses a local with the same name.

Nice, this probably never broke because of dynamic binding and because autopair-escaped-p uses a local with the same name.

@joaotavora

This comment has been minimized.

Show comment Hide comment
@joaotavora

joaotavora Nov 20, 2012

See my comments about eval-when-compile, otherwise looks good.

See my comments about eval-when-compile, otherwise looks good.

joaotavora added a commit that referenced this pull request Nov 21, 2012

Merge pull request #12 from purcell/master
Fix some byte-compilation warnings

@joaotavora joaotavora merged commit 274a54a into joaotavora:master Nov 21, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment