shell: Fix ambrevar/shell-command-duration.

master
Pierre Neidhardt 2020-06-10 11:15:19 +02:00
parent 150bb1f80c
commit 86e145008f
1 changed files with 6 additions and 2 deletions

View File

@ -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."