diff --git a/.emacs.d/lisp/init-shell.el b/.emacs.d/lisp/init-shell.el index 33c2d5f6..48835e8f 100644 --- a/.emacs.d/lisp/init-shell.el +++ b/.emacs.d/lisp/init-shell.el @@ -43,8 +43,11 @@ prefix arg shell buffer doesn't exists, create it and switch to it." (defun ambrevar/shell-setup () (set (make-variable-buffer-local 'comint-input-history-ignore) (regexp-opt '("^#" "^ " "^cd "))) + ;; Only ending with '#' or '$' but seems slower: + ;; (setq comint-prompt-regexp "^[^#$]* +;; [^#$]*[#$>] +") (setq comint-prompt-regexp "^[^#$%>]* -[^#$%>]*[#$%>] *")) +[^#$%>]*[#$%>] +")) (add-hook 'shell-mode-hook 'ambrevar/shell-setup) @@ -109,7 +112,8 @@ In normal circumstances this input is additionally filtered by (ambrevar/shell-prompt-begin-position) 'help-echo)))) (end (parse-time-string (save-excursion - (call-interactively 'comint-next-prompt) + (goto-char (ambrevar/shell-prompt-end-position)) + (call-interactively #'comint-next-prompt) (ambrevar/shell-prompt))))) (if begin (message "Command took %.0f seconds."