Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Ob-async does not work. #2010

Closed
GTrunSec opened this issue Nov 4, 2019 · 25 comments
Closed

[BUG] Ob-async does not work. #2010

GTrunSec opened this issue Nov 4, 2019 · 25 comments
Labels
is:bug Something isn't working as intended module:lang/org Pertains to Doom's :lang org module status:resolved Issue was addressed internally

Comments

@GTrunSec
Copy link
Contributor

GTrunSec commented Nov 4, 2019

the bug output
error in process sentinel: Cannot open load file: No such file or directory, org-version.el
see issues
if you clean uprm -rf ~/.emacs.d/.local/straight/build/org-plus-contrib/*.elc. it's working.
But, we got new problem, the emacs can not find org version. similar like this issues.

@GTrunSec GTrunSec added the is:bug Something isn't working as intended label Nov 4, 2019
@hlissner hlissner added module:lang/org Pertains to Doom's :lang org module status:unconfirmed Still under investigation. and removed is:bug Something isn't working as intended labels Nov 4, 2019
@hlissner
Copy link
Member

hlissner commented Nov 4, 2019

We have this hack in place to prevent this issue. I cannot reproduce it. Please include your M-x doom/info and steps to reproduce it.

@hlissner
Copy link
Member

hlissner commented Nov 4, 2019

Also, ob-async is already installed by Doom. You do not need to install or configure it yourself.

@GTrunSec
Copy link
Contributor Author

GTrunSec commented Nov 4, 2019

Also, ob-async is already installed by Doom. You do not need to install or configure it yourself.

I knew, Ob-async included in org feature. I just added (use-package! ob-async) in my config file. if you do not configure this. the ob async does not work.

@GTrunSec GTrunSec closed this as completed Nov 4, 2019
@GTrunSec GTrunSec reopened this Nov 4, 2019
@GTrunSec
Copy link
Contributor Author

GTrunSec commented Nov 4, 2019

We have this hack in place to prevent this issue. I cannot reproduce it. Please include your M-x doom/info and steps to reproduce it.

emacs   version    26.3
        features   NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS
        build      Sep 02, 2019
        buildopts  (--with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules)
        windowsys  ns
        daemonp    server-running
doom    version    2.0.9
        build      HEAD -> develop, origin/develop, origin/HEAD 04a2cb94c 2019-11-02 23:34:34 -0800
system  type       darwin
        config     x86_64-apple-darwin18.2.0
        shell      /bin/zsh
        uname      Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64
        path       (~/.poetry/bin/ /usr/local/opt/texinfo/bin/ /usr/local/opt/nss/bin/ ~/anaconda3/bin/ /usr/local/opt/imagemagick@6/bin/ ~/.cargo/bin/ /usr/local/bin/ /usr/local/opt/texinfo/bin/ /usr/bin/ /bin/ /usr/sbin/ /sbin/ /Applications/VMware Fusion.app/Contents/Public/ /Library/TeX/texbin/ /usr/local/MacGPG2/bin/ /opt/X11/bin/ /Applications/Wireshark.app/Contents/MacOS/ /usr/local/opt/ ~/go/bin/ /Applications/Emacs.app/Contents/MacOS/libexec/)
config  envfile    envvar-file
        elc-files  0
        modules    (:input chinese :completion company helm ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor file-templates fold rotate-text snippets :emacs dired electric ibuffer vc :tools (eval +overlay) flycheck (lookup +docsets) lsp magit :lang cc common-lisp data emacs-lisp ess go (haskell +intero) julia latex markdown nix (org +dragndrop +hugo +ipython +pandoc +present) python sh :app (rss +org) :config (default +smartparens) :private spacemacs-default)
        packages   (n/a)
        elpa       (n/a)

@GTrunSec
Copy link
Contributor Author

GTrunSec commented Nov 4, 2019

that will help you easy test : Org-src:
#+BEGIN_SRC sh :async
sleep 4s && echo 'done'
#+END_SRC

#+RESULTS:
: done

make sure results has output async task ID : 569af356b1428415f897587c8a351308
if you get issue that not find org-version.el
try run this:
#+BEGIN_SRC sh
rm -rf ~/.emacs.d/.local/straight/build/org-plus-contrib/*.elc
#+END_SRC

@hlissner
Copy link
Member

hlissner commented Nov 4, 2019

Ah, I can reproduce it. Try this and see if it resolves the issue:

(add-hook! 'ob-async-pre-execute-src-block-hook
           (load (expand-file-name "init.el" user-emacs-directory)))

@hlissner hlissner added is:bug Something isn't working as intended and removed status:unconfirmed Still under investigation. labels Nov 4, 2019
@GTrunSec
Copy link
Contributor Author

GTrunSec commented Nov 4, 2019

thanks, it's solved the issue. but if the user place initialization logic in ob-async-pre-execute-src-block-hook, which runs before execution of every src block. such as Julia:
(add-hook 'ob-async-pre-execute-src-block-hook '(lambda () (setq inferior-julia-program-name "/nix/store/qzpr1kwkhnz55mdlq8skc5sqrc6l2j2b-system-path/bin/julia") ))

added your config
`ob-async.el.

Value ((lambda nil (setq inferior-julia-program-name "/nix/store/qzpr1kwkhnz55mdlq8skc5sqrc6l2j2b-system-path/bin/julia")) (lambda (&rest _) (load (expand-file-name "init.el" user-emacs-directory))))

new issue.
error in process sentinel: async-handle-result: Cannot open load file: No such file or directory, ob-julia error in process sentinel: Cannot open load file: No such file or directory, ob-julia
So, how to write a config which can be load of both no error.

@hlissner
Copy link
Member

hlissner commented Nov 4, 2019

How about:

(defadvice! +org-init-doom-during-async-executation-a (orig-fn &rest args)
    :around #'ob-async-org-babel-execute-src-block
    (let ((ob-async-pre-execute-src-block-hook
           (cons (lambda () (load (expand-file-name "init.el" user-emacs-directory)))
                 ob-async-pre-execute-src-block-hook)))
      (apply orig-fn args)))

This should ensure that our hook is always first.

@GTrunSec
Copy link
Contributor Author

GTrunSec commented Nov 4, 2019

(defadvice! +org-init-doom-during-async-executation-a (orig-fn &rest args)
    :around #'ob-async-org-babel-execute-src-block
    (let ((ob-async-pre-execute-src-block-hook
           (cons (lambda () (load (expand-file-name "init.el" user-emacs-directory)))
                 ob-async-pre-execute-src-block-hook)))
      (apply orig-fn args)))

error in process sentinel: async-handle-result: Cannot open load file: No such file or directory, org error in process sentinel: Cannot open load file: No such file or directory, org

debug info :

Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "org") signal(file-missing ("Cannot open load file" "No such file or directory" "org")) async-handle-result((lambda (result) (with-current-buffer # (let ((default-directory "/home/gtrun/project/my-code/my-julia/")) (save-excursion (cond ((member "none" ...) (message "result silenced")) ((member "silent" ...) (message ...)) (t (goto-char #) (let ... ... ... ...))) (run-hooks (quote org-babel-after-execute-hook)))))) (async-signal (file-missing "Cannot open load file" "No such file or directory" "org")) #) async-when-done(# "finished\n")

@hlissner
Copy link
Member

hlissner commented Nov 4, 2019

Those errors don't seem related, but try this:

(defadvice! +org-init-doom-during-async-executation-a (orig-fn &rest args)
    :around #'ob-async-org-babel-execute-src-block
    (let ((ob-async-pre-execute-src-block-hook
           ;; Ensure our hook is always first
           (cons `(lambda ()
                    (load ,doom-autoload-file)
                    (load ,doom-package-autoload-file))
                 ob-async-pre-execute-src-block-hook)))
      (apply orig-fn args)))

@GTrunSec
Copy link
Contributor Author

GTrunSec commented Nov 4, 2019

Those errors don't seem related, but try this:

(defadvice! +org-init-doom-during-async-executation-a (orig-fn &rest args)
    :around #'ob-async-org-babel-execute-src-block
    (let ((ob-async-pre-execute-src-block-hook
           ;; Ensure our hook is always first
           (cons `(lambda ()
                    (load ,doom-autoload-file)
                    (load ,doom-package-autoload-file))
                 ob-async-pre-execute-src-block-hook)))
      (apply orig-fn args)))

error in process sentinel: async-handle-result: Symbol’s function definition is void: after! error in process sentinel: Symbol’s function definition is void: after!

@hlissner
Copy link
Member

hlissner commented Nov 4, 2019

I cannot reproduce these new errors, but try this:

(defadvice! +org-init-doom-during-async-executation-a (orig-fn &rest args)
    :around #'ob-async-org-babel-execute-src-block
    (let ((ob-async-pre-execute-src-block-hook
           ;; Ensure our hook is always first
           (cons `(lambda ()
                    (load ,(expand-file-name "init.el" doom-emacs-dir)))
                 ob-async-pre-execute-src-block-hook)))
      (apply orig-fn args)))

@hlissner
Copy link
Member

hlissner commented Nov 4, 2019

If possible, can you hop on our discord? I don't want to spam here.

@hlissner hlissner added the status:unknown Cause unknown; cannot be reproduced; cannot investigate further label Nov 4, 2019
@GTrunSec GTrunSec closed this as completed Nov 4, 2019
@hlissner hlissner added status:resolved Issue was addressed internally and removed status:unknown Cause unknown; cannot be reproduced; cannot investigate further labels Nov 4, 2019
hlissner added a commit that referenced this issue Nov 4, 2019
This allows batch scripts to load $EMACSDIR/init.el to use Doom's API.
Howevever, it puts the onus on the user to run `doom refresh` before
trying to use it.

This also indirectly addresses #2010
hlissner added a commit that referenced this issue Nov 4, 2019
@ztlevi
Copy link
Contributor

ztlevi commented Nov 19, 2019

Is this issue solved? I have the latest version of doom as 11/19/2019 20:30 PDT. But I still have missing org-version.el file.

@GTrunSec
Copy link
Contributor Author

GTrunSec commented Nov 19, 2019

Is this issue solved? I have the latest version of doom as 11/19/2019 20:30 PDT. But I still have missing org-version.el file.

Sure, No any issue appears in my config with lastest doom-version. You only need one config to your doom. for async
(use-package! 'ob-async)
No longer in my config
tested on darwin and nixos

emacs   version    26.3
        features   NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS
        build      Sep 02, 2019
        buildopts  (--with-ns '--enable-locallisppath=/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules)
        windowsys  ns
        daemonp    server-running
doom    version    2.0.9
        build      HEAD -> develop, origin/develop, origin/HEAD ff179b080 2019-11-18 18:13:59 -0800
system  type       darwin
        config     x86_64-apple-darwin18.2.0
        shell      /bin/zsh
        uname      Darwin 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64
        path       (~/.poetry/bin/ ~/.cargo/bin/ /usr/local/bin/ /usr/bin/ /bin/ /usr/sbin/ /sbin/ /Applications/VMware Fusion.app/Contents/Public/ /Library/TeX/texbin/ /usr/local/MacGPG2/bin/ /usr/local/share/dotnet/ /opt/X11/bin/ ~/.dotnet/tools/ /Applications/Wireshark.app/Contents/MacOS/ ~/.poetry/bin/ /usr/local/opt/texinfo/bin/ /usr/local/opt/nss/bin/ ~/anaconda3/bin/ /usr/local/opt/imagemagick@6/bin/ ~/.cargo/bin/ /usr/local/opt/ ~/go/bin/ /Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14/ /Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14/ /Applications/Emacs.app/Contents/MacOS/libexec/)
config  envfile    envvar-file
        elc-files  0
        modules    (:input chinese :completion company helm ivy :ui doom doom-dashboard doom-quit hl-todo indent-guides modeline nav-flash ophints (popup +all +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor file-templates fold rotate-text snippets :emacs dired electric ibuffer vc :term eshell :tools (eval +overlay) flycheck (lookup +docsets) lsp magit pass upload :lang cc common-lisp data emacs-lisp ess go (haskell +intero) julia latex markdown nix (org +dragndrop +hugo +ipython +pandoc +present) python scheme sh :app (rss +org) :config (default +smartparens) :private spacemacs-default my-org my-code)
        packages   (n/a)
        elpa       (n/a)

@hlissner
Copy link
Member

hlissner commented Nov 19, 2019

I can no longer reproduce the issue. @ztlevi Try doom build.

(use-package! 'ob-async)

Don't do this. It is unnecessary and loads all of org. ob-async will be automatically loaded if your src block has a non-nil :async property.

@ztlevi
Copy link
Contributor

ztlevi commented Nov 19, 2019

I still get the error.

error in process sentinel: async-handle-result: Cannot open load file: No such file or directory, org-version.el
error in process sentinel: Cannot open load file: No such file or directory, org-version.el

I am using org-wild-notifier. Can you please try this package and enable it M-x org-wild-notifier-mode

(package! org-wild-notifier)
(use-package! org-wild-notifier
  :defer t
  :init
  (add-hook 'doom-post-init-hook #'org-wild-notifier-mode t)
  :config
  (setq org-wild-notifier-alert-time 15
        alert-default-style (if IS-MAC 'osx-notifier 'libnotify)))

@hlissner
Copy link
Member

@ztlevi

  1. Added (package! org-wild-notifier) to ~/.doom.d/packages.el

  2. Added your use-package! block to ~/.doom.d/config.el

  3. doom refresh

  4. Restart Emacs

  5. Opened an org file and executed

    #+BEGIN_SRC sh :async t
    sleep 2
    echo 25
    #+END_SRC
    

Ran without issue. Ran it multiple times, even.

Currently on 24efd5b with Emacs 26.3.

@hlissner
Copy link
Member

Side-note: doom-post-init-hook doesn't exist anymore. It was replaced with doom-after-init-modules-hook some time ago, so org-wild-notifier isn't even loading.

@ztlevi
Copy link
Contributor

ztlevi commented Nov 19, 2019

What about you trigger it manually? Did you get the error?

@GTrunSec
Copy link
Contributor Author

Side-note: doom-post-init-hook doesn't exist anymore. It was replaced with doom-after-init-modules-hook some time ago, so org-wild-notifier isn't even loading.

this issue not about org-babel-async. I tried to download the org-wild-notifier. also got the same error report.

@hlissner
Copy link
Member

hlissner commented Nov 19, 2019

Agh. I see it. It's the way org-wild-notifier scrapes your org agenda files. It uses async much like ob-async does, except unlike ob-async, it doesn't provide us a way to inject Doom's state before it runs.

This is non-trivial to fix from Doom's side. I suggest using org-alert instead (or org-notify, included with org-plus-contrib).

@ztlevi
Copy link
Contributor

ztlevi commented Nov 19, 2019

Emm, org-alert doesn't really work. While org-notify does pop notification but it repeats the notification every two minutes which is very annoying.

Is this possible to fix it from org-wild-notifier-mode? If so, I would like to open a issue

hlissner added a commit that referenced this issue Nov 20, 2019
We generate an org-version.el file, rendering our old org-release hacks
unnecessary. This may cause breakages for uses who do deep clones of
org-plus-contrib; needs testing.
@hlissner
Copy link
Member

hlissner commented Nov 20, 2019

As of 30f72da I've employed a new solution to this and the ob-async problem, which should resolve your issue with org-wild-notifier-mode. Let me know if that isn't the case.

(You'll need to doom build after doom upgrade for this to fully work, unless the org package gets updated)

@ztlevi
Copy link
Contributor

ztlevi commented Nov 20, 2019

Nice! It works! 💯

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
is:bug Something isn't working as intended module:lang/org Pertains to Doom's :lang org module status:resolved Issue was addressed internally
Projects
None yet
Development

No branches or pull requests

3 participants