unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13676: 24.2.93; Compiler warnings with (defalias #'symbol ...)
@ 2013-02-10 17:14 Michael Heerdegen
  2013-02-11  4:01 ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2013-02-10 17:14 UTC (permalink / raw)
  To: 13676

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






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-11 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-10 17:14 bug#13676: 24.2.93; Compiler warnings with (defalias #'symbol ...) Michael Heerdegen
2013-02-11  4:01 ` Stefan Monnier
2013-02-11 15:04   ` Michael Heerdegen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).