From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Stewart Newsgroups: gmane.emacs.devel Subject: Integrate gnus.el with gnus-notify.el Date: Sat, 20 Dec 2008 10:32:39 +0800 Message-ID: <87myer60fs.fsf@debian.domain> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1229740384 25712 80.91.229.12 (20 Dec 2008 02:33:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Dec 2008 02:33:04 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 20 03:34:09 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LDrfM-0006Ua-L6 for ged-emacs-devel@m.gmane.org; Sat, 20 Dec 2008 03:34:08 +0100 Original-Received: from localhost ([127.0.0.1]:51881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LDre9-0000xL-Ts for ged-emacs-devel@m.gmane.org; Fri, 19 Dec 2008 21:32:53 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LDre4-0000x6-CR for emacs-devel@gnu.org; Fri, 19 Dec 2008 21:32:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LDre1-0000wu-Vd for emacs-devel@gnu.org; Fri, 19 Dec 2008 21:32:47 -0500 Original-Received: from [199.232.76.173] (port=47593 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LDre1-0000wr-P3 for emacs-devel@gnu.org; Fri, 19 Dec 2008 21:32:45 -0500 Original-Received: from ti-out-0910.google.com ([209.85.142.190]:36126) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LDre1-0000aL-0Y for emacs-devel@gnu.org; Fri, 19 Dec 2008 21:32:45 -0500 Original-Received: by ti-out-0910.google.com with SMTP id u5so799305tia.10 for ; Fri, 19 Dec 2008 18:32:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :message-id:user-agent:mime-version:content-type; bh=dd2wGlu/x57aN5y+4SbAgzJ9UneYXI/JQyu+vnHB0pk=; b=jaDqm1GT0cCTluyahkUFQFH7EtHxb9P2o0zO6kkk+V2RmUNOXLjOubz7yL2AJg8G3T NoxpuAQ9q5jctMTHMxH0Z/hhN6LYozHAKvU/7QsopdAYPDwD9z+rW1haJbf99yQJ8431 x+B7wNIKX/ekVTov7oBY9KF3sfawt/rvc7hU4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; b=n1vcG0sv7ZBILudHRQGgIC5vPQgkWYWXD1QltcSP1R/dgevGvXQQzfJkmLaY/IUmum E3KO3SQFhTwcq16ywJXj0PM+OWxqXCfazbPGRwpqohwGgsEn64Plag4U9huPZ0BOOM6/ aZ4WThZqtBNYgIGP7jIH9L+vBbsGyrBN0LbH0= Original-Received: by 10.110.86.3 with SMTP id j3mr5676059tib.4.1229740363430; Fri, 19 Dec 2008 18:32:43 -0800 (PST) Original-Received: from smtp.gmail.com ([222.212.143.192]) by mx.google.com with ESMTPS id d7sm9043695tib.17.2008.12.19.18.32.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 19 Dec 2008 18:32:42 -0800 (PST) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:107089 Archived-At: --=-=-= Hi all, I have develop a extension named "gnus-notify.el" for notify gnus news at mode-line. It's very useful. I have attached newest version. I want integrate gnus.el with gnus-notify.el I have sign copyright of FSF. Any suggestions? Thanks. -- Andy. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=gnus-notify.el Content-Transfer-Encoding: quoted-printable Content-Description: gnus-notify.el ;;; gnus-notify.el --- Gnus notify ;; Filename: gnus-notify.el ;; Description: Gnus notify ;; Author: Andy Stewart lazycat.manatee@gmail.com ;; Maintainer: Andy Stewart lazycat.manatee@gmail.com ;; Copyright (C) 2008, Andy Stewart, all rights reserved. ;; Created: 2008-12-08 16:37:00 ;; Version: 0.2 ;; Last-Updated: 2008-12-18 09:15:59 ;; By: Andy Stewart ;; URL: ;; Keywords: gnus, notify ;; Compatibility: GNU Emacs 23.0.60.1 ;; ;; Features that might be requried by this library: ;; ;; ;; ;;; This file is NOT part of GNU Emacs ;;; License ;; ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program; see the file COPYING. If not, write to ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth ;; Floor, Boston, MA 02110-1301, USA. ;;; Commentary: ;; ;; Gnus notify ;; ;;; Installation: ;; ;; Put gnus-notify.el to your load-path. ;; The load-path is usually ~/elisp/. ;; It's set in your ~/.emacs like this: ;; (setq load-path (append (list (expand-file "~/elisp")) load-path)) ;; ;; And the following to your ~/.emacs startup file. ;; ;; (require 'gnus-notify) ;; ;; I recommand add `gnus-notify' with below hooks: ;; ;; (add-hook 'gnus-summary-exit-hook 'gnus-notify) ;; (add-hook 'gnus-group-catchup-group-hook 'gnus-notify) ;; (add-hook 'mail-notify-pre-hook 'gnus-notify) ;; ;;; Customize: ;; ;; `gnus-notify-modeline-face' is a face for notify. ;; `gnus-notify-modeline-string' is notify string. ;; `gnus-notify-timeout' is refresh cycle for notify (seconds). ;; ;; All above can cusomize easy through: ;; M-x customize-group RET gnus-notify RET ;; ;;; Change log: ;; ;; 2008/12/08 ;; * First released. ;; ;;; Acknowledgements: ;; ;; ;; ;;; TODO ;; ;; ;; ;;; Require ;;; Code: (defgroup gnus-notify nil "Display new notify message in modeline" :group 'gnus) (defface gnus-notify-modeline-face '((((class color) (background dark)) (:foreground "Gold"))) "Face for highlighting gnus news number in mode line" :group 'gnus-notify) (defcustom gnus-notify-modeline-string "Gnus" "The string that notify in modeline." :type 'string :group 'gnus-notify) (defcustom gnus-notify-timeout 113 "The timeout (second) that call `gnus-notify'." :type 'number :group 'gnus-notify) (defvar gnus-notify-string nil "The highlight string of for `gnus-notify'.") (unless (member 'gnus-notify-string global-mode-string) (setq global-mode-string (append global-mode-string (list 'gnus-notify-string)))) (defun gnus-notify () "Update gnus news and display notify message in mode-line." (interactive) (let (gnus-news-number) (force-mode-line-update t) (flet ((message (&rest args))) ;use `flet' to filter `gnus-group-g= et-new-news' (gnus-group-get-new-news)) ;output message on minibuffer to di= sturb user (setq gnus-news-number (gnus-get-unread-news-number)) (if (> gnus-news-number 0) (progn ;; the property `risky-local-variable' is a security measure for = mode line ;; variable that have properties (put 'gnus-notify-string 'risky-local-variable t) (setq gnus-notify-string (propertize (format " [%s: %d]" gnus-not= ify-modeline-string gnus-news-number) 'face 'gnus-notify-modeline-= face))) (setq gnus-notify-string "")))) (defun gnus-get-unread-news-number () "Get the total number of unread news of gnus group." (let (total-unread-news-number) (setq total-unread-news-number 0) (mapc '(lambda (g) (let* ((group (car g)) (unread (gnus-group-unread group))) (when (and (numberp unread) (> unread 0)) (setq total-unread-news-number (+ total-unread-news-number= unread))))) gnus-newsrc-alist) total-unread-news-number)) ;; Add timer to update `gnus-notify'. (run-with-timer 0 gnus-notify-timeout 'gnus-notify) (provide 'gnus-notify) ;;; gnus-notify.el ends here --=-=-=--