From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Expansion of #$ in byte-compiled files Date: Thu, 03 Sep 2015 22:12:04 -0400 Message-ID: References: <1668732705.1162011.1441310007202.JavaMail.yahoo@mail.yahoo.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1441332755 14263 80.91.229.3 (4 Sep 2015 02:12:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Sep 2015 02:12:35 +0000 (UTC) Cc: Emacs Devel To: Michael Mauger Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 04 04:12:26 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZXgUL-0005RY-0L for ged-emacs-devel@m.gmane.org; Fri, 04 Sep 2015 04:12:25 +0200 Original-Received: from localhost ([::1]:53923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXgUK-0001Lx-F7 for ged-emacs-devel@m.gmane.org; Thu, 03 Sep 2015 22:12:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXgU7-0001Lc-9a for emacs-devel@gnu.org; Thu, 03 Sep 2015 22:12:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZXgU2-0000mA-AQ for emacs-devel@gnu.org; Thu, 03 Sep 2015 22:12:11 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:50447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZXgU2-0000ko-6y for emacs-devel@gnu.org; Thu, 03 Sep 2015 22:12:06 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0AsEwA731xV//rn92hcgxCEAoVVuzcJh0sEAgKBPDkUAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQSFBgNJIg3CM8jAQEBAQYCAR+LOoUFB4QtBYtEk1ODa4J+jwQjhBQigngBAQE X-IPAS-Result: A0AsEwA731xV//rn92hcgxCEAoVVuzcJh0sEAgKBPDkUAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQSFBgNJIg3CM8jAQEBAQYCAR+LOoUFB4QtBYtEk1ODa4J+jwQjhBQigngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="162358836" Original-Received: from 104-247-231-250.cpe.teksavvy.com (HELO ceviche.home) ([104.247.231.250]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Sep 2015 22:12:04 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 5152B66096; Thu, 3 Sep 2015 22:12:04 -0400 (EDT) In-Reply-To: <1668732705.1162011.1441310007202.JavaMail.yahoo@mail.yahoo.com> (Michael Mauger's message of "Thu, 3 Sep 2015 19:53:27 +0000 (UTC)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:189568 Archived-At: > Please correct me if I am not right here, but it appears that in > byte-compiled files (don't always?) expand #$ to the current elisp > file name. I wrote a module containing the following code: > (message "x: %S" #$) The issue here is that #$ is a "reader macro", so it is replaced by the content of load-file-name when this expression is *read*. When the .el file is loaded, this expression is read when load-file-name has the intended value, but when it is compiled, this expression is read during byte-compilation (i.e. not during any kind of "load"ing) when load-file-name is nil. So #$ will be read as if nil appeared there in the file. Hence the byte-compiler will generate code which behaves just like (message "x: %S" nil) -- Stefan