From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#59334: 29.0.50; loading native-compiled init file sets user-init-file to .eln Date: Fri, 18 Nov 2022 09:27:52 +0200 Message-ID: <83a64od8nb.fsf@gnu.org> References: <8335aheqct.fsf@gnu.org> <83wn7td6l0.fsf@gnu.org> <83fsehcpi2.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24778"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59334@debbugs.gnu.org, akrl@sdf.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Nov 18 08:33:29 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ovvsP-0006GD-9w for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 18 Nov 2022 08:33:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ovvoa-0006yt-2O; Fri, 18 Nov 2022 02:29:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovvoR-0006wL-Lu for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 02:29:23 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ovvo5-0005u6-Rd for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 02:29:20 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ovvo5-0003rO-O5 for bug-gnu-emacs@gnu.org; Fri, 18 Nov 2022 02:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 Nov 2022 07:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59334 X-GNU-PR-Package: emacs Original-Received: via spool by 59334-submit@debbugs.gnu.org id=B59334.166875649714775 (code B ref 59334); Fri, 18 Nov 2022 07:29:01 +0000 Original-Received: (at 59334) by debbugs.gnu.org; 18 Nov 2022 07:28:17 +0000 Original-Received: from localhost ([127.0.0.1]:35114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovvnM-0003qE-Nh for submit@debbugs.gnu.org; Fri, 18 Nov 2022 02:28:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:33644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ovvnH-0003ps-Tu for 59334@debbugs.gnu.org; Fri, 18 Nov 2022 02:28:15 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovvn7-0005qB-7f; Fri, 18 Nov 2022 02:28:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UC2kby4wCOUpzeSQT9tuGSFcx322LAHZAkq6n55HEYE=; b=S+hPDXWrwx8R 2fsAYNHTTCWDf2qWEbHvEzC06v925/uDg29Vbhfq3HjK83PqVwN2B4SaehbewH7zB25M6iSPYLP8I n6qyi4gbuZoN0qHBF1PwT9wNRJUkIdwIOvC3YDb0WakQl154+icyL7gYwnq4sX+JlmETDUggCOffT ux80uoqRlshClOYt4fL+It8UoNcUrZNG4/CT+thg4fLsUdBmRKOD4Wv6Xrbve79KxU/tgBOrn1w6H aAM6C7cOXhQAiceKjsXAR9KZV3XEvlo9bOAcfnfG2OyzNFDSBEmPD0ijF4YOcDaohzASXfxOqyN4q yoZxcuMdxY/1tOGLk2K7+A==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ovvn2-0006TF-8G; Fri, 18 Nov 2022 02:28:00 -0500 In-Reply-To: (message from Juanma Barranquero on Fri, 18 Nov 2022 03:25:34 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248175 Archived-At: > From: Juanma Barranquero > Date: Fri, 18 Nov 2022 03:25:34 +0100 > Cc: Andrea Corallo , 59334@debbugs.gnu.org > > diff --git i/lisp/startup.el w/lisp/startup.el > index 70267fc857..62984426e5 100644 > --- i/lisp/startup.el > +++ w/lisp/startup.el > @@ -1064,7 +1064,11 @@ startup--load-user-init-file > ;; If we loaded a compiled file, set `user-init-file' to > ;; the source version if that exists. > - (when (equal (file-name-extension user-init-file) > - "elc") > - (let* ((source (file-name-sans-extension user-init-file)) > + (when (member (file-name-extension user-init-file) > + '("elc" "eln")) > + (let* ((source (file-name-sans-extension > + (or (gethash > + (file-name-nondirectory user-init-file) > + comp-eln-to-el-h) > + user-init-file))) > (alt (concat source ".el"))) > (setq source (cond ((file-exists-p alt) alt) I think the call to gethash should only be done if the file has the .eln extension, otherwise you might have false positives. The logic should be something like . if the extension is .eln then - try to get the corresponding .el file by gethash - if that fails, leave user-init-file to be the original .eln file name, perhaps with a warning - otherwise, set user-init-file to the .el file from gethash . else The file-exists-and-is-newer test is not relevant to the .eln case, because Emacs will not load a .eln file that is outdated wrt its source, and will not use a .eln file whose source is not available. Andrea, please correct me if I'm wrong.