diff options
| -rw-r--r-- | jakob.org | 52 |
1 files changed, 52 insertions, 0 deletions
@@ -1747,6 +1747,58 @@ Configure a custom channame format for =erc-status-sidebar=. (setq erc-status-sidebar-channel-format #'erc-reverse-chan-format)) #+END_SRC +Display a bar delimiting read and unread messages. Adapted from [[https://www.emacswiki.org/emacs/ErcBar][here]]. + +#+BEGIN_SRC elisp +(defvar erc-bar-overlay nil + "Overlay used to set bar") + +(defvar erc-bar-threshold 1 + "The minimum number of messages required for the bar to be +displayed.") + +(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)))) + +(when-all-loaded erc + ;; Run the hook before 'erc-modified-channels-update + (defadvice erc-track-mode (after erc-bar-setup-hook + (&rest args) activate) + (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 + +Display the bar as a highlight on the most recently unread message. + +#+BEGIN_SRC elisp +(with-palette + (setq erc-bar-overlay (make-overlay 0 0)) + (overlay-put erc-bar-overlay 'face `(:background ,black-2))) +#+END_SRC + * RSS Preference of hygene. See [[Filesystem]]. |