summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-08-28 22:56:55 +0100
committerjao <jao@gnu.org>2022-08-28 22:58:37 +0100
commit692b296a7cbd13a0689fdf9fdc9608d116ab625e (patch)
treeff91ce1c304aa295f9fedf939f62795220e6f03c
parentb3a8b4be813f6f76b181dff5175c7a1b731be765 (diff)
downloadelibs-692b296a7cbd13a0689fdf9fdc9608d116ab625e.tar.gz
elibs-692b296a7cbd13a0689fdf9fdc9608d116ab625e.tar.bz2
tracking on scratch moved to jao-tracking
-rw-r--r--init.el25
-rw-r--r--lib/eos/jao-tracking.el37
2 files changed, 38 insertions, 24 deletions
diff --git a/init.el b/init.el
index 92495d8..599492f 100644
--- a/init.el
+++ b/init.el
@@ -738,22 +738,6 @@
;;;; jao-notify
(require 'jao-notify)
;;;; tracking
-(defvar jao-tracking-use-scratch (not window-system))
-(defvar jao-tracking--start-frame nil)
-
-(defun jao-tracking-next-buffer ()
- (interactive)
- (when jao-tracking-use-scratch
- (let ((n (jao-afio-frame-no)))
- (unless (eq 0 n) (setq jao-tracking--start-frame n))
- (cond (tracking-buffers
- (jao-afio--goto-scratch))
- (jao-tracking--start-frame
- (jao-afio-goto-nth jao-tracking--start-frame)
- (setq jao-tracking--start-frame nil)))))
- (tracking-next-buffer)
- (jao-tracking-update-minibuffer))
-
(use-package tracking
:demand t
:init (setq tracking-position 'before-modes
@@ -763,14 +747,15 @@
tracking-sort-faces-first t
tracking-shorten-modes '())
:config
- (setq erc-track-enable-keybindings nil)
-
- :bind (("C-c C-SPC" . jao-tracking-next-buffer)))
+ (setq erc-track-enable-keybindings nil))
(use-package jao-tracking
:demand t
:init (setq jao-tracking-bkg
- (if (jao-colors-scheme-dark-p) "grey20" "grey93")))
+ (if (jao-colors-scheme-dark-p) "grey20" "grey93")
+ jao-tracking-use-scratch (not window-system))
+ :config (jao-tracking-set-up)
+ :bind (("C-c C-SPC" . jao-tracking-next-buffer)))
;;;; tmr
(use-package tmr
diff --git a/lib/eos/jao-tracking.el b/lib/eos/jao-tracking.el
index 8436733..386cc12 100644
--- a/lib/eos/jao-tracking.el
+++ b/lib/eos/jao-tracking.el
@@ -23,6 +23,7 @@
(require 'tracking)
(require 'shorten)
(require 'jao-minibuffer)
+(require 'jao-afio)
;; shorten
@@ -117,10 +118,38 @@
(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)))
+(defvar jao-tracking-use-scratch nil)
+(defvar jao-tracking--start-frame nil)
+
+(defun jao-tracking--remove-visible-buffers ()
+ (unless (and jao-afio-use-frames jao-tracking-use-scratch)
+ (tracking-remove-visible-buffers)))
+
+;;;###autoload
+(defun jao-tracking-next-buffer ()
+ (interactive)
+ (if jao-tracking-use-scratch
+ (let ((n (jao-afio-frame-no)))
+ (unless (eq 0 n) (setq jao-tracking--start-frame n))
+ (cond (tracking-buffers
+ (let ((b (car tracking-buffers)))
+ (if (eq 0 n) (tracking-next-buffer)
+ (jao-afio--goto-scratch)
+ (when b (pop-to-buffer b))
+ (tracking-remove-visible-buffers))))
+ (jao-tracking--start-frame
+ (jao-afio-goto-nth jao-tracking--start-frame)
+ (setq jao-tracking--start-frame nil))))
+ (tracking-next-buffer))
+ (jao-tracking-update-minibuffer))
+
+;;;###autoload
+(defun jao-tracking-setup ()
+ (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)))
+ (add-hook 'jao-afio-switch-hook #'jao-tracking--remove-visible-buffers))
(provide 'jao-tracking)
;;; jao-minibuffer-tracking.el ends here