diff --git a/doom/.config/doom/modules/completion/corfu/README.org b/doom/.config/doom/.back.modules/completion/corfu/README.org similarity index 100% rename from doom/.config/doom/modules/completion/corfu/README.org rename to doom/.config/doom/.back.modules/completion/corfu/README.org diff --git a/doom/.config/doom/modules/completion/corfu/config.el b/doom/.config/doom/.back.modules/completion/corfu/config.el similarity index 100% rename from doom/.config/doom/modules/completion/corfu/config.el rename to doom/.config/doom/.back.modules/completion/corfu/config.el diff --git a/doom/.config/doom/modules/completion/corfu/packages.el b/doom/.config/doom/.back.modules/completion/corfu/packages.el similarity index 100% rename from doom/.config/doom/modules/completion/corfu/packages.el rename to doom/.config/doom/.back.modules/completion/corfu/packages.el diff --git a/doom/.config/doom/modules/tools/lsp2/+eglot.el b/doom/.config/doom/.back.modules/tools/lsp2/+eglot.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/+eglot.el rename to doom/.config/doom/.back.modules/tools/lsp2/+eglot.el diff --git a/doom/.config/doom/modules/tools/lsp2/+lsp.el b/doom/.config/doom/.back.modules/tools/lsp2/+lsp.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/+lsp.el rename to doom/.config/doom/.back.modules/tools/lsp2/+lsp.el diff --git a/doom/.config/doom/modules/tools/lsp2/README.org b/doom/.config/doom/.back.modules/tools/lsp2/README.org similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/README.org rename to doom/.config/doom/.back.modules/tools/lsp2/README.org diff --git a/doom/.config/doom/modules/tools/lsp2/autoload/common.el b/doom/.config/doom/.back.modules/tools/lsp2/autoload/common.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/autoload/common.el rename to doom/.config/doom/.back.modules/tools/lsp2/autoload/common.el diff --git a/doom/.config/doom/modules/tools/lsp2/autoload/eglot.el b/doom/.config/doom/.back.modules/tools/lsp2/autoload/eglot.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/autoload/eglot.el rename to doom/.config/doom/.back.modules/tools/lsp2/autoload/eglot.el diff --git a/doom/.config/doom/modules/tools/lsp2/autoload/flycheck-eglot.el b/doom/.config/doom/.back.modules/tools/lsp2/autoload/flycheck-eglot.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/autoload/flycheck-eglot.el rename to doom/.config/doom/.back.modules/tools/lsp2/autoload/flycheck-eglot.el diff --git a/doom/.config/doom/modules/tools/lsp2/autoload/lsp-mode.el b/doom/.config/doom/.back.modules/tools/lsp2/autoload/lsp-mode.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/autoload/lsp-mode.el rename to doom/.config/doom/.back.modules/tools/lsp2/autoload/lsp-mode.el diff --git a/doom/.config/doom/modules/tools/lsp2/config.el b/doom/.config/doom/.back.modules/tools/lsp2/config.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/config.el rename to doom/.config/doom/.back.modules/tools/lsp2/config.el diff --git a/doom/.config/doom/modules/tools/lsp2/doctor.el b/doom/.config/doom/.back.modules/tools/lsp2/doctor.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/doctor.el rename to doom/.config/doom/.back.modules/tools/lsp2/doctor.el diff --git a/doom/.config/doom/modules/tools/lsp2/packages.el b/doom/.config/doom/.back.modules/tools/lsp2/packages.el similarity index 100% rename from doom/.config/doom/modules/tools/lsp2/packages.el rename to doom/.config/doom/.back.modules/tools/lsp2/packages.el diff --git a/doom/.config/doom/config.el b/doom/.config/doom/config.el index 6af1da9..9367a8e 100644 --- a/doom/.config/doom/config.el +++ b/doom/.config/doom/config.el @@ -63,12 +63,12 @@ (add-hook 'prog-mode-hook 'fci-mode) (custom-set-faces - '(org-level-1 ((t (:inherit outline-1 :height 1.4)))) - '(org-level-2 ((t (:inherit outline-2 :height 1.3)))) - '(org-level-3 ((t (:inherit outline-3 :height 1.2)))) - '(org-level-4 ((t (:inherit outline-4 :height 1.1)))) - '(org-level-5 ((t (:inherit outline-5 :height 1.0)))) -) + '(org-level-1 ((t (:inherit outline-1 :height 1.4)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.3)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.2)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.1)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.0))))) + ;; company mode delay 0 (setq company-idle-delay 0) @@ -88,6 +88,9 @@ ;; ;; +;; +(setq org-image-actual-width 300) + (setq fancy-splash-image (concat doom-user-dir "xenia.png")) (setq ess-r--no-company-meta t) @@ -96,7 +99,7 @@ (add-to-list 'default-frame-alist '(alpha-background . 90)) ; For all new frames henceforth -;undo fix + ;undo fix (setq undo-tree-enable-undo-in-region nil) (setq undo-limit 8000000000) @@ -146,17 +149,10 @@ :config (setq x86-lookup-pdf "~/.config/doom/asm-ref.pdf")) +(setq openai-key (getenv "OPENAIKEY")) +(setq chatgpt-input-method 'minibuffer) + -;; chatgpt stuff -(use-package! chatgpt - :defer t - :config - (unless (boundp 'python-interpreter) - (defvaralias 'python-interpreter 'python-shell-interpreter)) - (setq chatgpt-repo-path (expand-file-name "straight/repos/ChatGPT.el/" doom-local-dir)) - (set-popup-rule! (regexp-quote "*ChatGPT*") - :side 'bottom :size .5 :ttl nil :quit t :modeline nil) - :bind ("C-c q" . chatgpt-query)) ;;discord rich presence (require 'elcord) @@ -167,24 +163,24 @@ (elcord-mode 1)))) (defun elcord--disable-elcord-if-no-frames (f) - (declare (ignore f)) - (when (let ((frames (delete f (visible-frame-list)))) - (or (null frames) - (and (null (cdr frames)) - (eq (car frames) terminal-frame)))) - (elcord-mode -1) - (add-hook 'after-make-frame-functions 'elcord--enable-on-frame-created))) + (declare (ignore f)) + (when (let ((frames (delete f (visible-frame-list)))) + (or (null frames) + (and (null (cdr frames)) + (eq (car frames) terminal-frame)))) + (elcord-mode -1) + (add-hook 'after-make-frame-functions 'elcord--enable-on-frame-created))) - (defun elcord--enable-on-frame-created (f) - (declare (ignore f)) - (elcord-mode +1)) +(defun elcord--enable-on-frame-created (f) + (declare (ignore f)) + (elcord-mode +1)) - (defun my/elcord-mode-hook () - (if elcord-mode - (add-hook 'delete-frame-functions 'elcord--disable-elcord-if-no-frames) - (remove-hook 'delete-frame-functions 'elcord--disable-elcord-if-no-frames))) +(defun my/elcord-mode-hook () + (if elcord-mode + (add-hook 'delete-frame-functions 'elcord--disable-elcord-if-no-frames) + (remove-hook 'delete-frame-functions 'elcord--disable-elcord-if-no-frames))) - (add-hook 'elcord-mode-hook 'my/elcord-mode-hook) +(add-hook 'elcord-mode-hook 'my/elcord-mode-hook) (setq elcord-idle-message "Out doing your mom") diff --git a/doom/.config/doom/custom.el b/doom/.config/doom/custom.el index 91b79b0..5db6e44 100644 --- a/doom/.config/doom/custom.el +++ b/doom/.config/doom/custom.el @@ -3,8 +3,7 @@ ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(elfeed-feeds - '("https://www.reddit.com/r/hentai.rss" "https://www.reddit.com/r/AnimeFeets.rss" "https://www.reddit.com/r/thighdeology.rss" "https://www.reddit.com/r/UndressingHentai.rss" "https://www.reddit.com/r/hentaibondage.rss" "https://www.reddit.com/r/ElegantR34.rss" "https://www.reddit.com/r/AnimeGirlsAndThongs.rss" "https://www.reddit.com/r/AnimeGirls.rss")) + '(elfeed-feeds '("https://www.reddit.com/r/pcmasterrace/rss")) '(warning-suppress-log-types '((initialization))) '(warning-suppress-types '((initialization) (initialization)))) (custom-set-faces diff --git a/doom/.config/doom/init.el b/doom/.config/doom/init.el index e15e1e1..8b2c8b9 100644 --- a/doom/.config/doom/init.el +++ b/doom/.config/doom/init.el @@ -134,7 +134,7 @@ ;;fsharp ; ML stands for Microsoft's Language ;;fstar ; (dependent) types and (monadic) effects and Z3 ;;gdscript ; the language you waited for - ;;(go +lsp) ; the hipster dialect + (go +lsp) ; the hipster dialect (haskell +lsp) ; a language that's lazier than I am ;;hy ; readability of scheme w/ speed of python ;;idris ; a language you can depend on diff --git a/doom/.config/doom/lisp/chatgpt.el b/doom/.config/doom/lisp/chatgpt.el deleted file mode 100644 index 1460667..0000000 --- a/doom/.config/doom/lisp/chatgpt.el +++ /dev/null @@ -1,220 +0,0 @@ -;;; chatgpt.el --- Simple ChatGPT frontend for Emacs -*- lexical-binding: t -*- - -;; Copyright (C) Gavin Jaeger-Freeborn - -;; This package is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3, or (at your option) -;; any later version. - -;; This package is distributed in the hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. - -;; You should have received a copy of the GNU General Public License -;; along with GNU Emacs. If not, see . - -;; Author: Gavin Jaeger-Freeborn -;; Maintainer: Gavin Jaeger-Freeborn -;; Created: 2022 -;; Version: 0.34 -;; Package-Requires: ((emacs "28.1")) - -;;; Commentary: - -;; Basic commands to use the OpenAI API and use some of the power -;; ChatGPT provides within Emacs. - -;; Features include code explanation, attempted code completion, -;; replacing inline queries with the results and more. - -;;; Code: - -(require 'seq) -(eval-when-compile - (require 'cl-lib) - (require 'subr-x) - (require 'env) - (require 'json)) - -(defgroup chatgpt nil - "ChatGPT frontend." - :group 'convenience - :prefix "chatgpt-") - -(defcustom chatgpt-max-tokens 300 - "Upper limit on the number of tokens the API will return." - :type 'integer) - -(defvar chatgpt-buffer "*ChatGPT*" - "Title of the buffer used to store the results of an OpenAI API query.") - -(define-error 'chatgpt-error "An error related to the ChatGPT emacs package") - -(define-error 'chatgpt-parsing-error - "An error caused by a failure to parse an OpenAI API Response") - -(defmacro chatgpt-show-results-buffer-if-active () - "Show the results in other window if necessary." - `(if (and (not ;; visible - (get-buffer-window chatgpt-buffer)) - (called-interactively-p 'interactive)) - (lambda (&optional buf) (ignore buf) - (with-current-buffer buf - (view-mode t)) - (switch-to-buffer-other-window chatgpt-buffer)) - #'identity)) - -;;;###autoload -(defun chatgpt-prompt (prompt callback) - "Query OpenAI with PROMPT calling the CALLBACK function on the resulting buffer. -Returns buffer containing the text from this query" - (interactive (list (read-string "Prompt ChatGPT with: ") - (lambda (buf) (with-current-buffer buf - (view-mode t)) - (switch-to-buffer-other-window chatgpt-buffer)))) - (chatgpt--query-open-api prompt - (lambda (results) - (with-current-buffer (get-buffer-create chatgpt-buffer) - ;; Erase contents of buffer after receiving response - (read-only-mode -1) - (erase-buffer) - (insert results) - ;; Return the chatgpt output buffer for non interactive usage - (funcall callback (current-buffer)))))) - -;;;###autoload -(defun chatgpt-fix-region (BEG END) - "Takes a region BEG to END asks ChatGPT to explain whats wrong with it. -It then displays the answer in the `chatgpt-buffer'." - (interactive "r") - (let ((current-code (buffer-substring BEG END))) - (chatgpt-prompt (chatgpt--append-to-prompt - current-code - "Why doesn't this code work?") - (chatgpt-show-results-buffer-if-active)))) - -;;;###autoload -(defun chatgpt-explain-region (BEG END) - "Takes a region BEG to END asks ChatGPT what it does. -The answer in the displays in `chatgpt-buffer'." - (interactive "r") - (let ((current-code (buffer-substring BEG END))) - (chatgpt-prompt (chatgpt--append-to-prompt - current-code - "What does this code do?") - (chatgpt-show-results-buffer-if-active)))) - -;;;###autoload -(defun chatgpt-gen-tests-for-region (BEG END) - "Takes a region BEG to END asks ChatGPT to write a test for it. -It then displays the answer in the `chatgpt-buffer'." - (interactive "r") - (let ((current-code (buffer-substring BEG END))) - (chatgpt-prompt (chatgpt--append-to-prompt - current-code - "Write me a tests for this code") - (chatgpt-show-results-buffer-if-active)))) - -;; TODO currently just says what changed but doesn't wanna show the code it's self -;; (defun chatgpt-optimize-region (BEG END) -;; "Takes a region BEG to END asks ChatGPT to optimize it for speed. -;; It then displays the answer in the `chatgpt-buffer'." -;; (interactive "r") -;; (let ((current-code (buffer-substring BEG END))) -;; (chatgpt-prompt (chatgpt--append-to-prompt -;; current-code -;; "Refactor this code for speed and tell me what you changed and why it's faster") -;; (chatgpt-show-results-buffer-if-active)))) - -;;;###autoload -(defun chatgpt-refactor-region (BEG END) - "Takes a region BEG to END asks ChatGPT refactor it. -It then displays the answer in the `chatgpt-buffer'." - (interactive "r") - (let ((current-code (buffer-substring BEG END))) - (chatgpt-prompt (chatgpt--append-to-prompt - current-code - "Refactor this code and tell me what you changed") - (chatgpt-show-results-buffer-if-active)))) - -;;;###autoload -(defun chatgpt-prompt-region (BEG END) - "Prompt ChatGPT with the region BEG END. -It then displays the results in a separate buffer `chatgpt-buffer'." - (interactive "r") - (chatgpt-prompt (buffer-substring BEG END) - ;; Show the results if not already being viewed - (chatgpt-show-results-buffer-if-active))) - -;;;###autoload -(defun chatgpt-prompt-region-and-replace (BEG END) - "Replace region from BEG to END with the response from the ChatGPT API. - -The region is BEG and until END" - (interactive "r") - - (let ((og-buf (current-buffer))) - (chatgpt-prompt (buffer-substring BEG END) - (lambda (buf) - (save-excursion - (with-current-buffer og-buf - (delete-region BEG END) - (goto-char BEG) - (insert (with-current-buffer buf (buffer-string))))))))) -(defun chatgpt--append-to-prompt (prompt comment-str) - "Append the string COMMENT-STR extra information to a PROMPT as a comment." - (concat prompt - "\n" - comment-start - " " - comment-str)) - -(defun chatgpt--extract-text-from-query (query-result) - "Extract the resulting text from a given OpenAI response QUERY-RESULT." - (condition-case err - (thread-last query-result - (assoc-default 'choices) - seq-first - (assoc-default 'text) - string-trim) - (error - (signal 'chatgpt-parsing-error err)))) - -(defun chatgpt--parse-response (status callback) - "Ignoring STATUS and parse the response executing the CALLBACK function on the resulting string." - (ignore status) - ;; All this is ran inside the buffer containing the response - (goto-char 0) - (re-search-forward "^$") - (funcall callback (chatgpt--extract-text-from-query (json-read)))) - -(defun chatgpt--query-open-api (prompt callback) - "Send a string PROMPT to OpenAI API and pass the resulting buffer to CALLBACK. -The environment variable OPENAI_API_KEY is used as your API key - -You can register an account here -https://beta.openai.com/docs/introduction/key-concepts" - (let* ((api-key (getenv "OPENAI_API_KEY")) - (url-request-method (encode-coding-string "POST" 'us-ascii)) - (url-request-extra-headers `(("Content-Type" . "application/json") - ("Authorization" . ,(format "Bearer %s" api-key)))) - (url-request-data (json-encode - `(("model" . "text-davinci-003") - ("prompt" . ,prompt) - ("max_tokens" . ,chatgpt-max-tokens) - ("temperature" . 0))))) - (cl-assert (not (string= "" api-key)) - t - "Current contents of the environmental variable OPENAI_API_KEY -are '%s' which is not an appropriate OpenAI token please ensure -you have the correctly set the OPENAI_API_KEY variable" - api-key) - (url-retrieve - "https://api.openai.com/v1/completions" - 'chatgpt--parse-response - (list callback)))) - -(provide 'chatgpt) -;;; chatgpt.el ends here \ No newline at end of file diff --git a/doom/.config/doom/lisp/test.el b/doom/.config/doom/lisp/test.el new file mode 100644 index 0000000..e69de29 diff --git a/doom/.config/doom/packages.el b/doom/.config/doom/packages.el index 6a7935d..ec6005e 100644 --- a/doom/.config/doom/packages.el +++ b/doom/.config/doom/packages.el @@ -57,8 +57,10 @@ :recipe (:host github :repo "zerolfx/copilot.el" :files ("*.el" "dist"))) (package! highlight-indent-guides) (package! yuck-mode) +(package! openai + :recipe (:host github :repo "emacs-openai/openai" :files ("*.el"))) (package! chatgpt - :recipe (:host github :repo "joshcho/ChatGPT.el" :files ("dist" "*.el"))) + :recipe (:host github :repo "mrfluffy-dev/chatgpt" :files ("*.el"))) (package! nasm-mode :pin "65ca6546fc395711fac5b3b4299e76c2303d43a8") (package! haxor-mode :pin "6fa25a8e6b6a59481bc0354c2fe1e0ed53cbdc91")