From f9915edec184b1e1d1d379e3e1df0c1cbf2585e0 Mon Sep 17 00:00:00 2001 From: jao Date: Tue, 8 Jun 2021 19:54:14 +0100 Subject: jao-tracking --- init.org | 147 +++++++-------------------------------------------------------- 1 file changed, 16 insertions(+), 131 deletions(-) (limited to 'init.org') diff --git a/init.org b/init.org index 367a606..c528854 100644 --- a/init.org +++ b/init.org @@ -683,139 +683,24 @@ (defvar jao-notify-audio-icon (jao-data-file "music-player-icon.png")) #+end_src *** tracking -***** Package - #+begin_src emacs-lisp - (use-package tracking - :demand t - :init (setq tracking-position 'before-modes - tracking-frame-behavior nil - tracking-most-recent-first nil - tracking-max-mode-line-entries 10 - tracking-sort-faces-first t - tracking-shorten-modes '()) - :config - (setq erc-track-enable-keybindings nil) - - (defun jao-tracking-next-buffer () - (interactive) - (tracking-next-buffer) - (jao-minibuffer-refresh)) - - :bind (("C-c C-SPC" . jao-tracking-next-buffer))) - - (defun jao-tracking-faces (&rest faces) - (dolist (face faces) - (add-to-list 'tracking-faces-priorities face))) - #+end_src -***** Shorten - #+begin_src emacs-lisp - (require 'shorten) - - (defun jao-shorten-modes (&rest modes) - (dolist (m modes) (add-to-list 'tracking-shorten-modes m))) - - (defun jao-tracking--clean-slack (s) - (let ((s (replace-regexp-in-string - "^\\*Slack - .*? : \\(mpdm-\\)?\\([^ ]+\\)\\( \\(T\\)\\)?.*" - "#\\2\\4" - s))) - (replace-regexp-in-string "^[^a-zA-Z#]+" "#" s))) - - (defun jao-tracking-shorten-aggressively (lst tail-count) - (let* ((s (shorten-join-sans-tail lst tail-count))) - (if (string-match-p "^#" s) (substring s 1 nil) s))) - - (defun jao-tracking-split-clean (s) - (shorten-split (jao-tracking--clean-slack s))) - - (defun jao-tracking-shorten (old-func &rest args) - (let ((shorten-join-function #'jao-tracking-shorten-aggressively) - (shorten-split-function #'jao-tracking-split-clean)) - (apply old-func args))) - - (advice-add #'tracking-shorten :around #'jao-tracking-shorten) - #+end_src -***** Minibuffer / proplog - #+begin_src emacs-lisp - (defvar jao-tracking-string "") - - (setq jao-tracking-bkg - (if (jao-colors-scheme-dark-p) "grey20" "grey93")) - - (defface jao-tracking-minibuffer `((t :background ,jao-tracking-bkg)) "") - (defface jao-tracking-minibuffer-sep - `((t :foreground ,jao-tracking-bkg :background ,jao-tracking-bkg)) "") - - (defun jao-tracking-set-log (v) - (when (member window-system '(x)) - (x-change-window-property "_EMACS_LOG" v nil nil nil nil 0))) - - (jao-tracking-set-log "") - - (defun jao-tracking--buffer-str (s) - (if (listp s) - `(:propertize ,(plist-get s :propertize) - face - (jao-tracking-minibuffer - ,@(when-let ((f (plist-get s 'face))) - (jao-tracking-set-log " * ") - (list f)))) - `(:propertize "|" face jao-tracking-minibuffer-sep))) - - (defun jao-tracking-build-str (new-val) - (jao-tracking-set-log "") - (if (listp new-val) - (mapcar #'jao-tracking--buffer-str new-val) - new-val)) - - (defun jao-tracking-echo (sym new-val op where) - (setq jao-tracking-string (jao-tracking-build-str new-val)) - (jao-minibuffer-refresh)) - - (jao-minibuffer-add-variable 'jao-tracking-string -10) - (add-variable-watcher 'tracking-mode-line-buffers #'jao-tracking-echo) - ;; since we're using the minibuffer, forget the mode line - (advice-add #'tracking-mode :override - (lambda (&optional _) (interactive))) - #+end_src -***** Additional highlighting - #+begin_src emacs-lisp - (defvar jao-tracking-highlight-rx "$^") - - (defun jao-tracking-add-buffer (old-func &rest args) - (let* ((buffer (car args)) - (faces (if (and buffer - (string-match-p jao-tracking-highlight-rx - (buffer-name buffer))) - (cons 'lui-highlight-face (cadr args)) - (cadr args)))) - (funcall old-func buffer faces))) - - (advice-add #'tracking-add-buffer :around #'jao-tracking-add-buffer) - (jao-tracking-faces 'lui-highlight-face) - #+end_src -*** notification server #+begin_src emacs-lisp - (use-package ednc - :ensure t - :diminish) - - (use-package jao-ednc - :after ednc - :commands (jao-ednc-setup) + (use-package tracking + :demand t + :init (setq tracking-position 'before-modes + tracking-frame-behavior nil + tracking-most-recent-first nil + tracking-max-mode-line-entries 10 + tracking-sort-faces-first t + tracking-shorten-modes '()) :config - (defhydra jao-hydra-ednc (:color blue) - "Notifications" - ("s" jao-ednc-show "show last") - ("d" jao-ednc-dismiss "dismiss last") - ("D" jao-ednc-dismiss-all "dismiss all") - ("i" jao-ednc-invoke-last-action "invoke last action") - ("n" jao-ednc-pop "show all")) - (jao-ednc-ignore-app "Spotify") - (jao-ednc-ignore-app "NetworkManager") - :bind (("s-n" . jao-hydra-ednc/body) - ("H-s-n" . jao-hydra-ednc/body))) - #+end_src + (setq erc-track-enable-keybindings nil) + :bind (("C-c C-SPC" . tracking-next-buffer))) + + (use-package jao-minibuffer-tracking + :demand t + :init (setq jao-tracking-bkg + (if (jao-colors-scheme-dark-p) "grey20" "grey93"))) + #+end_src * Calendar, diary, weather *** Diary #+BEGIN_SRC emacs-lisp -- cgit v1.2.3