;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/gnus/group.el (require 'close) (require 'erc-incal) (require 'find-command-zsh) (require 'gnus-group) (require 'gnus-score) (require 'gnus-srvr) (require 'group-summary) (require 'mode-line) (require 'scroll) (require 'super) (setq gnus-group-line-format "%0{%L%} %1{%2~(ignore \"0\")T%} %G%37= %5~(ignore \"0\")y %6~(ignore \"0\")t %0{%s%}\n") (setq gnus-group-mode-line-format "%M: %S") (setq gnus-group-sort-function #'gnus-group-sort-by-real-name) (setq gnus-group-use-permanent-levels t) (setq gnus-interactive-catchup nil) (defun gnus-group-restart-incal () (interactive nil gnus-group-mode) (gnus-save-newsrc-file) (gnus-clear-system) (gnus) ) (defun gnus-group-list-few-groups-sort () "List subscribed groups with level below `gnus-level-subscribed'. Sort with `gnus-group-sort-function'." (interactive) (gnus-group-list-groups gnus-level-subscribed) (gnus-group-sort-groups gnus-group-sort-function) ) (defun gnus-group-list-all-groups-sort () "List all subscribed groups. Sort with `gnus-group-sort-function'." (interactive) (gnus-group-list-all-groups) (gnus-group-sort-groups gnus-group-sort-function) ) (defun online-verbose () (interactive) (shell-command-silent "long-date &") ) ;; (online-verbose) (defun online () (interactive) (let ((OK-string "1")) (or (string= OK-string (shell-command-to-string "check-online")) ;; the below is so it will work in /sudo:root[...]: buffers (string= OK-string (shell-command-to-string (format "zsh -c 'source /home/%s/.zsh/remote && check-online'" user-login-name) ))))) (defun gnus-group-get-new-news-verbose (&optional no-open) (interactive "P") (message " ...") (unless no-open (gnus-open-servers t) ) (gnus-summary-exit-and-save-all) (gnus-group-get-new-news) (message " o-)") ) (defun gnus-group-post-news-to-group-at-point () (interactive) (gnus-group-post-news 4) ) (defun gnus-group-show-mails (&optional n) "Show N posts from nnml:mail.misc group, default 12." (interactive "P") (or n (setq n (or (and (listp n) (car n)) 12))) (gnus-group-read-group n nil "nnml:mail.misc") ) (defun gnus-group-show-sent (&optional n) "Show N posts from `gnus-message-archive-group', default 12." (interactive "P") (or n (setq n (or (and (listp n) (car n)) 12))) (gnus-group-read-group n nil gnus-message-archive-group) ) (defun gnus-group-show-geh (&optional n) (interactive "p") (when (= n 1) (setq n nil) ) (gnus-group-read-group n nil "gmane.emacs.help") ) (defun gnus-open-servers (&optional silent) (interactive) (save-window-excursion (unless (get-buffer gnus-server-buffer) (gnus-group-enter-server-mode) ) (with-current-buffer gnus-server-buffer (gnus-server-open-all-servers) ) (unless silent (message "servers open") ))) (defun gnus-group-set-keys () (let ((kmap gnus-group-mode-map)) (disable-super-global-keys kmap) (set-close-key kmap) (set-vertical-keys kmap nil t) (keymap-set kmap "g" #'gnus-group-get-new-news-verbose) (keymap-set kmap "M-0" #'gnus-undo) (keymap-set kmap "R" #'gnus-group-restart-incal) (keymap-set kmap "u" #'gnus-score-load-files) (keymap-set kmap "w" #'gnus-apply-kill-file) (keymap-set kmap "z" #'gnus-group-edit-global-kill) ;; show (keymap-set kmap "f" #'gnus-group-list-few-groups-sort) (keymap-set kmap "l" #'gnus-group-list-all-groups-sort) ;; goto (keymap-set kmap "e" #'gnus-group-show-geh) (keymap-set kmap "h" #'gnus-group-show-geh) (keymap-set kmap "m" #'gnus-group-show-mails) (keymap-set kmap "s" #'gnus-group-show-sent) ;; group (keymap-set kmap "3" #'gnus-group-toggle-subscription-at-point) (keymap-set kmap "C-c k" #'gnus-group-kill-group) (keymap-set kmap "A" #'gnus-group-make-group) (keymap-set kmap "a" #'gnus-group-post-news-to-group-at-point) ;; servers (keymap-set kmap "o" #'gnus-open-servers) (keymap-set kmap "S" #'gnus-group-enter-server-mode) ;; unset (keymap-unset kmap "C-k") ; gnus-group-kill-group (keymap-unset kmap "M-i") ; scroll-up-1 (keymap-unset kmap "M-k") ; scroll-down-1 (keymap-unset kmap "TAB") ; gnus-topic-mode )) (defun gnus-group-mode-hook-f () (lines) (gnus-group-set-keys) ) (add-hook 'gnus-group-mode-hook #'gnus-group-mode-hook-f) (provide 'group)