diff options
Diffstat (limited to 'lib/eos')
-rw-r--r-- | lib/eos/jao-afio.el | 8 | ||||
-rw-r--r-- | lib/eos/jao-dirmon.el | 11 | ||||
-rw-r--r-- | lib/eos/jao-eshell-here.el | 6 | ||||
-rw-r--r-- | lib/eos/jao-minibuffer.el | 10 | ||||
-rw-r--r-- | lib/eos/jao-tracking.el | 2 |
5 files changed, 21 insertions, 16 deletions
diff --git a/lib/eos/jao-afio.el b/lib/eos/jao-afio.el index a5d9b24..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 @@ -86,7 +86,7 @@ (if (car docs) (progn (switch-to-buffer (car docs)) (switch-to-buffer-other-window (or (cadr docs) (car docs)))) - (when-let* ((docs (jao-doc-session))) + (when-let (docs (jao-doc-session)) (when (y-or-n-p (format "Load saved session? (%d docs)" (length docs))) (jao-afio-open-pdf-session docs)))))) @@ -96,7 +96,7 @@ (declare-function jao-eww-session-load "jao-eww-session") (defun jao-afio--open-eww-session () - (if-let* ((b (jao-eww-session-eww-buffers))) + (if-let (b (jao-eww-session-eww-buffers)) (switch-to-buffer (car b)) (jao-eww-session-load))) @@ -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-eshell-here.el b/lib/eos/jao-eshell-here.el index ad7805f..54d58f0 100644 --- a/lib/eos/jao-eshell-here.el +++ b/lib/eos/jao-eshell-here.el @@ -1,6 +1,6 @@ ;;; jao-eshell-here.el --- Easy opening of eshell buffers -*- lexical-binding: t; -*- -;; Copyright (C) 2021, 2023, 2024 jao +;; Copyright (C) 2021, 2023 jao ;; Author: jao <mail@jao.io> ;; Keywords: eshell @@ -33,8 +33,8 @@ "Value to use for `display-buffer-alist' when displaying the eshell buffer.") (defun jao-eshell-here--find-window (b) - (when-let* ((w (seq-find (lambda (w) (eq (window-buffer w) b)) - (window-list)))) + (when-let (w (seq-find (lambda (w) (eq (window-buffer w) b)) + (window-list))) (select-window w))) (defun jao-eshell-here--frame-buffer (&optional b) diff --git a/lib/eos/jao-minibuffer.el b/lib/eos/jao-minibuffer.el index d2bc70a..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) @@ -69,12 +69,12 @@ (insert msg))) (defun jao-minibuffer--strip-prev (msg) - (if-let* ((n (text-property-any 0 (length msg) 'minibuffer-message t msg))) + (if-let ((n (text-property-any 0 (length msg) 'minibuffer-message t msg))) (string-trim (substring msg 0 n)) msg)) (defun jao-minibuffer--prefix (msgs) - (when-let* ((p (string-join (butlast msgs) "\n"))) + (when-let (p (string-join (butlast msgs) "\n")) (unless (string-blank-p p) (concat p "\n")))) (defun jao-minibuffer--format-msg (msg) @@ -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) diff --git a/lib/eos/jao-tracking.el b/lib/eos/jao-tracking.el index a1fff73..2af868c 100644 --- a/lib/eos/jao-tracking.el +++ b/lib/eos/jao-tracking.el @@ -105,7 +105,7 @@ `(:propertize ,(plist-get s :propertize) face (jao-tracking-minibuffer - ,@(when-let* ((f (plist-get s 'face))) + ,@(when-let ((f (plist-get s 'face))) (jao-tracking-set-log " * ") (list f)))) `(:propertize "|" face jao-tracking-minibuffer-sep))) |