summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2022-05-27 13:26:19 -0500
committerCase Duckworth2022-05-27 13:26:19 -0500
commit80abceb212b2acb420317232cb2c3d0ab69af13b (patch)
treecac3f2260b593d3c2227743e4895bbc392f5be7f /lisp
parentDon't inhibit redisplay or message when debugging (diff)
downloademacs-80abceb212b2acb420317232cb2c3d0ab69af13b.tar.gz
emacs-80abceb212b2acb420317232cb2c3d0ab69af13b.zip
asdpofiuasdpfoiasjdpfoiajsdf
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+elfeed.el14
-rw-r--r--lisp/+emacs.el2
-rw-r--r--lisp/+modeline.el9
-rw-r--r--lisp/+setup.el21
-rw-r--r--lisp/+tab-bar.el13
-rw-r--r--lisp/acdw.el7
6 files changed, 41 insertions, 25 deletions
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."
46 (message "[Elfeed] Update in progress") 46 (message "[Elfeed] Update in progress")
47 'ignore) 47 'ignore)
48 48
49(defvar +elfeed--update-running nil "Whether an update is currently running.") 49(defvar +elfeed--update-running-p nil "Whether an update is currently running.")
50(defvar +elfeed--update-count 0 "How many times `+elfeed-update-command' has run.") 50(defvar +elfeed--update-count 0 "How many times `+elfeed-update-command' has run.")
51(defcustom +elfeed-update-niceness 15 51(defcustom +elfeed-update-niceness 15
52 "How \"nice\" `+elfeed-update-command' should be." 52 "How \"nice\" `+elfeed-update-command' should be."
53 :type 'integer 53 :type 'integer
54 :group 'elfeed) 54 :group 'elfeed)
55 55
56(defcustom +elfeed-update-lockfile
57 (expand-file-name "+elfeed-update-lock" (temporary-file-directory))
58 "The file to ")
59
56(defun +elfeed-update-command () 60(defun +elfeed-update-command ()
57 (interactive) 61 (interactive)
58 (unless (or +elfeed--update-running 62 (unless (or +elfeed--update-running-p
59 (derived-mode-p 'elfeed-show-mode 'elfeed-search-mode)) 63 (derived-mode-p 'elfeed-show-mode 'elfeed-search-mode))
60 (let ((script (expand-file-name "/tmp/elfeed-update.el")) 64 (let ((script (expand-file-name "/tmp/elfeed-update.el"))
61 (update-message-format "[Elfeed] Background update: %s")) 65 (update-message-format "[Elfeed] Background update: %s"))
62 (setq +elfeed--update-running t) 66 (setq +elfeed--update-running-p t)
63 (elfeed-db-save) 67 (elfeed-db-save)
64 (advice-add 'elfeed :override #'+elfeed--update-message) 68 (advice-add 'elfeed :override #'+elfeed--update-message)
65 (ignore-errors (kill-buffer "*elfeed-search*")) 69 (ignore-errors (kill-buffer "*elfeed-search*"))
@@ -128,7 +132,7 @@ If multiple items are selected, don't advance."
128 script)) 132 script))
129 (lambda (proc stat) 133 (lambda (proc stat)
130 (advice-remove 'elfeed #'+elfeed--update-message) 134 (advice-remove 'elfeed #'+elfeed--update-message)
131 (setq +elfeed--update-running nil) 135 (setq +elfeed--update-running-p nil)
132 (unless (string= stat "killed") 136 (unless (string= stat "killed")
133 (setq +elfeed--update-count (1+ +elfeed--update-count))) 137 (setq +elfeed--update-count (1+ +elfeed--update-count)))
134 (message update-message-format (string-trim stat))))))) 138 (message update-message-format (string-trim stat)))))))
@@ -152,7 +156,7 @@ non-nil, proceed."
152 156
153(defun +elfeed--cancel-update-timer () 157(defun +elfeed--cancel-update-timer ()
154 "Cancel `+elfeed--update-timer'." 158 "Cancel `+elfeed--update-timer'."
155 (unless +elfeed--update-running 159 (unless +elfeed--update-running-p
156 (ignore-errors (cancel-timer +elfeed--update-timer)) 160 (ignore-errors (cancel-timer +elfeed--update-timer))
157 (setq +elfeed--update-timer nil))) 161 (setq +elfeed--update-timer nil)))
158 162
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."
121 show-paren-when-point-inside-paren t 121 show-paren-when-point-inside-paren t
122 ;;show-trailing-whitespace t 122 ;;show-trailing-whitespace t
123 tab-bar-show 1 123 tab-bar-show 1
124 tab-width 4 124 tab-width 8 ; so alignment expecting the default looks right
125 tramp-backup-directory-alist backup-directory-alist 125 tramp-backup-directory-alist backup-directory-alist
126 undo-limit 100000000 ; 10 MB 126 undo-limit 100000000 ; 10 MB
127 use-dialog-box nil 127 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 @@
9;;; Code: 9;;; Code:
10 10
11(require '+util) 11(require '+util)
12(require 'actually-selected-window)
12(require 'simple-modeline) 13(require 'simple-modeline)
13(require 'minions) 14(require 'minions)
14 15
@@ -472,5 +473,13 @@ to a function in the current buffer, call that function instead."
472 (kmacro-end-macro nil))))) 473 (kmacro-end-macro nil)))))
473 'mouse-face 'mode-line-highlight)))) 474 'mouse-face 'mode-line-highlight))))
474 475
476(defun +modeline-nyan-on-focused (&optional spacer)
477 "Display the cat from `nyan-mode', but only on the focused window."
478 (require 'nyan-mode)
479 (when (actually-selected-window-p)
480 (concat (or spacer "") (nyan-create)
481 (propertize "."
482 'face 'font-lock-comment-face))))
483
475(provide '+modeline) 484(provide '+modeline)
476;;; +modeline.el ends here 485;;; +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."
80 80
81;;; Straight.el 81;;; Straight.el
82 82
83(with-eval-after-load 'straight 83(defun setup--straight-handle-arg (arg var)
84 (defun setup--straight-handle-arg (arg var) 84 (cond
85 (cond 85 ((and (boundp var) (symbol-value var)) t)
86 ((and (boundp var) (symbol-value var)) t) 86 ((keywordp arg) (set var t))
87 ((keywordp arg) (set var t)) 87 ((functionp arg) (set var nil) (funcall arg))
88 ((functionp arg) (set var nil) (funcall arg)) 88 ((listp arg) (set var nil) arg)))
89 ((listp arg) (set var nil) (eval arg :lexical))))
90 89
90(with-eval-after-load 'straight
91 (setup-define :straight 91 (setup-define :straight
92 (lambda (recipe &rest predicates) 92 (lambda (recipe &rest predicates)
93 (let* ((skp (make-symbol "straight-keyword-p")) 93 (let* ((skp (make-symbol "straight-keyword-p"))
94 (straight-use-p 94 (straight-use-p
95 (cl-every (lambda (f) (setup--straight-handle-arg f skp)) 95 (cl-mapcar
96 predicates)) 96 (lambda (f) (setup--straight-handle-arg f skp))
97 (form `(unless (and ,straight-use-p 97 predicates))
98 (form `(unless (and ,@straight-use-p
98 (condition-case e 99 (condition-case e
99 (straight-use-package ',recipe) 100 (straight-use-package ',recipe)
100 (error 101 (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 @@
7 7
8;;; Code: 8;;; Code:
9 9
10(require 'acdw)
10(require 'tab-bar) 11(require 'tab-bar)
11 12
12(defface +tab-bar-extra 13(defface +tab-bar-extra
@@ -35,7 +36,7 @@
35 "Display `tracking-mode-line-buffers' in the tab-bar." 36 "Display `tracking-mode-line-buffers' in the tab-bar."
36 ;; TODO: write something to convert a mode-line construct to a tab-bar 37 ;; TODO: write something to convert a mode-line construct to a tab-bar
37 ;; construct. 38 ;; construct.
38 (when (and tracking-mode 39 (when (and (bound-and-true-p tracking-mode)
39 (not (and +tracking-hide-when-org-clocking 40 (not (and +tracking-hide-when-org-clocking
40 (bound-and-true-p org-clock-current-task)))) 41 (bound-and-true-p org-clock-current-task))))
41 (cons (when (> (length tracking-mode-line-buffers) 0) 42 (cons (when (> (length tracking-mode-line-buffers) 0)
@@ -261,14 +262,8 @@ name to the left."
261 (require 'shr) ; `shr-string-pixel-width' 262 (require 'shr) ; `shr-string-pixel-width'
262 (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format))) 263 (let* ((rest (cdr (memq '+tab-bar-format-align-right tab-bar-format)))
263 (rest (tab-bar-format-list rest)) 264 (rest (tab-bar-format-list rest))
264 (rest (mapconcat (lambda (item) x(nth 2 item)) rest "")) 265 (rest (mapconcat (lambda (item) (nth 2 item)) rest ""))
265 (hpos 266 (hpos (shr-string-pixel-width rest))
266 ;; I have to rewrite `shr-string-pixel-width' to take the tab-bar face
267 ;; into account.
268 (let ((pt (point)))
269 (prog1 (with-temp-buffer (insert (propertize rest 'face 'tab-bar))
270 (shr-pixel-column))
271 (goto-char pt))))
272 (str (propertize " " 'display `(space :align-to (- right (,hpos)))))) 267 (str (propertize " " 'display `(space :align-to (- right (,hpos))))))
273 `((align-right menu-item ,str ignore)))) 268 `((align-right menu-item ,str ignore))))
274 269
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."
288 :type '(repeat function) 288 :type '(repeat function)
289 :group 'applications) 289 :group 'applications)
290 290
291(defun +string-repeat (n str)
292 "Repeat STR N times."
293 (let ((r ""))
294 (dotimes (_ n)
295 (setq r (concat r str)))
296 r))
297
291(defun chat-disconnect () 298(defun chat-disconnect ()
292 "Disconnect from all chats." 299 "Disconnect from all chats."
293 (interactive) 300 (interactive)