@@ -778,14 +778,14 @@ Only returns buffers that belong to the current workspace."
778778(defun enkan-repl--can-send-text (&optional directory )
779779 " Check if text can actually be sent to eat session (strict check).
780780If DIRECTORY is provided, check for eat session in that directory.
781- Otherwise, use current `default-directory' ."
781+ Otherwise, use current `default-directory' .
782+ Falls back to `get-buffer-process' when `eat--process' is unbound or nil."
782783 (let ((session-buffer (enkan-repl--get-buffer-for-directory directory)))
783784 (when session-buffer
784785 (with-current-buffer session-buffer
785- (and
786- (boundp 'eat--process )
787- eat--process
788- (process-live-p eat--process))))))
786+ (let ((proc (or (and (boundp 'eat--process ) eat--process)
787+ (get-buffer-process session-buffer))))
788+ (and proc (process-live-p proc)))))))
789789
790790; ;;; Public API - Send Functions
791791
@@ -1673,19 +1673,20 @@ Resolution priority: `prefix-arg' → alias → nil (for interactive selection).
16731673 " Side-effect function to execute send action to BUFFER.
16741674BUFFER: target buffer with eat process
16751675SEND-DATA: plist from enkan-repl--send-primitive
1676- Returns t on success, nil on failure."
1676+ Returns t on success, nil on failure.
1677+ Falls back to `get-buffer-process' when `eat--process' is unbound or nil."
16771678 (when (and buffer (buffer-live-p buffer))
16781679 (with-current-buffer buffer
1679- (when ( and (boundp 'eat--process )
1680- eat- -process
1681- (process-live-p eat--process ))
1682- (let ((content (plist-get send-data :content )))
1683- (when content
1684- (eat--send-string eat--process content)
1685- ; ; For text content, also send carriage return
1686- (when (eq (plist-get send-data :action ) 'text )
1687- (eat--send-string eat--process " \r " ))
1688- t ))))))
1680+ (let ((proc ( or ( and (boundp 'eat--process ) eat--process)
1681+ ( get-buffer -process buffer))))
1682+ ( when ( and proc (process-live-p proc ))
1683+ (let ((content (plist-get send-data :content )))
1684+ (when content
1685+ (eat--send-string proc content)
1686+ ; ; For text content, also send carriage return
1687+ (when (eq (plist-get send-data :action ) 'text )
1688+ (eat--send-string proc " \r " ))
1689+ t ) ))))))
16891690
16901691(defun enkan-repl--send-unified (text &optional pfx special-key-type )
16911692 " Unified backend for all send commands.
@@ -1805,16 +1806,19 @@ Returns plist with :valid, :number, :message."
18051806
18061807(defun enkan-repl--send-text-to-buffer (text buffer )
18071808 " Center file specific function to send TEXT to BUFFER.
1808- Sends text followed by carriage return, with cursor positioning."
1809+ Sends text followed by carriage return, with cursor positioning.
1810+ Falls back to `get-buffer-process' when `eat--process' is unbound or nil."
18091811 (when (and (bufferp buffer)
18101812 (buffer-live-p buffer)
18111813 (with-current-buffer buffer
1812- (and (boundp 'eat--process )
1813- eat- -process
1814- (process-live-p eat--process ))))
1814+ (let ((proc ( or ( and (boundp 'eat--process ) eat--process)
1815+ ( get-buffer -process buffer))))
1816+ ( and proc (process-live-p proc) ))))
18151817 (with-current-buffer buffer
1816- (eat--send-string eat--process text)
1817- (eat--send-string eat--process " \r " )
1818+ (let ((proc (or (and (boundp 'eat--process ) eat--process)
1819+ (get-buffer-process buffer))))
1820+ (eat--send-string proc text)
1821+ (eat--send-string proc " \r " ))
18181822 ; ; Move cursor to bottom after eat processes the output
18191823 (run-at-time 0.01 nil
18201824 (lambda (buf )
0 commit comments