From unknown Sat Jun 21 05:19:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13676: 24.2.93; Compiler warnings with (defalias #'symbol ...) Resent-From: Michael Heerdegen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Feb 2013 17:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13676 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 13676@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Reply-To: michael_heerdegen@web.de Received: via spool by submit@debbugs.gnu.org id=B.136051637329425 (code B ref -1); Sun, 10 Feb 2013 17:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 10 Feb 2013 17:12:53 +0000 Received: from localhost ([127.0.0.1]:49251 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4aSS-0007eY-Jw for submit@debbugs.gnu.org; Sun, 10 Feb 2013 12:12:52 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60587) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4aSP-0007eO-9Z for submit@debbugs.gnu.org; Sun, 10 Feb 2013 12:12:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4aS8-0006Gt-1O for submit@debbugs.gnu.org; Sun, 10 Feb 2013 12:12:33 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-101.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, USER_IN_WHITELIST autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:59377) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4aS7-0006Gp-UK for submit@debbugs.gnu.org; Sun, 10 Feb 2013 12:12:31 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43707) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4aS5-0001Q2-Rh for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 12:12:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U4aS4-0006GJ-I5 for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 12:12:29 -0500 Received: from mout.web.de ([212.227.15.3]:49292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U4aS4-0006G2-8f for bug-gnu-emacs@gnu.org; Sun, 10 Feb 2013 12:12:28 -0500 Received: from drachen.dragon ([92.74.177.220]) by smtp.web.de (mrweb003) with ESMTPA (Nemesis) id 0MLPMI-1U42UC1nU2-000v65 for ; Sun, 10 Feb 2013 18:12:26 +0100 From: Michael Heerdegen Date: Sun, 10 Feb 2013 18:14:05 +0100 Message-ID: <87fw14xfaa.fsf@web.de> MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V02:K0:AwQY1LK4Ig9QiwWc1xxgD53v3QX8F6beU0juI8cgKtq l6LeEfFkgsDhgxI4OahckD8q3hCK5lWTDJQJeInh6hG+voEuJW fXqnkrXnS+5ICd6nqq5H3GgdxwL5/fZB7TvkHW1OTSSXuf2t30 3uBwtF+KXUI4ig65sntg+zGO2sPm+FraAIuLi/c3rGVD6cpLZG FLYHwlCTW1FeNMhL+ZPUE4KL5RrBMvA4gpfw7JrxOQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -5.5 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) 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 From unknown Sat Jun 21 05:19:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13676: 24.2.93; Compiler warnings with (defalias #'symbol ...) Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Feb 2013 04:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13676 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: michael_heerdegen@web.de Cc: 13676@debbugs.gnu.org Received: via spool by 13676-submit@debbugs.gnu.org id=B13676.13605553025202 (code B ref 13676); Mon, 11 Feb 2013 04:02:02 +0000 Received: (at 13676) by debbugs.gnu.org; 11 Feb 2013 04:01:42 +0000 Received: from localhost ([127.0.0.1]:49665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4kaM-0001Lr-A2 for submit@debbugs.gnu.org; Sun, 10 Feb 2013 23:01:42 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:8375) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4kaJ-0001Li-2u for 13676@debbugs.gnu.org; Sun, 10 Feb 2013 23:01:39 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFFFpZnt/2dsb2JhbABEuzWDWRdzgh8BBVYjEAs0EhQYDYhIwS2NYYMpA4hhnBmBXoMV X-IPAS-Result: Av8EABK/CFFFpZnt/2dsb2JhbABEuzWDWRdzgh8BBVYjEAs0EhQYDYhIwS2NYYMpA4hhnBmBXoMV X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="942983" Received: from 69-165-153-237.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.165.153.237]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 10 Feb 2013 23:01:19 -0500 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 2844CAE2BE; Sun, 10 Feb 2013 23:01:20 -0500 (EST) From: Stefan Monnier Message-ID: References: <87fw14xfaa.fsf@web.de> Date: Sun, 10 Feb 2013 23:01:20 -0500 In-Reply-To: <87fw14xfaa.fsf@web.de> (Michael Heerdegen's message of "Sun, 10 Feb 2013 18:14:05 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > | [...] 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 From unknown Sat Jun 21 05:19:42 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13676: 24.2.93; Compiler warnings with (defalias #'symbol ...) Resent-From: Michael Heerdegen Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 11 Feb 2013 15:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13676 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 13676@debbugs.gnu.org Received: via spool by 13676-submit@debbugs.gnu.org id=B13676.136059502210400 (code B ref 13676); Mon, 11 Feb 2013 15:04:01 +0000 Received: (at 13676) by debbugs.gnu.org; 11 Feb 2013 15:03:42 +0000 Received: from localhost ([127.0.0.1]:51021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4uux-0002he-VC for submit@debbugs.gnu.org; Mon, 11 Feb 2013 10:03:41 -0500 Received: from mout.web.de ([212.227.17.11]:62669) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4uuu-0002hW-SG for 13676@debbugs.gnu.org; Mon, 11 Feb 2013 10:03:38 -0500 Received: from drachen.dragon ([92.74.177.220]) by smtp.web.de (mrweb102) with ESMTPA (Nemesis) id 0M8hwt-1UrofJ1LIh-00vlV6; Mon, 11 Feb 2013 16:03:15 +0100 From: Michael Heerdegen References: <87fw14xfaa.fsf@web.de> Date: Mon, 11 Feb 2013 16:04:54 +0100 In-Reply-To: (Stefan Monnier's message of "Sun, 10 Feb 2013 23:01:20 -0500") Message-ID: <877gmeevs9.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V02:K0:BFiKr2aPHYaf+v9X/U0wJzc7PwFJ9n4WA1wGNBYtEsL wELpqTttL4f96VS0Y7IUropEaLaWayyVySk7fh5YOSVbf+SKG+ Y3FYQrfa1rX3iyWTTX3rjjLv5VvVQqAoQP8L5NPbNbJ0EfTzhW YwFccp+c/X3SOxeVDSpSeVq5z8KdDpjmiSbg+F/dz6iqiLu9M6 DqzhNbayk9PQ/vMiwKeW15r0d9n2PTacBtSBaC+If0= X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Hello Stefan, thanks for the explanation. I'll close it. Michael. Stefan Monnier 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 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 11 10:06:07 2013 Received: (at control) by debbugs.gnu.org; 11 Feb 2013 15:06:07 +0000 Received: from localhost ([127.0.0.1]:51026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4uxG-0002lA-2n for submit@debbugs.gnu.org; Mon, 11 Feb 2013 10:06:06 -0500 Received: from mout.web.de ([212.227.15.4]:60079) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4ux9-0002kg-UI for control@debbugs.gnu.org; Mon, 11 Feb 2013 10:06:00 -0500 Received: from drachen.dragon ([92.74.177.220]) by smtp.web.de (mrweb001) with ESMTPA (Nemesis) id 0MHGN9-1U9eA92gN9-00E2Dl for ; Mon, 11 Feb 2013 16:05:34 +0100 Date: Mon, 11 Feb 2013 16:07:14 +0100 Message-Id: <8738x2evod.fsf@web.de> To: control@debbugs.gnu.org From: Michael Heerdegen Subject: control message for bug #13676 X-Provags-ID: V02:K0:Tpy9e4sgwUeMfGTuzblu+dmErMtUNGxAvy+1xZEirzJ Jm/dOzwvXN+vTJ5dsOzGWRXe8La++sYeniO7hdGV7ERO7W4QPz oegWXmjf6V/K76YGKwW3TD8I+fRULCkHgezHu0/PR/R/tqjBYe /kJjedEi2jyC8Vqn276iyD4xrG/w7TEzn2+m9ftNhpuw+68rYb veihfM+rk8fZ4ODN/0OTrIMEcUCjkRX25md8SEVGUw= X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) close 13676 24.3 From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 11 10:06:52 2013 Received: (at control) by debbugs.gnu.org; 11 Feb 2013 15:06:52 +0000 Received: from localhost ([127.0.0.1]:51029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4uy3-0002mA-EC for submit@debbugs.gnu.org; Mon, 11 Feb 2013 10:06:51 -0500 Received: from mout.web.de ([212.227.15.3]:58244) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1U4uy1-0002m3-Pa for control@debbugs.gnu.org; Mon, 11 Feb 2013 10:06:50 -0500 Received: from drachen.dragon ([92.74.177.220]) by smtp.web.de (mrweb001) with ESMTPA (Nemesis) id 0MGARb-1UAkdf0sp5-00F8ij for ; Mon, 11 Feb 2013 16:06:28 +0100 Date: Mon, 11 Feb 2013 16:08:08 +0100 Message-Id: <871ucmevmv.fsf@web.de> To: control@debbugs.gnu.org From: Michael Heerdegen Subject: control message for bug #13676 X-Provags-ID: V02:K0:xWBVB6p14A2j2atq0/OfHGTD+aRt+BC2sO8iVqw0F7H U9ebOZhesSCJh27pSClp5Z5e8leq2hRKb8wNrdTuPmf65JqS2Z k15r9qmokKL2f6+l2NArg4jwRHa5w/dxr3AOJEVysUaxDAfNyw 7PcWgpGTzlUEQoE4En1/RgAxXEzmYvRGG+Wf+y+HJlF6/Xb4je jClu6lmRyOMiXTML6uTChkkwi//TJjSLIgH3bEqHdc= X-Spam-Score: 0.8 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) close 13676 24.3