johnbcoughlin / calctex

GNU General Public License v3.0
130 stars 1 forks source link

Emacs application freezes when I enable calctex while calc buffer is active #36

Open zergpanda65 opened 4 years ago

zergpanda65 commented 4 years ago

I am using macOS, emacs-plus27.1, doom emacs

PrimaryCanary commented 4 years ago

I can confirm. I testing on Ubuntu withemacs -Q -l path/to/calctex.el.

Steps to reproduce:

  1. Open an org-mode file with LaTeX formula environments.
  2. Start calc and leave the buffer open.
  3. Put the point inside a formula environment.
  4. Start CalcTex.
  5. Switch to the calc buffer.

Emacs will then freeze. I would provide more debugging info but alas, I am not wise in the ways of Emacs.

tecosaur commented 3 years ago

I suspect what you're seeing is due to this nonsense https://github.com/johnbcoughlin/calctex/blob/7fa2673c64e259e04aef684ccf09ef85570c388b/calctex/calctex.el#L92-L94

This caused me issues for a while, but I finally got around to fixing it. See the last part of https://tecosaur.github.io/emacs-config/config.html#calc, perhaps it may be of some help.

tecosaur commented 3 years ago

@johnbcoughlin It's great to see that you are spending some more time on this package :grinning:. Feel free to grab what I've done in https://tecosaur.github.io/emacs-config/config.html#calctex,code--2 if it's of some help. You should be able to implement a fix with a very minor modification to the following if you haven't got one already:

  ;; Fix hardcoded dvichop path (whyyyyyyy)
  (let ((vendor-folder (concat (file-truename doom-local-dir)
                               "straight/"
                               (format "build-%s" emacs-version)
                               "/calctex/vendor/")))
    (setq calctex-dvichop-sty (concat vendor-folder "texd/dvichop")
          calctex-dvichop-bin (concat vendor-folder "texd/dvichop")))
  (unless (file-exists-p calctex-dvichop-bin)
    (message "CalcTeX: Building dvichop binary")
    (let ((default-directory (file-name-directory calctex-dvichop-bin)))
      (call-process "make" nil nil nil))