Re: Gnus state, feed commands
wgreenho...@riseup.net (W. Greenhouse) writes: I sort of solved this. Check out the comments. Cool. Well, it works but of all the cool things I did, I'm not that happy with this particular hack, for the reasons mentioned in the comments: 1. The visual switch between buffers - this is something that is done for the human eye, switching back and forth so a computer can do its (supposedly background) job doesn't make sense. 2. The setup of *three* hooks to do one thing: once there is a change, update the variable. An alternate approach ... The strange (?) thing is, I don't understand any of that. Are we using the same stuff to begin with, or am I just plain stupid? You can check out my Gnus setup (for mails, mailing lists, and Usenet) here [1]. If you can confirm we are using the same stuff I'll make a second attempt to understand your solution :) [1] http://user.it.uu.se/~embe8573/conf/.emacs-gnus -- Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu underground experts united: http://user.it.uu.se/~embe8573 ___ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
Re: Gnus state, feed commands
Emanuel Berg embe8...@student.uu.se writes: I sort of solved this. Check out the comments. [...] Cool. An alternate approach to the problem: track the place Gnus is getting its mail from. `display-time-mode' has some built-in support for this. My MTA delivers new mails for me to a Maildir at ~/Maildir, so with (setq display-time-mail-directory ~/Maildir/new/) I can get Mail in my mode line when display-time-mode is on and mail arrives at ~/Maildir. In the Maildir format, the new/ subdir is where mails arrive; when Gnus processes them, whether by marking them unread or flagged or splitting them to other folders, they are moved to cur/, so new/ will only contain new, unprocessed mail. There are also options to use an mbox file or an arbitrary function to test for the rpesence of new mail every time `display-time' updates. If you use Gnus `mail-sources' to control where your mail comes from, you might try (setq display-time-mail-function 'mail-source-new-mail-p) ___ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
Re: Gnus state, feed commands
I sort of solved this. Check out the comments. (defvar *unread-mails*) (setq *unread-mails* ) (defun update-unread-mails () (let ((num-msgs (gnus-number-of-unseen-articles-in-group alt.test))) (setq *unread-mails* (if ( 0 num-msgs) * MAIL * ) ))) ;; I found it to be much better not to use the number. ;; Then you stare at that digit - could be 0, could be ;; 7, could it be... Zzz... until you get dizzy. The ;; idea was to have the computer tell you about mails, ;; not have *you* stare into a digit. (defun gnus-get-news-bg () (interactive) (let ((ori-buffer (current-buffer))) (gnus-start-or-show) ; basically (gnus) (switch-to-buffer ori-buffer) )) ; can this be avoided? (defun gnus-after-init () (gnus-demon-add-handler 'gnus-get-news-bg 1 t) (gnus-demon-init) ) (add-hook 'gnus-started-hook 'gnus-after-init) (add-hook 'gnus-get-new-news-hook'update-unread-mails) (add-hook 'gnus-agent-fetched-hook 'update-unread-mails) (add-hook 'gnus-group-catchup-group-hook 'update-unread-mails) ;; One would think, there should be just one hook, to ;; reflect the change of state of the set of groups ;; *and* their unseen articles. -- Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu underground experts united: http://user.it.uu.se/~embe8573 ___ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
Re: Gnus state, feed commands
Emanuel Berg embe8...@student.uu.se writes: [...] So you see, putting that information in the mode line shouldn't be that difficult. But what I don't know is: how do I access the state of Gnus? I.e., how do I get that number 5? And, how do I feed command to Gnus, in the background, without switching buffers or triggering any other visual noise? There are some functions you can use which take the name of the group as displayed in the *Group* buffer, given as a string. For example, (gnus-number-of-unseen-articles-in-group mail.misc) which returns an integer. Obviously, you could track several groups and add them together, since the return value of this function is a number. As for the idle timer part of your scheme, consider using (info (gnus) Daemons), which is Gnus's built-in interface to the Emacs timer facility. Conveniently, this will let you start the timers when Gnus is started, and tear them down if you quit Gnus, which saves you from some of the trouble of handling errors when information from the groups isn't available. -- Regards, WGG ___ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english
Re: Gnus state, feed commands
wgreenho...@riseup.net (W. Greenhouse) writes: (gnus-number-of-unseen-articles-in-group mail.misc) Yes, works! As for the idle timer part of your scheme, consider using (info (gnus) Daemons), which is Gnus's built-in interface to the Emacs timer facility. Conveniently, this will let you start the timers when Gnus is started, and tear them down if you quit Gnus, which saves you from some of the trouble of handling errors when information from the groups isn't available. Good point, will do. I don't have info on Gnus, but I take it this is the same: http://www.gnu.org/software/emacs/manual/html_node/gnus/Daemons.html -- Emanuel Berg, programmer-for-rent. CV, projects, etc at uXu underground experts united: http://user.it.uu.se/~embe8573 ___ info-gnus-english mailing list info-gnus-english@gnu.org https://lists.gnu.org/mailman/listinfo/info-gnus-english