emacs-openai / chatgpt

Use ChatGPT inside Emacs
GNU General Public License v3.0
195 stars 21 forks source link

makes git version of emacs freez #6

Closed mrfluffy-dev closed 1 year ago

mrfluffy-dev commented 1 year ago

Emacs Version:GNU Emacs 30.0.50 Doom emacs OS: Arch Linux

packages.el

(package! openai
  :recipe (:host github :repo "emacs-openai/openai" :files ("*.el")))
(package! chatgpt
  :recipe (:host github :repo "emacs-openai/chatgpt" :files ("*.el")))

config.el

(setq openai-key (getenv "OPENAIKEY"))
(setq chatgpt-input-method 'minibuffer)

I wish I had more info on what the problem is but all I know is when I am on Emacs 30.0.50 my entire amacs locks op and doesn't load when I use this package I cant check logs coz emacs is frozen. The package works just fine on Emacs 28.2-2 I would be happy to give any more info.

jcs090218 commented 1 year ago

Can you elaborate when or what make Emacs frozen? Does it crash on startup? On load time? After (require ...? etc.

Since I don't have your environment, I would need you to do some tests.

  1. Check upstream. Can you require these packages one by one? My best guess is requiring openai.

https://github.com/emacs-openai/chatgpt/blob/d5e773de2b31a1227d8e1a8946c99e8691bcf375/chatgpt.el#L34-L42

  1. Try to print something. Before your Emacs got frozen, you should able to print at the very beginning of the operation. For example,
(require 'chatgpt)  ; load it for overwrite, this line assumed no upstream error (Pt. 1)

then M-x eval-region the following, (an example what you can do to get more information)

;;;###autoload
(defun chatgpt ()
  "Start ChatGPT with existing instance, else create a new instance."
  (interactive)
+  (message "Test 1")
  (let ((live-instances  (chatgpt--live-instances))
        (shown-instances (chatgpt--shown-instances)))
+    (message "Test 2")  ; if this doesn't get print, something wrong before this
    (cond (shown-instances
           (chatgpt--pop-to-buffer (nth 0 shown-instances)))
          (live-instances
           (chatgpt--pop-to-buffer (nth 0 live-instances)))
          (t
           (chatgpt-new)))))

Edit: You can comment it out when something goes terribly wrong to see what's not working.

mrfluffy-dev commented 1 year ago

Its hard to explain. when I open Emacs (non daemon) I would want to see the my Doom buffer but I see nothing just white. I can do M-x and the menu pops up but selecting anything or closing it makes Emacs unresponsive again ill remove

(package! chatgpt
  :recipe (:host github :repo "emacs-openai/chatgpt" :files ("*.el")))

but keep openAI if it still crashes I know which of the 2 causes the problem. if it doesn't crash Ill do the (require '*) one by one in my open el file and tell you the results.

mrfluffy-dev commented 1 year ago

Update yeah if I remove

(package! chatgpt
  :recipe (:host github :repo "emacs-openai/chatgpt" :files ("*.el")))

Im all good I can interact with M-x openai-chat-say directly ill now make am .el file and request all the stuff one by one to see what makes it unhappy.

mrfluffy-dev commented 1 year ago

Ok I think I got the problem its cl-lib everything else doesn't make it crash and running emacs --daemon does give some logs I can work with and that is Package cl is deprecated don't know how hard it will be not to rely on cl but It would probably be a good idea to see if you can make this work without it. seeing as emacs has dropped it.

mrfluffy-dev commented 1 year ago

hmmmm no I see it is meant to be cl-lib I am confused won't lie.

mrfluffy-dev commented 1 year ago

Ok I found the problem this time it doesn't seem to be you at all I suspect the GNU boys messed something up with the latest pull went back to 30.0.50 from back 2023-03-19 and it works just fine. so somewhere between the 19th and today they fucked up something. But thanks for the help.

jcs090218 commented 1 year ago

No worries! I was suspecting myself using any cl functions. Happy you find the solution yourself! :D

Since this issue is due to upstream, therefore closing it.