diff options
author | jao <jao@gnu.org> | 2022-11-24 03:05:56 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-11-24 03:05:56 +0000 |
commit | 34d634207f962ce7e1f78f521047ef8c502ace62 (patch) | |
tree | 6f8dd5fb1fea6f8c9418d6b681cbd99028444b51 /lib | |
parent | ea385175fc5a5ea27499a81fe832a3a3fc6c01a3 (diff) | |
download | elibs-34d634207f962ce7e1f78f521047ef8c502ace62.tar.gz elibs-34d634207f962ce7e1f78f521047ef8c502ace62.tar.bz2 |
little clean-ups
Diffstat (limited to 'lib')
-rw-r--r-- | lib/eos/jao-tracking.el | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/eos/jao-tracking.el b/lib/eos/jao-tracking.el index 5158fd6..da01018 100644 --- a/lib/eos/jao-tracking.el +++ b/lib/eos/jao-tracking.el @@ -1,4 +1,4 @@ -;;; jao-minibuffer-tracking.el --- Tracking notifications in minibuffer -*- lexical-binding: t; -*- +;; jao-minibuffer-tracking.el --- Tracking notifications -*- lexical-binding: t; -*- ;; Copyright (C) 2021, 2022 jao @@ -18,35 +18,33 @@ ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <https://www.gnu.org/licenses/>. -;;; Code: +;;; require (require 'tracking) (require 'shorten) (require 'jao-minibuffer) (require 'jao-afio) - -;; shorten +;;; shorten +;;;###autoload (defun jao-shorten-modes (&rest modes) (dolist (m modes) (add-to-list 'tracking-shorten-modes m))) (defvar jao-tracking-cleaners '(("^[^a-zA-Z#@]+" . "#"))) +;;;###autoload (defun jao-tracking-cleaner (rx subst) (add-to-list 'jao-tracking-cleaners (cons rx subst))) -(defun jao-tracking--clean-slack (s) - (dolist (cln jao-tracking-cleaners) - (when (string-match (car cln) s) - (setq s (replace-match (cdr cln) nil nil s)))) - s) - (defun jao-tracking-shorten-aggressively (lst tail-count) - (let* ((s (shorten-join-sans-tail 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))) + (dolist (cln jao-tracking-cleaners) + (when (string-match (car cln) s) + (setq s (replace-match (cdr cln) nil nil s)))) + (shorten-split s)) (defun jao-tracking-shorten (old-func &rest args) (let ((shorten-join-function #'jao-tracking-shorten-aggressively) @@ -55,14 +53,15 @@ (advice-add #'tracking-shorten :around #'jao-tracking-shorten) - -;; additional highlighting +;;; additional highlighting (defvar jao-tracking-highlight-rx "$^") +;;;###autoload (defun jao-tracking-faces (&rest faces) (dolist (face faces) (add-to-list 'tracking-faces-priorities face))) +;;;###autoload (defun jao-tracking-add-buffer (old-func &rest args) (let* ((buffer (car args)) (faces (if (and buffer @@ -75,8 +74,7 @@ (advice-add 'tracking-add-buffer :around #'jao-tracking-add-buffer) (jao-tracking-faces 'lui-highlight-face) - -;; minibuffer +;;; minibuffer (defvar jao-tracking-string "") (defvar jao-tracking-bkg "grey93") @@ -133,6 +131,7 @@ (unless (and jao-afio-use-frames jao-tracking-use-scratch) (tracking-remove-visible-buffers))) +;;; package setup ;;;###autoload (defun jao-tracking-go-to-chats () (interactive) |