summaryrefslogtreecommitdiffhomepage
path: root/lib/eos/jao-dirmon.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2024-12-01 05:19:17 +0000
committerjao <jao@gnu.org>2024-12-01 05:19:17 +0000
commitc84eda285049c8878edeeb41b752f99f3eb75b14 (patch)
treec0af11aa4525853dd18ce39e033bbf148d59e7fa /lib/eos/jao-dirmon.el
parented457a9d22991727eae7e488a016c315131d115f (diff)
downloadelibs-c84eda285049c8878edeeb41b752f99f3eb75b14.tar.gz
elibs-c84eda285049c8878edeeb41b752f99f3eb75b14.tar.bz2
jao-dirmon: non-temp results buffer
Diffstat (limited to 'lib/eos/jao-dirmon.el')
-rw-r--r--lib/eos/jao-dirmon.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/eos/jao-dirmon.el b/lib/eos/jao-dirmon.el
index 9d748d1..0edb3a3 100644
--- a/lib/eos/jao-dirmon.el
+++ b/lib/eos/jao-dirmon.el
@@ -1,6 +1,6 @@
;;; jao-dirmon.el --- little utility to monitor disk usage -*- lexical-binding: t; -*-
-;; Copyright (C) 2022 jao
+;; Copyright (C) 2022, 2024 jao
;; Author: jao <mail@jao.io>
;; Keywords: tools
@@ -25,6 +25,7 @@
;;; Code:
(require 'multisession)
+(require 'view)
(require 'jao-shell)
(define-multisession-variable jao-dirmon-last '())
@@ -40,9 +41,12 @@
(defvar jao-dirmon-threshold 100)
(defvar jao-dirmon-last-delta nil)
+(defvar jao-dirmon-buffer "*jao-dirmon")
(defun jao-dirmon--show-deltas (old current deltas)
- (with-temp-buffer
+ (with-current-buffer (get-buffer-create jao-dirmon-buffer)
+ (view-mode-disable)
+ (delete-region (point-min) (point-max))
(insert "High deltas since " (car old) "\n\n")
(dolist (d (seq-sort-by #'cdr #'> deltas))
(insert (format "- %s: %s Mb\n" (car d) (cdr d))))
@@ -52,6 +56,7 @@
(seq-sort-by #'cdr #'> current)))
(insert (format "- %s: %s Mb\n" (car c) (cdr c)))))
(beginning-of-buffer)
+ (view-mode-enable)
(pop-to-buffer (current-buffer) nil t)
(when (y-or-n-p "Save current state?")
(setf (multisession-value jao-dirmon-last)