From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#40838: 28.0.50; [feature/native-comp] Function overrides in init.el are not honored after deferred compilation Date: Sat, 23 May 2020 22:13:06 +0800 Message-ID: <878shi3fkd.fsf@localhost> References: <87zhb0q8wi.fsf@localhost> <87lfmidexg.fsf@localhost> <87mu6v4qss.fsf@localhost> <87wo592rne.fsf@localhost> <87o8qk39o5.fsf@localhost> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="40995"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40838@debbugs.gnu.org To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 23 16:18:13 2020 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 1jcUyb-000Ac3-08 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 May 2020 16:18:13 +0200 Original-Received: from localhost ([::1]:42382 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jcUyZ-0008BU-JY for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 May 2020 10:18:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jcUyR-0008Ax-2x for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 10:18:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51928) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jcUyQ-0006iB-Bv for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 10:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jcUyQ-0001iD-80 for bug-gnu-emacs@gnu.org; Sat, 23 May 2020 10:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 May 2020 14:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40838 X-GNU-PR-Package: emacs Original-Received: via spool by 40838-submit@debbugs.gnu.org id=B40838.15902434786570 (code B ref 40838); Sat, 23 May 2020 14:18:02 +0000 Original-Received: (at 40838) by debbugs.gnu.org; 23 May 2020 14:17:58 +0000 Original-Received: from localhost ([127.0.0.1]:35241 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcUyM-0001hu-C0 for submit@debbugs.gnu.org; Sat, 23 May 2020 10:17:58 -0400 Original-Received: from mail-pl1-f169.google.com ([209.85.214.169]:39751) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jcUyH-0001ha-2Z for 40838@debbugs.gnu.org; Sat, 23 May 2020 10:17:56 -0400 Original-Received: by mail-pl1-f169.google.com with SMTP id x18so4463390pll.6 for <40838@debbugs.gnu.org>; Sat, 23 May 2020 07:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=msUJD1F6DWXeqb+X372yz9rx4FPnB2QOpq7EwO2b+Bg=; b=CHLnjVm6ci0DPQbRDiFJWjUNA2Tqj7/kHj2MZ2TFyZF+iSpNDBOZp1shbT4sY8YUcJ ak+bupFvrHsAaKBlBcCnEsiKo79px7v6tzYSPhpM9AVV1QieHmb6CNkUBIG0s4c5Wvgz 8tpr+bdbs3fgs0MklDnqf+smBIjqB60vhJTUzhcbVrZTzD4YnS1krRK0JLryj+hXQgpr 6oOsaVGRDDR8JRAVCEax63+PwQ8lkjauL0RW+nHIfqp+Njj7AM24zaI9EIREGZw6fMeC usGI+zxrNhOT913EqTyVFgXZDFABhJnVWvq+UBp2+GHpFsHTSSDpYG4vjZxWvgiXwpJV jsHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=msUJD1F6DWXeqb+X372yz9rx4FPnB2QOpq7EwO2b+Bg=; b=G90CS/YtCdDZEYwOPwF6v8opX6YS+pUXMxgBxTqXM+tmxQXjRTjtXogaSmJnearHWl MZAZlQTmwZbNJ/nNGp1hQ/M006+SqMPdYFTBIuvSBrFlhb/Pzw7w0LLkbUmEm9cn2sKg RR9Xqpw2cG6GObpUxJIHwIUV+QituD2hVPTvKdBTaDyJQ5XXelCqz0LvWolQf9lxX1CZ XRUg4vzp2mdpcCQjBLjC2B05HM+GRGU+wC06nBKWg2LTb4mlALfgl7tGb3nUNIAVjZzj aQ9yA3G6OcEqDeNLem1NbZZkeVf9bpiIfbRbax3JfVHCZB2aR3NUxiya1V8oYX0uYOMA qYbw== X-Gm-Message-State: AOAM533mmyZ7/lvBjD8qjFE4+qIyVlwGC04Kuiaod7/Q623rEgYQFCEa 57xeZwEeaCJ4ch73P14VlBk= X-Google-Smtp-Source: ABdhPJy/DcSTvnhVSrZ99T75TKurqm14UPYM+cz3Zl5+dFn+SZE2vTDi+0dzsZCuFqYrJo5yhWku3A== X-Received: by 2002:a17:90a:3ad1:: with SMTP id b75mr10962252pjc.216.1590243466815; Sat, 23 May 2020 07:17:46 -0700 (PDT) Original-Received: from localhost ([104.151.6.52]) by smtp.gmail.com with ESMTPSA id s28sm9401284pfd.21.2020.05.23.07.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 23 May 2020 07:17:46 -0700 (PDT) In-Reply-To: <87o8qk39o5.fsf@localhost> 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" Xref: news.gmane.io gmane.emacs.bugs:180805 Archived-At: --=-=-= Content-Type: text/plain > If this is what is happening with straight.el, then my recipe is not > actually reproducing my initial bug report. I have other cases when > functions redefined in my config are overridden by initial definition > when .eln is loaded. I think that I still need to investigate for a real > recipe then. I have recently tried to find a temporary workaround to this issue with straight.el+org+native-comp. However, my workaround seems to fail because of native-comp (at least, I believe so). The recipe is the same, but I forcefully defined org-version, org-release, and org-git-version in my init.el before loading org. See the attached file for details. Best, Ihor --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=native-fail-recepy.el Content-Transfer-Encoding: quoted-printable (setq comp-deferred-compilation t) ;; enable automatic native-compilation (setq straight-repository-branch "develop") (setq straight-vc-git-default-protocol 'ssh) (setq straight--wait-for-async-jobs nil) (eval-and-compile (defvar bootstrap-version) (let ((bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-di= rectory)) (bootstrap-version 5)) (unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/raxod502/straight.el/develop/install= .el" 'silent 'inhibit-cookies) (goto-char (point-max)) (eval-print-last-sexp))) (load bootstrap-file nil 'nomessage))) (setq load-prefer-newer t) (eval-and-compile (straight-use-package 'use-package)) (defun org-git-version () "The Git version of org-mode. Inserted by installing org-mode or when a release is made." (let ((default-directory (straight--repos-dir "org"))) (string-trim (with-output-to-string (with-current-buffer standard-output (call-process "git" nil t nil "describe" "--match=3Drelease*" "--abbrev=3D6" "HEAD")))))) (defun org-release () "The release version of org-mode. Inserted by installing org-mode or when a release is made." (let ((default-directory (straight--repos-dir "org"))) (string-trim (string-remove-prefix "release_" (with-output-to-string (with-current-buffer standard-output (call-process "git" nil t nil "describe" "--match=3Drelease*" "--abbrev=3D0" "HEAD"))))))) (defun org-version (&optional here full message) "Show the Org version. Interactively, or when MESSAGE is non-nil, show it in echo area. With prefix argument, or when HERE is non-nil, insert it at point. In non-interactive uses, a reduced version string is output unless FULL is given." (interactive (list current-prefix-arg t (not current-prefix-arg))) (let ((org-dir (ignore-errors (org-find-library-dir "org"))) (save-load-suffixes (when (boundp 'load-suffixes) load-suffixes)) (load-suffixes (list ".el")) (org-install-dir (ignore-errors (org-find-library-dir "org-loaddefs")))) (unless (and (fboundp 'org-release) (fboundp 'org-git-version)) (org-load-noerror-mustsuffix (concat org-dir "org-version"))) (let* ((load-suffixes save-load-suffixes) (release (org-release)) (git-version (org-git-version)) (version (format "Org mode version %s (%s @ %s)" release git-version (if org-install-dir (if (string=3D org-dir org-install-dir) org-install-dir (concat "mixed installation! " org-install-dir " and " org-dir)) "org-loaddefs.el can not be found!"))) (version1 (if full version release))) (when here (insert version1)) (straight-use-package '(org :type git :repo "https://code.orgmode.org/bzg/org-mode.git" :local-repo "org" :files (:defaults "contrib/lisp/*.el") :fork (:repo "/home/yantar92/Git/org-mode/" :branch "feature/drawertextp= rop"))) (use-package elfeed :straight t) (use-package elfeed-org :straight t :config (elfeed-org)) ;; when this file is loaded after org is native-compiled, the following err= or appears. ;; Error (use-package): elfeed-org/:catch: Invalid version syntax: =E2=80= =98N/A=E2=80=99 (must start with a number) ;; deleting org.eln makes the error disappears ;; possible cause: straight--fix-org-function from straight.el is redefinin= g some org.el functions ;; (org-git-version and org-release). This override fails to work in native= -compiled org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ihor Radchenko writes: >> In summary this is not a problem of the deferred compilation mechanism >> but is an hack that is not working for this case. >>=20 >> To mitigate this I've added a new customize you can use to define those >> functions (or whatever) into the compiler environment of the async >> compilation workers, is called `comp-async-env-modifier-form'. > > If this is what is happening with straight.el, then my recipe is not > actually reproducing my initial bug report. I have other cases when > functions redefined in my config are overridden by initial definition > when .eln is loaded. I think that I still need to investigate for a real > recipe then. > > Best, > Ihor > > > Andrea Corallo writes: > >> Ihor Radchenko writes: >> >>>> thanks this is appreciated because I haven't managed to reproduce it >>>> myself. >>> >>> Finally, I found some reproducible example. >>> straight.el redefines some org functions before loading org. >>> It is done in straight--fix-org-function (org-git-version and >>> org-release are redefined).=20 >>> The redefined version works with org.elc, but somehow get overridden >>> when org.eln is loaded (in my case, the loading is triggered by elfeed-= org). >>> >>> Steps to reproduce: >>> >>> 1. Use the attached file to load emacs. No errors should appear. >>> 2. Wait until org is native-compiled. >>> 3. Restart emacs. The following errors appears >>> (straight--fix-org-function supposed to be a workaround for this error): >>> >>> Error (use-package): elfeed-org/:catch: Invalid version syntax: =E2=80= =98N/A=E2=80=99 >>> (must start with a number) >>> >>> 4. Delete org.eln >>> 5. Restart emacs. The error disappears. >> >> Okay I think I've an idea of what is going on here. >> >> straight given wants to build org in a way org is not made for is >> hacking around the problem predefining in the compilation environment >> `org-release' and `org-git-version'. >> >> When org.el is loaded is executing at top level the expansion of >> `org-check-version' that is supposed to define these two functions, >> given are already defined by straight.el we should fall in the first if >> clause an the hacked functions remains. >> >> When the eln are compiled by deferred-compilation no-one is hacking the >> definition of these two functions in the way straight.el would like and >> so the trouble raise. >> >> In summary this is not a problem of the deferred compilation mechanism >> but is an hack that is not working for this case. >> >> To mitigate this I've added a new customize you can use to define those >> functions (or whatever) into the compiler environment of the async >> compilation workers, is called `comp-async-env-modifier-form'. >> >> 2ac6194585 * Add new customize `comp-async-env-modifier-form' (Bug#40838) >> >> I'm for closing this. >> >> Bests >> >> Andrea >> >> --=20 >> akrl@sdf.org > > --=20 > Ihor Radchenko, > PhD, > Center for Advancing Materials Performance from the Nanoscale (CAMP-nano) > State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong= University, Xi'an, China > Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg --=20 Ihor Radchenko, PhD, Center for Advancing Materials Performance from the Nanoscale (CAMP-nano) State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong U= niversity, Xi'an, China Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg --=-=-=--