(defvar gnus-prevent-distraction-prevention nil "If t, do not prevent distraction.") (defvar gnus-distraction-prevention-include-ticked t "If t, groups with ticked articles will always be displayed.") (setq gnus-distraction-threshold 1) (defun gnus-distraction-prevention-check (info) "Return t if group has more than gnus-distraction-threshold unread articles. If gnus-distraction-prevention-include-ticked is t, groups with ticked articles will always be displayed." ;(debug) (let* ((group (car info)) (threshold (or (if gnus-prevent-distraction-prevention 1 nil) (gnus-group-find-parameter group 'gnus-distraction-threshold) gnus-distraction-threshold)) (unread (or (gnus-group-unread group) 0)) (ticked (assoc 'tick (gnus-info-marks info)))) ;; if unread is t, the group is not opened (if (eq unread t) (setq unread 0)) ;;(message (concat "threshold for " group " is " ;; (number-to-string threshold))) (or (and gnus-distraction-prevention-include-ticked ticked) (>= unread threshold)))) (defun gnus-distraction-prevention-toggle () "Toggle between distraction prevention and no distraction prevention." (interactive) (let ((message)) (if gnus-prevent-distraction-prevention (progn (setq gnus-prevent-distraction-prevention nil message "on")) (setq gnus-prevent-distraction-prevention t message "off")) (gnus-group-list-groups) (message (concat "Distraction prevention is " message ".")))) (defun gnus-distraction-tick-toggle () "Toggle between displaying groups with ticked articles or not." (interactive) (let ((message)) (if gnus-distraction-prevention-include-ticked (progn (setq gnus-distraction-prevention-include-ticked nil message "on")) (setq gnus-distraction-prevention-include-ticked t message "off")) (gnus-group-list-groups) (message (concat "Ticked distraction prevention is " message ".")))) (define-key gnus-group-mode-map (kbd "C-c d") 'gnus-distraction-prevention-toggle) (define-key gnus-group-mode-map (kbd "C-c t") 'gnus-distraction-tick-toggle)