File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -258,16 +258,18 @@ Display buffer from BUFFER-OR-NAME."
258258(defun chatgpt-restart ()
259259 " Restart session."
260260 (interactive )
261- (let* ((instance chatgpt-instances)
262- (index (car instance))
263- (old-name))
264- ; ; If buffer is alive, kill it!
265- (chatgpt-with-instance instance
266- (setq old-name (buffer-name ))
267- (kill-this-buffer ))
268- ; ; `old-name' will remain `nil' if buffer is not killed or invalid!
269- (when old-name
270- (chatgpt-register-instance index old-name))))
261+ (when (eq major-mode #'chatgpt-mode )
262+ (let* ((instance chatgpt-instance)
263+ (index (car instance))
264+ (old-name))
265+ ; ; If buffer is alive, kill it!
266+ (chatgpt-with-instance instance
267+ (setq old-name (buffer-name ))
268+ (kill-this-buffer ))
269+ ; ; `old-name' will remain `nil' if buffer is not killed or invalid!
270+ (when old-name
271+ (chatgpt-register-instance index old-name)
272+ (switch-to-buffer old-name)))))
271273
272274; ;
273275; ;; Core
You can’t perform that action at this time.
0 commit comments