From 998f48d137e20c61d09fecb3ad868fdc36bf0046 Mon Sep 17 00:00:00 2001 From: Jakob L. Kreuze Date: Mon, 11 Mar 2019 18:48:58 -0400 Subject: Replace ERC tracking bar with erc-keep-place --- jakob.org | 52 +++++----------------------------------------------- 1 file changed, 5 insertions(+), 47 deletions(-) (limited to 'jakob.org') diff --git a/jakob.org b/jakob.org index c4ce1b1..982f3c6 100644 --- a/jakob.org +++ b/jakob.org @@ -1244,10 +1244,11 @@ including =truncate=, but omitting =autojoin=. :straight nil :config (setq erc-modules '(button completion fill - irccontrols list match - menu move-to-prompt netsplit - networks noncommands readonly - ring stamp track truncate)) + irccontrols keep-place list + match menu move-to-prompt + netsplit networks noncommands + readonly ring stamp track + truncate)) (erc-update-modules) #+END_SRC @@ -2015,46 +2016,3 @@ line. (setq erc-modified-channels-alist nil) (erc-modified-channels-display)) #+END_SRC - -ERC tracking bar. Not mine. Shamelessly lifted from [[https://www.emacswiki.org/emacs/ErcBar][EmacsWiki]]. - -#+BEGIN_SRC elisp -(eval-after-load 'erc-track - '(progn - (defun erc-bar-move-back (n) - "Moves back n message lines. Ignores wrapping, and server messages." - (interactive "nHow many lines ? ") - (re-search-backward "^.*<.*>" nil t n)) - - (defun erc-bar-update-overlay () - "Update the overlay for current buffer, based on the content of -erc-modified-channels-alist. Should be executed on window change." - (interactive) - (let* ((info (assq (current-buffer) erc-modified-channels-alist)) - (count (cadr info))) - (if (and info (> count erc-bar-threshold)) - (save-excursion - (end-of-buffer) - (when (erc-bar-move-back count) - (let ((inhibit-field-text-motion t)) - (move-overlay erc-bar-overlay - (line-beginning-position) - (line-end-position) - (current-buffer))))) - (delete-overlay erc-bar-overlay)))) - - (defvar erc-bar-threshold 1 - "Display bar when there are more than erc-bar-threshold unread messages.") - (defvar erc-bar-overlay nil - "Overlay used to set bar") - (setq erc-bar-overlay (make-overlay 0 0)) - (overlay-put erc-bar-overlay 'face '(:underline "red")) - ;;put the hook before erc-modified-channels-update - (defadvice erc-track-mode (after erc-bar-setup-hook - (&rest args) activate) - ;;remove and add, so we know it's in the first place - (remove-hook 'window-configuration-change-hook 'erc-bar-update-overlay) - (add-hook 'window-configuration-change-hook 'erc-bar-update-overlay)) - (add-hook 'erc-send-completed-hook (lambda (str) - (erc-bar-update-overlay))))) -#+END_SRC -- cgit v1.3