emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mohsin Kaleem <mohkale@kisara.moe>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
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/)]
Date: Sun, 30 May 2021 17:43:08 +0100	[thread overview]
Message-ID: <87k0ngjhpf.fsf@kisara.moe> (raw)
In-Reply-To: <87bl8tz318.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 1990 bytes --]

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> mohsin kaleem <mohkale@kisara.moe> 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 '#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_77> "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(#<buffer  *load*>)
  eval-buffer(#<buffer  *load*> 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.

[-- Attachment #2: build script --]
[-- Type: #("application/emacs-lisp" 0 1 (completion-score 0.18181818181818182) 18 22 (face completions-common-part)), Size: 3837 bytes --]

;; -*- coding: undecided-unix; -*-
(with-temp-buffer (when org-export-async-debug '(setq debug-on-error t)) (setq kill-emacs-hook nil org-babel-confirm-evaluate-answer-no t) (require 'ox) (funcall (lambda nil (let ((inhibit-modification-hooks t)) (let ((org-mode-hook nil) (org-inhibit-startup t)) (org-mode)) (set (make-local-variable 'org-target-link-regexp) 'nil) (set (make-local-variable 'org-macro-templates) '(("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-macro--counter-increment $1 $2))") ("keyword" . "(eval (org-macro--find-keyword-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\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[ 	]+\\(:[[:alnum:]:_@#%]+:\\)\\)?[ 	]*$") (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 (make-local-variable 'org-todo-log-states) 'nil) (set (make-local-variable 'org-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-local-variable 'org-todo-key-trigger) 'nil) (set (make-local-variable 'org-todo-key-alist) '((:startgroup) ("TODO" . 116) ("DONE" . 100) (:endgroup))) (set (make-local-variable 'org-todo-kwd-alist) '(("TODO" sequence "TODO" "DONE" "DONE") ("DONE" sequence "TODO" "DONE" "DONE"))) (set (make-local-variable '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-local-variable 'org-file-tags) 'nil) (set (make-local-variable 'buffer-file-name) '"/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-title) 17 56 (fontified t))) (narrow-to-region 1 57) (goto-char 19)))) (restore-buffer-modified-p nil) (print (progn (let ((output (org-export-as 'latex 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 '#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_77> "foo.tex")) "foo.tex")))))

[-- Attachment #3: Type: text/plain, Size: 560 bytes --]

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 `#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_77>`)
so when org tries to print it out it'll just print this garbage
representation instead of the function it should call.

---
Mohsin K.

  reply	other threads:[~2021-05-30 16:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-26  1:44 mohsin kaleem
2021-05-29 20:41 ` Nicolas Goaziou
2021-05-30 16:43   ` Mohsin Kaleem [this message]
2021-05-30 17:18     ` Greg Minshall
2021-05-30 17:54       ` [kisara.moe] Re: [kisara.moe] " Mohsin Kaleem
2021-07-05  5:02         ` Mohsin Kaleem
2021-07-05  6:26           ` Nicolas Goaziou
2021-07-05 16:04             ` [kisara.moe] Re: [kisara.moe] " Mohsin Kaleem
2021-07-05 16:41               ` Nicolas Goaziou
2021-07-05 19:50                 ` [kisara.moe] Re: [kisara.moe] " Mohsin Kaleem
2021-07-05 19:56                   ` Mohsin Kaleem
2021-09-15 21:19                     ` Mohsin Kaleem
2021-09-20  6:03                       ` Sébastien Miquel
2021-09-20 11:11                         ` Mohsin Kaleem

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0ngjhpf.fsf@kisara.moe \
    --to=mohkale@kisara.moe \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --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/)]' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).