From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Safety of elisp-flymake-byte-compile (Was Re: [Emacs-diffs] scratch/allow-custom-load-paths) Date: Fri, 14 Dec 2018 08:27:12 -0500 Message-ID: References: <20181204233600.7907.75252@vcs0.savannah.gnu.org> <20181204233601.273DD209DC@vcs0.savannah.gnu.org> <87sgz89mpu.fsf_-_@gmail.com> <87mupe9qqw.fsf@gmail.com> <87in019dle.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1544793960 27994 195.159.176.226 (14 Dec 2018 13:26:00 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 14 Dec 2018 13:26:00 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: =?windows-1252?B?Sm/jbyBU4XZvcmE=?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 14 14:25:56 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gXnTW-00077i-ON for ged-emacs-devel@m.gmane.org; Fri, 14 Dec 2018 14:25:54 +0100 Original-Received: from localhost ([::1]:33519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnVd-0000mH-Cy for ged-emacs-devel@m.gmane.org; Fri, 14 Dec 2018 08:28:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnUz-0000G0-3e for emacs-devel@gnu.org; Fri, 14 Dec 2018 08:27:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnUu-0005T6-VY for emacs-devel@gnu.org; Fri, 14 Dec 2018 08:27:24 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:44130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnUr-0005Ac-FK for emacs-devel@gnu.org; Fri, 14 Dec 2018 08:27:19 -0500 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id wBEDRCQ4005014; Fri, 14 Dec 2018 08:27:13 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id D82676AA99; Fri, 14 Dec 2018 08:27:12 -0500 (EST) In-Reply-To: (=?windows-1252?Q?=22Jo=E3o_T=E1v?= =?windows-1252?Q?ora=22's?= message of "Fri, 14 Dec 2018 13:09:23 +0000") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6439=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6439> : inlines <6985> : streams <1807104> : uri <2764710> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:231830 Archived-At: > Oh, I didn't know about load-history. So is this usable? > > (defun moderately-trusted-p (file) > (catch 'done > (let ((file (expand-file-name file)) > (lhist load-history) > (lpath load-path) > probe) > (and > (string-match "\\.elc?$" file) ^ \\' > (while (setq probe (pop lhist)) > (when (and (car probe) > (equal (file-name-sans-extension file) > (file-name-sans-extension (car probe)))) > (throw 'done t))) > (while (setq probe (pop lpath)) > (when (equal (file-name-as-directory > (file-name-directory file)) > (file-name-as-directory probe)) > (throw 'done t))))))) LGTM > Or do you want to write this in C for speed? Where should this be > plugged into? load in lread.c directly? I don't understand the question. AFAIK this would only be used within bytecomp.el when processing a `defmacro` in order to decide whether it should be added to byte-compile-macro-environment or not. > We should still hand load-path and load-history, or a part of > load-history down to the flymake'in slave emacs, right? Ah, right, we'd then need to pass the `car` of load-history entries to the slave. Stefan