karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.04k stars 111 forks source link

Recursive require on emacs 29 #239

Closed avishefi closed 3 months ago

avishefi commented 3 months ago

Getting eval-buffer: Recursive load: between gptel.elc and gptel-gemini.el

When byte compiling gptel-gemini.el:

Compiling file <REDACTED>/.emacs.d/elpa/gptel-20240308.224/gptel-gemini.el at Fri Mar  8 13:47:58 2024
Entering directory ‘<REDACTED>/.emacs.d/elpa/gptel-20240308.224/’
gptel-gemini.el:25:2: Error: Recursive ‘require’ for feature ‘gptel’

Performed a clean reinstall by deleting the gptel directory and reinstalling the package. While gptel functions correctly immediately after installation, a recursive require error is encountered upon restarting Emacs. This error renders gptel unusable after the initial session.

karthink commented 3 months ago

Not sure what could be causing this.

Can you share your config for gptel?

On Fri, Mar 8, 2024, 4:02 AM Avi Shefi @.***> wrote:

Getting eval-buffer: Recursive load: between gptel.elc and gptel-gemini.el

When byte compiling gptel-gemine.el:

Compiling file /.emacs.d/elpa/gptel-20240308.224/gptel-gemini.el at Fri Mar 8 13:47:58 2024 Entering directory ‘/.emacs.d/elpa/gptel-20240308.224/’ gptel-gemini.el:25:2: Error: Recursive ‘require’ for feature ‘gptel’

Performed a clean reinstall by deleting the gptel directory and reinstalling the package. While gptel functions correctly immediately after installation, a recursive require error is encountered upon restarting Emacs. This error renders gptel unusable after the initial session.

— Reply to this email directly, view it on GitHub https://github.com/karthink/gptel/issues/239, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBVOLC3SKWA4XZCWFMOSSTYXGSHDAVCNFSM6AAAAABEMWJAI6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGE3TKOJQGQZTSOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

avishefi commented 3 months ago

I had this:

(use-package gptel
  :defer t
  :commands (gptel gptel-menu gptel-send gptel-request)
  :bind (:map gptel-mode-map
              ("C-c C-<return>" . gptel-send))
  :custom
  (gptel-backend (gptel-make-gemini "Gemini"
                   :key #'gptel-api-key
                   :stream t))
  (gptel-model "gemini-pro")
  (gptel-log-level "debug"))

Commenting out (gptel-backend ... resolves the issue, so I moved it from use-package's :custom to :config and now the error is gone.

This is how it works now:


(use-package gptel
  :defer t
  :commands (gptel gptel-menu gptel-send gptel-request)
  :bind (:map gptel-mode-map
              ("C-c C-<return>" . gptel-send))
  :custom
  (gptel-model "gemini-pro")
  (gptel-log-level "debug") ;; nil, info, debug
  :config
  (setq gptel-backend (gptel-make-gemini "Gemini"
                        :key #'gptel-api-key
                        :stream t)))