GNU bug report logs -
#13676
24.2.93; Compiler warnings with (defalias #'symbol ...)
Previous Next
Reported by: michael_heerdegen <at> web.de
Date: Sun, 10 Feb 2013 17:13:01 UTC
Severity: minor
Found in version 24.2.93
Fixed in version 24.3
Done: Michael Heerdegen <michael_heerdegen <at> web.de>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13676 in the body.
You can then email your comments to 13676 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13676
; Package
emacs
.
(Sun, 10 Feb 2013 17:13:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
michael_heerdegen <at> web.de
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 10 Feb 2013 17:13:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hi,
after reading (long ago) in (elisp) Anonymous Functions:
,----------------------------------------------------------------------
| -- Special Form: function function-object
|
| [...] But unlike `quote', it also serves as a note to the Emacs
|evaluator and byte-compiler that FUNCTION-OBJECT is intended to be used
|as a function. [...]
`----------------------------------------------------------------------
I often used something like this:
--8<---------------cut here---------------start------------->8---
;; my package --- doing cool stuff
(defalias #'my-package-end-of-line
(if (fboundp #'end-of-visual-line)
#'end-of-visual-line
#'end-of-line))
(defun my-package-do-cool-stuff ()
"Doc..."
(ding)
(goto-char (point-min))
(my-package-end-of-line))
--8<---------------cut here---------------end--------------->8---
If I compile this, I get a warning:
,----------------------------------------------------------------------
| Compiling file /home/micha/today/my-package.el at Sun Feb 10 17:54:08 2013
|
| In end of data:
| my-package.el:13:1:Warning: the function `my-package-end-of-line' is not known
| to be defined.
`----------------------------------------------------------------------
If the first arg of `defalias' is quoted with just quote (instead of
`#''), however, you don't get a warning.
Dunno if it's no good style to use `#'' at that place - OTOH, it works,
and the warning is not useful.
A fix would presumably need to change the first condition of the `pcase' in
`byte-compile-file-form-defalias', probably to something like
`(,_ ,(or `',name `(function ,name)) ,arg . ,rest)
Thanks,
Michael.
In GNU Emacs 24.2.93.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10)
of 2013-02-09 on drachen
Bzr revision: cyd <at> gnu.org-20130209044342-t2b063zu2fqy8nud
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
System Description: Debian GNU/Linux 7.0 (wheezy)
Configured using:
`configure '--prefix=/usr/local/built/''
Important settings:
value of $LC_ALL: de_DE.utf8
value of $LC_TIME: C
value of $LANG: de_DE.utf8
locale-coding-system: utf-8-unix
default enable-multibyte-characters: t
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13676
; Package
emacs
.
(Mon, 11 Feb 2013 04:02:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 13676 <at> debbugs.gnu.org (full text, mbox):
> | [...] But unlike `quote', it also serves as a note to the Emacs
> |evaluator and byte-compiler that FUNCTION-OBJECT is intended to be used
> |as a function. [...]
Right, this means that #'foo is a reference to the function stored in `foo'.
> (defalias #'my-package-end-of-line
So, this is weird, because you're not referring to the function stored
in `my-package-end-of-line' here, instead you really want to set the
`symbol-function' slot of the symbol, so the argument you want to pass
to `defalias' is not a function but a symbol.
Both work in practice, but the intention expressed by the use of #' is
incorrect here.
> (if (fboundp #'end-of-visual-line)
Similarly, here it should be (fboundp 'end-of-visual-line) since
fboundp's argument should be a symbol, not a function.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13676
; Package
emacs
.
(Mon, 11 Feb 2013 15:04:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 13676 <at> debbugs.gnu.org (full text, mbox):
Hello Stefan,
thanks for the explanation. I'll close it.
Michael.
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> > | [...] But unlike `quote', it also serves as a note to the Emacs
> > |evaluator and byte-compiler that FUNCTION-OBJECT is intended to be used
> > |as a function. [...]
>
> Right, this means that #'foo is a reference to the function stored in
> foo'.
>
> > (defalias #'my-package-end-of-line
>
> So, this is weird, because you're not referring to the function stored
> in `my-package-end-of-line' here, instead you really want to set the
> `symbol-function' slot of the symbol, so the argument you want to pass
> to `defalias' is not a function but a symbol.
>
> Both work in practice, but the intention expressed by the use of #' is
> incorrect here.
>
> > (if (fboundp #'end-of-visual-line)
>
> Similarly, here it should be (fboundp 'end-of-visual-line) since
> fboundp's argument should be a symbol, not a function.
>
>
> Stefan
bug marked as fixed in version 24.3, send any further explanations to
13676 <at> debbugs.gnu.org and michael_heerdegen <at> web.de
Request was from
Michael Heerdegen <michael_heerdegen <at> web.de>
to
control <at> debbugs.gnu.org
.
(Mon, 11 Feb 2013 15:07:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 24.3, send any further explanations to
13676 <at> debbugs.gnu.org and michael_heerdegen <at> web.de
Request was from
Michael Heerdegen <michael_heerdegen <at> web.de>
to
control <at> debbugs.gnu.org
.
(Mon, 11 Feb 2013 15:07:03 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Tue, 12 Mar 2013 11:24:04 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 99 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.