GNU bug report logs - #13676
24.2.93; Compiler warnings with (defalias #'symbol ...)

Previous Next

Package: emacs;

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.

Full log


View this message in rfc822 format

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: 13676 <at> debbugs.gnu.org
Subject: bug#13676: 24.2.93; Compiler warnings with (defalias #'symbol ...)
Date: Sun, 10 Feb 2013 18:14:05 +0100
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





This bug report was last modified 12 years and 101 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.