From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master f8bb6cca33: Return the same file from locate-file in nativecomp and non Date: Sat, 12 Mar 2022 18:23:36 -0500 Message-ID: References: <164712074096.14747.18124931770043811100@vcs2.savannah.gnu.org> <20220312213221.451B3C01684@vcs2.savannah.gnu.org> <87fsnmyh4q.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15813"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 13 00:24:29 2022 Return-path: Envelope-to: ged-emacs-devel@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 1nTB64-0003r7-4D for ged-emacs-devel@m.gmane-mx.org; Sun, 13 Mar 2022 00:24:28 +0100 Original-Received: from localhost ([::1]:60604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nTB62-0008HE-OH for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Mar 2022 18:24:26 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60066) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTB5R-0007b5-AE for emacs-devel@gnu.org; Sat, 12 Mar 2022 18:23:49 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:1053) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTB5O-0002kG-Bz for emacs-devel@gnu.org; Sat, 12 Mar 2022 18:23:47 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2C23880009; Sat, 12 Mar 2022 18:23:44 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 4559480377; Sat, 12 Mar 2022 18:23:38 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1647127418; bh=KUojJZTPIW7WeY9wIv3SPsyeqLCaVg1VmyFJH6/30KQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=fewmYG8w/4hoLealhVHRc3cPMlhKJBjjOOKOt7rkJDXNW4VILQIP52tLnkytwkCvL OqvBqBpqoyNFkhopg/T7S/DtJxa0fML8PHISEJTHrVu6usNy+OvdSPdOios1zdW+qb 1WeSJ9VlaewromixwYve6BzKyN4itJj6irWZ3YojybdFRKCvj80SEUTWZcKK/7ESdS BhLrfmwKXYgO4TOu8lQlYf65UK8MqdRuLFnJUTy+8PyNMeNTHdo4jPPedQ8koCG3c1 ZczxFF45nXwvwhWGgI1s8e905IT6pyFnAz+RUwS5gHqV/Inl4P3YrbsYfpdMw7WhJK 9DyRe23D8Toyg== Original-Received: from ceviche (unknown [45.72.221.51]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 0C9DD12027C; Sat, 12 Mar 2022 18:23:38 -0500 (EST) In-Reply-To: <87fsnmyh4q.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sat, 12 Mar 2022 22:51:01 +0100") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:287056 Archived-At: Lars Ingebrigtsen [2022-03-12 22:51:01] wrote: > Stefan Monnier writes: >> IOW the patch above makes things closer to what they should be, but >> we should simply not need that because locate-file-internal should not >> magically replace `.elc` files with `.eln` files. > Indeed. Patches welcome. How 'bout Stefan diff --git a/lisp/files.el b/lisp/files.el index 7be93662b1c..eca8cba93f2 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -987,20 +987,7 @@ locate-file (logior (if (memq 'executable predicate) 1 0) (if (memq 'writable predicate) 2 0) (if (memq 'readable predicate) 4 0)))) - (let ((file (locate-file-internal filename path suffixes predicate))) - (if (and file (string-match "\\.eln\\'" file)) - ;; This is all a bit of a mess. We pass in a list of suffixes - ;; that doesn't include .eln, but with a nativecomp emacs, we - ;; get the .eln file back. We then map that to the .el file. - ;; But `load-history' has the .elc file, so that's the file we - ;; return here (if it exists). - (let* ((el (gethash (file-name-nondirectory file) comp-eln-to-el-h)) - (elc (replace-regexp-in-string "\\.el\\'" ".elc" el))) - (if (and (member ".elc" suffixes) - (file-exists-p elc)) - elc - el)) - file))) + (locate-file-internal filename path suffixes predicate)) (defun locate-file-completion-table (dirs suffixes string pred action) "Do completion for file names passed to `locate-file'." diff --git a/src/lread.c b/src/lread.c index 0486a98883c..d7b56c5087e 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1661,7 +1661,7 @@ DEFUN ("locate-file-internal", Flocate_file_internal, Slocate_file_internal, 2, (Lisp_Object filename, Lisp_Object path, Lisp_Object suffixes, Lisp_Object predicate) { Lisp_Object file; - int fd = openp (path, filename, suffixes, &file, predicate, false, false); + int fd = openp (path, filename, suffixes, &file, predicate, false, true); if (NILP (predicate) && fd >= 0) emacs_close (fd); return file;