;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/erc/erc-scroll.el (require 'cl-lib) (require 'erc) (defun empty-line-p () (looking-at "^$") ) (defun erc-scroll-to-top-no-blanks () (interactive) (goto-char (point-min)) (when (and (empty-line-p) (re-search-forward "[[:graph:]]" nil t) ) (forward-line 0) (recenter 0) )) (defun erc-scroll-to-bottom-no-blanks () (interactive) (goto-char (point-max)) (recenter -1) ) (defun switch-to-erc-buffer (buf) (if (bufferp buf) (progn (switch-to-buffer buf) (erc-scroll-to-bottom-no-blanks) ) (message "%s DNC" buf) )) (provide 'erc-scroll)