Skip to content

Commit

Permalink
Automatically add last eshell command to compose buffer for #222
Browse files Browse the repository at this point in the history
  • Loading branch information
xenodium committed Aug 5, 2024
1 parent 7003d9f commit 4263fb2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions chatgpt-shell.el
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

;; Author: Alvaro Ramirez https://xenodium.com
;; URL: https://github.com/xenodium/chatgpt-shell
;; Version: 1.1.4
;; Version: 1.1.5
;; Package-Requires: ((emacs "27.1") (shell-maker "0.50.5"))

;; This package is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -111,7 +111,7 @@
:group 'chatgpt-shell)

(defcustom chatgpt-shell-prompt-header-whats-wrong-with-last-command
"What's wrong with this command?"
"What's wrong with this command execution?"
"Prompt header of `whats-wrong-with-last-command`."
:type 'string
:group 'chatgpt-shell)
Expand Down Expand Up @@ -1289,8 +1289,7 @@ With prefix REVIEW prompt before sending to ChatGPT."
(forward-line 1)
(re-search-forward eshell-prompt-regexp nil t)
(forward-line -1)
(concat "What's wrong with this command?\n\n"
(buffer-substring-no-properties cmd-start cmd-end)))
(buffer-substring-no-properties cmd-start cmd-end))
(message "Current buffer is not an eshell buffer."))))

;; Based on https://emacs.stackexchange.com/a/48215
Expand Down Expand Up @@ -2636,6 +2635,8 @@ Set TRANSIENT-FRAME-P to also close frame on exit."
(region-end))))
(deactivate-mark)
region)
(when (eq major-mode 'eshell-mode)
(chatgpt-shell--eshell-last-last-command))
(when-let* ((diagnostic (flymake-diagnostics (point)))
(line-start (line-beginning-position))
(line-end (line-end-position))
Expand Down

0 comments on commit 4263fb2

Please sign in to comment.