From 80abceb212b2acb420317232cb2c3d0ab69af13b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 27 May 2022 13:26:19 -0500 Subject: asdpofiuasdpfoiasjdpfoiajsdf --- lisp/+elfeed.el | 14 +++++++++----- lisp/+emacs.el | 2 +- lisp/+modeline.el | 9 +++++++++ lisp/+setup.el | 21 +++++++++++---------- lisp/+tab-bar.el | 13 ++++--------- lisp/acdw.el | 7 +++++++ 6 files changed, 41 insertions(+), 25 deletions(-) (limited to 'lisp') diff --git a/lisp/+elfeed.el b/lisp/+elfeed.el index 9257c8d..c3e5301 100644 --- a/lisp/+elfeed.el +++ b/lisp/+elfeed.el @@ -46,20 +46,24 @@ If multiple items are selected, don't advance." (message "[Elfeed] Update in progress") 'ignore) -(defvar +elfeed--update-running nil "Whether an update is currently running.") +(defvar +elfeed--update-running-p nil "Whether an update is currently running.") (defvar +elfeed--update-count 0 "How many times `+elfeed-update-command' has run.") (defcustom +elfeed-update-niceness 15 "How \"nice\" `+elfeed-update-command' should be." :type 'integer :group 'elfeed) +(defcustom +elfeed-update-lockfile + (expand-file-name "+elfeed-update-lock" (temporary-file-directory)) + "The file to ") + (defun +elfeed-update-command () (interactive) - (unless (or +elfeed--update-running + (unless (or +elfeed--update-running-p (derived-mode-p 'elfeed-show-mode 'elfeed-search-mode)) (let ((script (expand-file-name "/tmp/elfeed-update.el")) (update-message-format "[Elfeed] Background update: %s")) - (setq +elfeed--update-running t) + (setq +elfeed--update-running-p t) (elfeed-db-save) (advice-add 'elfeed :override #'+elfeed--update-message) (ignore-errors (kill-buffer "*elfeed-search*")) @@ -128,7 +132,7 @@ If multiple items are selected, don't advance." script)) (lambda (proc stat) (advice-remove 'elfeed #'+elfeed--update-message) - (setq +elfeed--update-running nil) + (setq +elfeed--update-running-p nil) (unless (string= stat "killed") (setq +elfeed--update-count (1+ +elfeed--update-count))) (message update-message-format (string-trim stat))))))) @@ -152,7 +156,7 @@ non-nil, proceed." (defun +elfeed--cancel-update-timer () "Cancel `+elfeed--update-timer'." - (unless +elfeed--update-running + (unless +elfeed--update-running-p (ignore-errors (cancel-timer +elfeed--update-timer)) (setq +elfeed--update-timer nil))) diff --git a/lisp/+emacs.el b/lisp/+emacs.el index dedde98..7c8a1a6 100644 --- a/lisp/+emacs.el +++ b/lisp/+emacs.el @@ -121,7 +121,7 @@ Do this only if the buffer is not visiting a file." show-paren-when-point-inside-paren t ;;show-trailing-whitespace t tab-bar-show 1 - tab-width 4 + tab-width 8 ; so alignment expecting the default looks right tramp-backup-directory-alist backup-directory-alist undo-limit 100000000 ; 10 MB use-dialog-box nil diff --git a/lisp/+modeline.el b/lisp/+modeline.el index 33d34c3..026302b 100644 --- a/lisp/+modeline.el +++ b/lisp/+modeline.el @@ -9,6 +9,7 @@ ;;; Code: (require '+util) +(require 'actually-selected-window) (require 'simple-modeline) (require 'minions) @@ -472,5 +473,13 @@ to a function in the current buffer, call that function instead." (kmacro-end-macro nil))))) 'mouse-face 'mode-line-highlight)))) +(defun +modeline-nyan-on-focused (&optional spacer) + "Display the cat from `nyan-mode', but only on the focused window." + (require 'nyan-mode) + (when (actually-selected-window-p) + (concat (or spacer "") (nyan-create) + (propertize "." + 'face 'font-lock-comment-face)))) + (provide '+modeline) ;;; +modeline.el ends here diff --git a/lisp/+setup.el b/lisp/+setup.el index 919e312..1f110d6 100644 --- a/lisp/+setup.el +++ b/lisp/+setup.el @@ -80,21 +80,22 @@ If PATH does not exist, abort the evaluation." ;;; Straight.el -(with-eval-after-load 'straight - (defun setup--straight-handle-arg (arg var) - (cond - ((and (boundp var) (symbol-value var)) t) - ((keywordp arg) (set var t)) - ((functionp arg) (set var nil) (funcall arg)) - ((listp arg) (set var nil) (eval arg :lexical)))) +(defun setup--straight-handle-arg (arg var) + (cond + ((and (boundp var) (symbol-value var)) t) + ((keywordp arg) (set var t)) + ((functionp arg) (set var nil) (funcall arg)) + ((listp arg) (set var nil) arg))) +(with-eval-after-load 'straight (setup-define :straight (lambda (recipe &rest predicates) (let* ((skp (make-symbol "straight-keyword-p")) (straight-use-p - (cl-every (lambda (f) (setup--straight-handle-arg f skp)) - predicates)) - (form `(unless (and ,straight-use-p + (cl-mapcar + (lambda (f) (setup--straight-handle-arg f skp)) + predicates)) + (form `(unless (and ,@straight-use-p (condition-case e (straight-use-package ',recipe) (error diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index e9daaf4..3e6968e 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el @@ -7,6 +7,7 @@ ;;; Code: +(require 'acdw) (require 'tab-bar) (defface +tab-bar-extra @@ -35,7 +36,7 @@ "Display `tracking-mode-line-buffers' in the tab-bar." ;; TODO: write something to convert a mode-line construct to a tab-bar ;; construct. - (when (and tracking-mode + (when (and (bound-and-true-p tracking-mode) (not (and +tracking-hide-when-org-clocking (bound-and-true-p org-clock-current-task)))) (cons (when (> (length tracking-mode-line-buffers) 0) @@ -261,14 +262,8 @@ name to the left." (require 'shr) ; `shr-string-pixel-width' (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format))) (rest (tab-bar-format-list rest)) - (rest (mapconcat (lambda (item) x(nth 2 item)) rest "")) - (hpos - ;; I have to rewrite `shr-string-pixel-width' to take the tab-bar face - ;; into account. - (let ((pt (point))) - (prog1 (with-temp-buffer (insert (propertize rest 'face 'tab-bar)) - (shr-pixel-column)) - (goto-char pt)))) + (rest (mapconcat (lambda (item) (nth 2 item)) rest "")) + (hpos (shr-string-pixel-width rest)) (str (propertize " " 'display `(space :align-to (- right (,hpos)))))) `((align-right menu-item ,str ignore)))) diff --git a/lisp/acdw.el b/lisp/acdw.el index 191cdfb..fdcca84 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el @@ -288,6 +288,13 @@ always nil; this function is mostly intended for use in init." :type '(repeat function) :group 'applications) +(defun +string-repeat (n str) + "Repeat STR N times." + (let ((r "")) + (dotimes (_ n) + (setq r (concat r str))) + r)) + (defun chat-disconnect () "Disconnect from all chats." (interactive) -- cgit 1.4.1-21-gabe81