summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eshell-conf.el16
1 files changed, 11 insertions, 5 deletions
diff --git a/eshell-conf.el b/eshell-conf.el
index 7386400..119ca96 100644
--- a/eshell-conf.el
+++ b/eshell-conf.el
@@ -160,12 +160,18 @@ browser instead."
((kill-new url)))))
;;;###autoload
-(defun eshell-clear ()
- (interactive)
+(defun eshell-clear (num)
+ "Deletes the buffer.
+Do NUM times `eshell-previous-prompt' before deleting."
+ (interactive
+ (list (cond ((null current-prefix-arg) 0)
+ ((prefix-numeric-value current-prefix-arg)))))
(let ((inhibit-read-only t))
- (delete-region eshell-last-output-end (point)))
- (eshell/clear t)
- (eshell-emit-prompt))
+ (delete-region
+ (point-min)
+ (save-excursion
+ (eshell-previous-prompt num)
+ (line-beginning-position)))))
;;;###autoload
(defun eshell/j (&rest args)