Subject: Fix for bug#43772

From: Ruthra Kumar <[email-masked]>
Date: Sun, 15 Nov 2020 19:43:14 +0530

Hello Lars,

As you've mentioned, parsing ( and prompting ) is not done, when
command is sent directly to shell. But, i think
'eshell-invoke-directly' should not have returned true for sudo and
su. Comment section in 'eshell-find-alias-function' best describes it,

(defun eshell-find-alias-function (name)
 ...
    ;; If the function exists, but is defined in an eshell module
    ;; that's not currently enabled, don't report it as found.

eshell-tramp is disabled by default. So, eshell-invoke-directly should
return nil for su and sudo ( I'm new to eshell as well. So, I might be
wrong here ). Replacing fboundp with 'eshell-find-alias-function'
should fix this. So far, I've tested locally and it is working fine.

Patch attached.

Regards
Ruthra Kumar
From fa4b5f71f8d0f4ea43ab9cade8b6a721dc21d604 Mon Sep 17 00:00:00 2001
From: Ruthra Kumar <[email-masked]>
Date: Sun, 15 Nov 2020 16:31:05 +0530
Subject: [PATCH] (eshell-invoke-directly) - use 'eshell-find-alias-function'
 instead of fboundp

---
 lisp/eshell/esh-cmd.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index e0348ba501..e54caf46fc 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -920,7 +920,7 @@ eshell-invoke-directly
 		       (funcall pred name))
 		  (throw 'simple nil)))
 	    t))
-	 (fboundp (intern-soft (concat "eshell/" name))))))
+	 (eshell-find-alias-function name))))
 
 (defun eshell-eval-command (command &optional input)
   "Evaluate the given COMMAND iteratively."
-- 
2.28.0