summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-08-10 11:38:56 +0800
committerJSDurand <mmemmew@gmail.com>2021-08-10 11:38:56 +0800
commitc7ddcfb446b45f3ae9bc1919eb351139c1734086 (patch)
tree1a53d78f053503ab70f466a90255e278a9d8c66b
parent6a63c63e877bebeed11b6a048c675cc503f2f5f8 (diff)
change: eshell-clear
* eshell-conf.el (eshell-clear): Now it accepts a numeric argument. This will now preserve NUM many prompts.
-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)