diff options
Diffstat (limited to 'lib/eos')
-rw-r--r-- | lib/eos/jao-afio.el | 4 | ||||
-rw-r--r-- | lib/eos/jao-dirmon.el | 11 | ||||
-rw-r--r-- | lib/eos/jao-minibuffer.el | 6 |
3 files changed, 13 insertions, 8 deletions
diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index b588989..10e9115 100644 --- a/lib/eos/jao-afio.el +++ b/lib/eos/jao-afio.el @@ -1,6 +1,6 @@ ;;; jao-afio.el --- workspaces in just one frame -*- lexical-binding: t; -*- -;; Copyright (C) 2020, 2021, 2022, 2024 jao +;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao ;; Author: jao <mail@jao.io> ;; Keywords: frames @@ -228,7 +228,7 @@ (defun jao-afio-goto-scratch (&optional one-win) (interactive "P") - (jao-afio--goto-frame ?s nil) + (jao-afio--goto-frame ?s one-win) (when one-win (delete-other-windows))) (defun jao-afio-goto-chats (&optional reset) diff --git a/lib/eos/jao-dirmon.el b/lib/eos/jao-dirmon.el index 9d748d1..117da85 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, 2025 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) @@ -66,7 +71,7 @@ (dolist (c current) (let ((d (- (cdr c) (alist-get (car c) old 0 nil #'string=)))) (when (> (abs d) jao-dirmon-threshold) - (push c high)))) + (push (cons (car c) d) high)))) (setq jao-dirmon-last-delta high) (jao-dirmon--show-deltas old current jao-dirmon-last-delta) jao-dirmon-last-delta)) diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el index 77bd49a..6cd5b24 100644 --- a/lib/eos/jao-minibuffer.el +++ b/lib/eos/jao-minibuffer.el @@ -1,6 +1,6 @@ ;;; jao-minibuffer.el --- using the minibuffer to report status -*- lexical-binding: t; -*- -;; Copyright (C) 2020, 2021, 2022, 2024 jao +;; Copyright (C) 2020, 2021, 2022, 2024, 2025 jao ;; Author: jao <mail@jao.io> ;; Keywords: extensions @@ -40,7 +40,7 @@ (defun jao-minibuffer--trim (s w) (if (< (string-width (or s "")) w) (format (format "%%%ds" (if jao-minibuffer-align-right w (- w))) s) - (substring s 0 w))) + (substring s 0 (min w (string-width s))))) (defun jao-minibuffer--width () (cond ((numberp jao-minibuffer-frame-width) jao-minibuffer-frame-width) @@ -97,7 +97,7 @@ info)) (sep (if msg " - " "")) (pref (when info - (let ((len (+ (length info) (length sep)))) + (let ((len (+ (string-width info) (string-width sep)))) (format (format "\n%%%ds" len) "")))) (msg (if (and msg pref) (replace-regexp-in-string "\n" pref msg) |