From 86e145008f6eef42d62f616cc4c217e4bbbee175 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Wed, 10 Jun 2020 11:15:19 +0200 Subject: [PATCH] shell: Fix ambrevar/shell-command-duration. --- .emacs.d/lisp/init-shell.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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."