(Answering my own question) ... I realized that eshellat the core is just an emacs buffer. So, keeping that in mind, I came up with this method that works, but maybe do better. Perhaps there is something about this that I still do not suspect, so I am still open to suggestions.
(defun eshell-send-input-zAp (&optional use-region queue-p no-newline)
"A customized `eshell-send-input`, to add bm-bookmark to prompt line"
(interactive)
(let ((line (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
(if (string-match eshell-prompt-regexp line)
(if (> (length (substring line (match-end 0))) 0)
(bm-bookmark-add))))
(eshell-send-input use-region queue-p no-newline))
source
share