Fork me on GitHub
#emacs
<
2022-03-16
>
jmckitrick14:03:23

I went through a recent guide on setting up emacs to display emojis on my mac. In a clojure file I’m working on, I can paste in an emoji w/o issues. However, there are other characters (`\uD83D` , etc) that should be emojis but are rending as raw codes. Is there a simple fix? I tried changing buffer file encoding to UTF-16 but that doesn’t seem to help.

paulspencerwilliams14:03:12

So, this morning, I’ve been trying and failing to understand why I can’t perform http requests from org-mode on Clojure apps that are being debugged with Cider. If the apps are simply run from a Cider repl, these kind of http requests work okay:

#+begin_src shell :results raw 
curl -X GET -k --header 'Accept: application/json' --header "authorization: Bearer ${token}" ''
#+end_src
But if I cider-debug-defun-at-point on the endpoint handler and execute the above org mode src block, it hangs with

magnars14:03:29

I'm guessing that Emacs freezes while waiting for the curl to return, preventing the debugger from kicking in.

dpsutton14:03:37

that sounds like a good theory. un-instrument the function, add a (Thread/sleep 15000) and see if you can interact with emacs while the request takes 15 seconds.

paulspencerwilliams14:03:36

Trying, cheers guys!

paulspencerwilliams14:03:19

Yeah, Emacs freezes for 15 seconds..

paulspencerwilliams14:03:01

I wonder if I can make the org mode block async…

dpsutton14:03:51

:results raw means it will put the result of the computation into the block right? If you drop that does it still freeze emacs? Maybe if it doesn’t have to wait on results it is a bit more free?

magnars14:03:37

Emacs was single threaded for 30 years, so that's still the default pretty much everywhere. There might be some hoops you can jump through to mend that.

paulspencerwilliams14:03:28

I’m currently trying https://github.com/astahlman/ob-async but will try removing the :results header afterwards!

paulspencerwilliams14:03:45

Neither that package with :async or removing the :results header improved matters.

paulspencerwilliams14:03:19

Saying that, that package’s readme shows specifically sh babel scripts showing the benefits. Maybe my install didn’t work correctly.

paulspencerwilliams14:03:09

RTFM @U064B4L0K!!!! I’d installed but forgotten to require it. Works a treat with

#+begin_src shell :results raw :async
both with 15 second sleep and debugging! Cheers!

🎉 2
paulspencerwilliams14:03:45

If I execute pkill -SIGUSR2 Emacs , Emacs comes back to life with

Debugger entered--entering a function:
* symbol-overlay-refresh(1 5 0)
  call-process("/bin/zsh" "/var/folders/6t/jjj6xvtx39v9m8fvvcqsgj940000gn/T/b..." (t "/var/folders/6t/jjj6xvtx39v9m8fvvcqsgj940000gn/T/e...") nil "-c" "/bin/zsh")
  apply(call-process "/bin/zsh" "/var/folders/6t/jjj6xvtx39v9m8fvvcqsgj940000gn/T/b..." (t "/var/folders/6t/jjj6xvtx39v9m8fvvcqsgj940000gn/T/e...") nil ("-c" "/bin/zsh"))
  process-file("/bin/zsh" "/var/folders/6t/jjj6xvtx39v9m8fvvcqsgj940000gn/T/b..." (t "/var/folders/6t/jjj6xvtx39v9m8fvvcqsgj940000gn/T/b...") nil "-c" "/bin/zsh")
  org-babel--shell-command-on-region("/bin/zsh" #<buffer  *Org-Babel Error*>)
  org-babel-eval("/bin/zsh" "token=$(curl -X GET -k --header 'Accept: applicati...")
  org-babel-sh-evaluate(nil "token=$(curl -X GET -k --header 'Accept: applicati..." ((:colname-names) (:rowname-names) (:result-params "replace" "raw") (:result-type . value) (:results . "replace raw") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")) nil nil)
  org-babel-execute:shell("token=$(curl -X GET -k --header 'Accept: applicati..." ((:colname-names) (:rowname-names) (:result-params "replace" "raw") (:result-type . value) (:results . "replace raw") (:exports . "code") (:session . "none") (:cache . "no") (:noweb . "no") (:hlines . "no") (:tangle . "no")))
  org-babel-execute-src-block(nil ("shell" "token=$(curl -X GET -k --header 'Accept: applicati..." ((:colname-names) (:rowname-names) (:result-params "raw" "replace") (:result-type . value) (:results . "raw replace") (:exports . "code") (:tangle . "no") (:hlines . "no") (:noweb . "no") (:cache . "no") (:session . "none")) "" nil 357 "(ref:%s)"))
  org-ctrl-c-ctrl-c(nil)
  funcall-interactively(org-ctrl-c-ctrl-c nil)
  call-interactively(org-ctrl-c-ctrl-c nil nil)
  command-execute(org-ctrl-c-ctrl-c)