Refactor 'eat--eshell-adjust-make-process-args'

* eat.el (eat--eshell-adjust-make-process-args): Move the
'add-hook' out of 'unwind-protect'.
This commit is contained in:
Akib Azmain Turja 2022-12-15 13:00:06 +06:00
parent 162ec61f3d
commit 559c9c362c
No known key found for this signature in database
GPG key ID: 5535FCF54D88616B

13
eat.el
View file

@ -5543,9 +5543,8 @@ Disable terminal emulation?")))
(set-process-filter proc #'eat--eshell-filter) (set-process-filter proc #'eat--eshell-filter)
(set-process-sentinel proc #'eat--eshell-sentinel) (set-process-sentinel proc #'eat--eshell-sentinel)
(eat--eshell-setup-proc-and-term proc)))) (eat--eshell-setup-proc-and-term proc))))
(unwind-protect
(progn
(add-hook 'eshell-exec-hook hook 99) (add-hook 'eshell-exec-hook hook 99)
(unwind-protect
(cond (cond
;; Emacs 29 and above. ;; Emacs 29 and above.
((>= emacs-major-version 29) ((>= emacs-major-version 29)
@ -5562,8 +5561,8 @@ Disable terminal emulation?")))
(apply make-process plist) (apply make-process plist)
(setf (plist-get plist :command) (setf (plist-get plist :command)
`("/usr/bin/env" "sh" "-c" `("/usr/bin/env" "sh" "-c"
,(format "stty -nl echo rows %d \ ,(format "stty -nl echo rows %d columns\
columns %d sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\"" %d sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
(floor (window-screen-lines)) (floor (window-screen-lines))
(window-max-chars-per-line) (window-max-chars-per-line)
null-device) null-device)
@ -5579,13 +5578,13 @@ columns %d sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
(lambda (name buffer &rest command) (lambda (name buffer &rest command)
(apply start-file-process name buffer (apply start-file-process name buffer
"/usr/bin/env" "sh" "-c" "/usr/bin/env" "sh" "-c"
(format "stty -nl echo rows %d columns \ (format "stty -nl echo rows %d columns %d \
%d sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\"" sane 2>%s ; if [ $1 = .. ]; then shift; fi; exec \"$@\""
(floor (window-screen-lines)) (floor (window-screen-lines))
(window-max-chars-per-line) (window-max-chars-per-line)
null-device) null-device)
".." command)))) ".." command))))
(funcall fn command args))))) (funcall fn command args))))
(remove-hook 'eshell-exec-hook hook))))) (remove-hook 'eshell-exec-hook hook)))))