;;; +nyan-mode.el --- Extras for nyan-mode -*- lexical-binding: t; -*- ;;; Commentary: ;;; Code: ;;; Update even without line number in the mode line. (defcustom +nyan-mode-update-functions '( end-of-buffer beginning-of-buffer next-line previous-line org-next-visible-heading org-previous-visible-heading) "Functions after which to force a mode-line update." :type '(repeat function)) (defun +nyan-mode--fmlu (&rest _) "Update the mode-line, advice-style." (force-mode-line-update)) (defun +nyan-mode-advice (&rest _) "Advise line-moving functions when in `nyan-mode'." (dolist (fn +nyan-mode-update-functions) (if nyan-mode (advice-add fn :after #'+nyan-mode--fmlu) (advice-remove fn #'+nyan-mode--fmlu)))) (defface +nyan-mode-line nil "Face for the nyan-mode mode-line indicator.") (define-minor-mode +nyan-local-mode "My very own `nyan-mode' that isn't global and doesn't update the mode-line." :global nil :group 'nyan (dolist (fn +nyan-mode-update-functions) (if +nyan-local-mode (advice-add fn :after #'+nyan-mode--fmlu) (advice-remove fn #'+nyan-mode--fmlu)))) (define-globalized-minor-mode +nyan-mode +nyan-local-mode +nyan-local-mode) (provide '+nyan-mode) ;;; +nyan-mode.el ends here