summaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2020-11-18 23:40:15 +0000
committerjao <jao@gnu.org>2020-11-18 23:40:15 +0000
commit7911d5bc6761be4d772a8a28a680965ec6b4cd9e (patch)
tree49a672bd7927dfa843524d088d50151ef732010d /misc
parentd372785c2b31581b581b7d809a0e66ae2a99a1fa (diff)
downloadelibs-7911d5bc6761be4d772a8a28a680965ec6b4cd9e.tar.gz
elibs-7911d5bc6761be4d772a8a28a680965ec6b4cd9e.tar.bz2
ednc improvements
Diffstat (limited to 'misc')
-rw-r--r--misc/jao-ednc.el34
1 files changed, 29 insertions, 5 deletions
diff --git a/misc/jao-ednc.el b/misc/jao-ednc.el
index b808e2d..6a28658 100644
--- a/misc/jao-ednc.el
+++ b/misc/jao-ednc.el
@@ -28,9 +28,16 @@
(require 'ednc)
(require 'jao-minibuffer)
+(declare-function tracking-add-buffer "tracking")
+(declare-function tracking-remove-buffer "tracking")
+
(defvar jao-ednc--count-format "{%d}")
(defvar jao-ednc--last-notification nil)
+(defface jao-ednc-tracking '((t :inherit warning))
+ "Tracking notifications face"
+ :group 'jao-ednc)
+
(defun jao-ednc--format-last ()
(when jao-ednc--last-notification
(let ((s (ednc-format-notification jao-ednc--last-notification t)))
@@ -42,26 +49,36 @@
(defun jao-ednc--on-notify (old new)
(when old
+ (tracking-remove-buffer (get-buffer ednc-log-name))
(setq jao-ednc--last-notification nil)
(jao-minibuffer-pop-notification))
(when new
+ (tracking-add-buffer (get-buffer ednc-log-name))
(setq jao-ednc--last-notification new)
(jao-minibuffer-push-notification '(:eval (jao-ednc--format-last)))))
;;;###autoload
(defun jao-ednc-setup ()
- (with-eval-after-load "jao-notify"
- (defun jao-ednc--notify (msg &optional title _)
- (message "%s%s%s" (or title "") (if title " " "") msg))
- (advice-add 'jao-notify :override #'jao-ednc--notify))
+ (setq jao-notify-use-messages-p t)
+ (with-eval-after-load "tracking"
+ (add-to-list 'tracking-faces-priorities 'jao-ednc-tracking)
+ (when (listp tracking-shorten-modes)
+ (add-to-list 'tracking-shorten-modes 'ednc-view-mode)))
(jao-minibuffer-add-variable '(jao-ednc--count) t)
(add-hook 'ednc-notification-presentation-functions #'jao-ednc--on-notify)
(ednc-mode))
;;;###autoload
+(defun jao-ednc-pop ()
+ (interactive)
+ (pop-to-buffer-same-window ednc-log-name))
+
+;;;###autoload
(defun jao-ednc-show ()
(interactive)
- (pop-to-buffer-same-window "*ednc-log*"))
+ (if jao-ednc--last-notification
+ (ednc-pop-to-notification-in-log-buffer jao-ednc--last-notification)
+ (jao-ednc-pop)))
;;;###autoload
(defun jao-ednc-invoke-last-action ()
@@ -71,5 +88,12 @@
(message "No active notifications"))
(jao-minibuffer-pop-notification))
+;;;###autoload
+(defun jao-ednc-dismiss ()
+ (interactive)
+ (if jao-ednc--last-notification
+ (ednc-dismiss-notification jao-ednc--last-notification)
+ (jao-minibuffer-pop-notification)))
+
(provide 'jao-ednc)
;;; jao-ednc.el ends here