From 34d634207f962ce7e1f78f521047ef8c502ace62 Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 24 Nov 2022 03:05:56 +0000 Subject: little clean-ups --- custom/jao-custom-notmuch.el | 2 +- lib/eos/jao-tracking.el | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index ad1bcf9..59da6dc 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -563,7 +563,7 @@ (setq jao-org-notmuch-last-subject subj) (when (y-or-n-p "Archive message? ") (jao-notmuch--add-tags '("+trove"))) - (when (y-or-n-p "Flag message as todo? ") + (when (y-or-n-p "Flag message? ") (jao-notmuch--add-tags '("+flagged"))) (org-link-store-props :type "notmuch" :link link 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 . -;;; 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) -- cgit v1.2.3