From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id GGxeCTrBs2CPJgAAgWs5BA (envelope-from ) for ; Sun, 30 May 2021 18:45:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id kEqoBDrBs2CZfQAAbx9fmQ (envelope-from ) for ; Sun, 30 May 2021 16:45:46 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C84DA1346D for ; Sun, 30 May 2021 18:45:44 +0200 (CEST) Received: from localhost ([::1]:51124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnOZK-0003RG-IM for larch@yhetil.org; Sun, 30 May 2021 12:45:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnOYS-0003Qy-B9 for emacs-orgmode@gnu.org; Sun, 30 May 2021 12:44:48 -0400 Received: from 119.ip-51-38-65.eu ([51.38.65.119]:57772 helo=mail.kisara.moe) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnOYQ-0003s5-Eo for emacs-orgmode@gnu.org; Sun, 30 May 2021 12:44:48 -0400 Received: from mk-desktop (unknown [193.32.210.154]) by mail.kisara.moe (Postfix) with ESMTPSA id B1AB5A0521; Sun, 30 May 2021 18:44:42 +0200 (CEST) From: Mohsin Kaleem To: Nicolas Goaziou Subject: [kisara.moe] Re: [kisara.moe] Re: [kisara.moe] Bug: async latex export fails due to post-process lambda [9.4.4 (release_9.4.4-188-ga8df76 @ /home/mohkale/.config/emacs/lisp/straight/build/org/)] In-Reply-To: <87bl8tz318.fsf@nicolasgoaziou.fr> References: <87y2c21d6p.fsf@kisara.moe> <87bl8tz318.fsf@nicolasgoaziou.fr> Date: Sun, 30 May 2021 17:43:08 +0100 Message-ID: <87k0ngjhpf.fsf@kisara.moe> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=51.38.65.119; envelope-from=mohkale@kisara.moe; helo=mail.kisara.moe X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1622393144; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=3/zF5bum+OIu/31HWG/2xR4EvTrv5s+vwMiIG+y2fTw=; b=Mr2v/4LAhhUJNzs1fZwbF8sCtHhTjPNB97Vp+S2LbXQ5aooQ19T28si38hkKln/Fh5R4xh QF2uEiHPsfIPZGbtanYH/64azcQy8XD+bybXHusbgREUVm+MKbO/o7Q83CcpX5RZ/Per69 BTx29FXvhfIrC0FsOFy47rd+85ZHLEhHzLNk6HJDgI8M0k26uj9DsUmODtDR63gbLkv4t+ Knx3GDjRAuSQg+Ry1rOYJ+Yz8x08eOoYExeJsjyJkwZLKJaKYfL6Dhws+iU1L//pMFKvwO kMyGb/WYAu9XdwAsUZ/71zWuvKp1pgaceCcEynd/PSnYevDWvo4F9IT/P8YWAw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622393144; a=rsa-sha256; cv=none; b=UWmd1MBQU3HKo+PaCF0FQS/nLjQxZrQBHVKyCzYv5b4x7d1+pzoz9qkDcjkZ1T7FKon3gy RC5qPbe0xk9Zh8cwALqguQgIGNzfo9lrtfW+yTp/bJJtpLe9Op7ejiufxLKQGeRwmzlx+3 PNNRv9SBJYtGeDQw4uh+Gmzaks5nJJf2wE67Ob36+xapQQtDsgtGeHHezvk3sdWDWXSl77 Nmuoq/U4GZ9GbGPx6FedgkVC2NntyT/xwzhwEoaxP6wsQstQHNz/FHr+4bTpNrsvn2c2kO OmJzduI1PguPit9w7c9mZsDXzL9+HjHLALupqTrjP4T+obobLyFNucB65mVGCg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.23 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kisara.moe (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: C84DA1346D X-Spam-Score: -2.23 X-Migadu-Scanner: scn0.migadu.com X-TUID: HN+/VbYb9IpZ --=-=-= Content-Type: text/plain Nicolas Goaziou writes: > mohsin kaleem writes: > >> I've been trying to get async-export setup for the past day and I've >> found it keeps failing due to an unexpected # in the compilation script >> generated by org-export. >> >> After doing a little debugging I found the script contained >> ~(funcall '# "foo.tex")~ >> so at some point in the export org-mode is including an evaluated lambda >> when a quoted one is required. > > Your bug sounds plausible, but I cannot reproduce it. Hmmm... that's strange. Running: 1. `emacs -nw` 2. `C-x C-f ~/foo.org` 3. Insert some text 4. `M-: (setq org-export-in-background t)` 5. `M-: (setq org-export-async-init-file "/path/to/some/file.el")` For some reason async export fails when this is nil. 6. `M-x org-export-dispatch lp` Ends with the export process failing and the `*Org Export Process*` buffer containing: ``` Loading /home/mohkale/.config/emacs/early-init.el (source)... Debugger entered--Lisp error: (invalid-read-syntax "#" 1 0) read(#) eval-buffer(# nil "/tmp/org-export-processv2hIqF" nil t) ; Reading at buffer position 3743 load-with-code-conversion("/tmp/org-export-processv2hIqF" "/tmp/org-export-processv2hIqF" nil t) load("/tmp/org-export-processv2hIqF" nil t) command-line-1(("-l" "/home/mohkale/.config/emacs/lisp/+org-async-init.e..." "-l" "/tmp/org-export-processv2hIqF")) command-line() normal-top-level() ``` This might be related to newer versions of emacs and how they treat lambdas internally, could you retry with emacs 28.0.5 if you still can't reproduce it. >> - (lambda (file) (org-latex-compile file))))) >> + `(lambda (file) (org-latex-compile file))))) > > Anyhow, would #'org-latex-compile fix the issue, too? Apologies if my explanation wasn't sufficient, I've attached a copy of the build script that org-export generates to this email. --=-=-= Content-Type: #("application/emacs-lisp" 0 1 (completion-score 0.18181818181818182) 18 22 (face completions-common-part)) Content-Disposition: attachment; filename=build.el Content-Transfer-Encoding: quoted-printable Content-Description: build script ;; -*- coding: undecided-unix; -*- (with-temp-buffer (when org-export-async-debug '(setq debug-on-error t)) (s= etq kill-emacs-hook nil org-babel-confirm-evaluate-answer-no t) (require 'o= x) (funcall (lambda nil (let ((inhibit-modification-hooks t)) (let ((org-mo= de-hook nil) (org-inhibit-startup t)) (org-mode)) (set (make-local-variable= 'org-target-link-regexp) 'nil) (set (make-local-variable 'org-macro-templa= tes) '(("date" . "") ("title" . "Foo Bar") ("email" . "") ("author" . "") (= "input-file" . "foo.org") ("modification-time" . "(eval (format-time-string $1 (or (and (org-string-nw-p $2) (org-macro--vc-modified-time \"/home/mohkale/= foo.org\")) '(24755 48598 358268 200000))))") ("n" . "(eval (org-m= acro--counter-increment $1 $2))") ("keyword" . "(eval (org-macro--find-keyw= ord-value $1))") ("time" . "(eval (format-time-string $1))") ("property" . = "(eval (org-macro--get-property $1 $2))"))) (set (make-local-variable 'org-= table-may-need-update) 't) (set (make-local-variable 'org-latex-and-related= -regexp) '"") (set (make-local-variable 'org-todo-line-tags-regexp) '"^\\(\= \*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[ ]+\\(:[[:aln= um:]:_@#%]+:\\)\\)?[ ]*$") (set (make-local-variable 'org-complex-heading-= regexp-format) '"^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(\\[#.\\]\= \)\\)?\\(?: +\\(?:\\[[0-9%%/]+\\] *\\)*\\(%s\\)\\(?: *\\[[0-9%%/]+\\]\\)*\\= )\\(?:[ ]+\\(:[[:alnum:]_@#%%:]+:\\)\\)?[ ]*$") (set (make-local-variable= 'org-complex-heading-regexp) '"^\\(\\*+\\)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?= : +\\(\\[#.\\]\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[ ]+\\(:[[:alnum:]_@#%:]+:\= \)\\)?[ ]*$") (set (make-local-variable 'org-todo-line-regexp) '"^\\(\\*+\= \)\\(?: +\\(DONE\\|TODO\\)\\)?\\(?: +\\(.*?\\)\\)?[ ]*$") (set (make-local= -variable 'org-not-done-heading-regexp) '"^\\(\\*+\\)\\(?: +\\(TODO\\)\\)\\= (?: +\\(.*?\\)\\)?[ ]*$") (set (make-local-variable 'org-not-done-regexp) = '"\\(TODO\\)") (set (make-local-variable 'org-todo-regexp) '"\\(DONE\\|TODO= \\)") (set (make-local-variable 'org-not-done-keywords) '("TODO")) (set (ma= ke-local-variable 'org-todo-log-states) 'nil) (set (make-local-variable 'or= g-todo-sets) '(("TODO" "DONE"))) (set (make-local-variable 'org-todo-heads)= '("TODO")) (set (make-local-variable 'org-done-keywords) '("DONE")) (set (= make-local-variable 'org-todo-keywords-1) '("TODO" "DONE")) (set (make-loca= l-variable 'org-todo-key-trigger) 'nil) (set (make-local-variable 'org-todo= -key-alist) '((:startgroup) ("TODO" . 116) ("DONE" . 100) (:endgroup))) (se= t (make-local-variable 'org-todo-kwd-alist) '(("TODO" sequence "TODO" "DONE= " "DONE") ("DONE" sequence "TODO" "DONE" "DONE"))) (set (make-local-variabl= e 'org-table-formula-constants-local) 'nil) (set (make-local-variable 'org-= keyword-properties) 'nil) (set (make-local-variable 'org-tag-groups-alist) = 'nil) (set (make-local-variable 'org-current-tag-alist) 'nil) (set (make-lo= cal-variable 'org-file-tags) 'nil) (set (make-local-variable 'buffer-file-n= ame) '"/home/mohkale/foo.org") (set (make-local-variable 'default-directory= ) '"/home/mohkale/") (set (make-local-variable 'buffer-file-coding-system) = 'undecided-unix) (insert #("#+TITLE: Foo Bar Hello world can you believe it buddy. " 0 8 (fontified t font-lock-fontified t face org-document-info-keyword) 8 = 9 (fontified t) 9 17 (fontified t font-lock-fontified t face org-document-t= itle) 17 56 (fontified t))) (narrow-to-region 1 57) (goto-char 19)))) (rest= ore-buffer-modified-p nil) (print (progn (let ((output (org-export-as 'late= x nil nil nil '(:output-file "foo.tex")))) (with-temp-buffer (insert output= ) (let ((coding-system-for-write 'undecided-unix)) (write-file "foo.tex")))= (or (ignore-errors (funcall '# "foo.tex")) "foo.tex"))))) --=-=-= Content-Type: text/plain At the very end of the script you can see where the callback is called. The issue is fixed because with the quoted lambda when org tries to write it into the async build script (I.E. `(message "%s" callback-function)`) it'll be outputted verbatim (as a lisp expression). Instead my emacs atm represents the lambda as some anonymous function object (resembling `#`) so when org tries to print it out it'll just print this garbage representation instead of the function it should call. --- Mohsin K. --=-=-=--