diff options
author | Yuri D'Elia <wavexx@users.noreply.github.com> | 2017-03-05 12:07:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-05 12:07:12 +0100 |
commit | ba78f4b9c70500acebac1817ac76cca0aab7af83 (patch) | |
tree | 02cd55e1546c526105730bec9e2a38891b33197c | |
parent | 8fd980c4a4ba18085ec87a2f0c71875c5d01087f (diff) | |
parent | 9c007b0c7595135884cad63aa27bc3cb77863ddb (diff) |
Merge pull request #8 from basil-conto/tweaks
Minor tweaks
-rw-r--r-- | gnus-desktop-notify.el | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/gnus-desktop-notify.el b/gnus-desktop-notify.el index 7c5dbd9..d6f7009 100644 --- a/gnus-desktop-notify.el +++ b/gnus-desktop-notify.el @@ -1,7 +1,8 @@ -;;; gnus-desktop-notify.el --- Gnus Desktop Notification global minor mode +;;; gnus-desktop-notify.el --- Gnus Desktop Notification global minor mode -*- lexical-binding: t -*- ;; Author: Yuri D'Elia <wavexx AT thregr.org> ;; Contributors: Philipp Haselwarter <philipp.haselwarter AT gmx.de> +;; Basil L. Contovounesios <contovob AT tcd.ie> ;; Version: 1.4 ;; URL: http://www.thregr.org/~wavexx/software/gnus-desktop-notify.el/ ;; GIT: git://src.thregr.org/gnus-desktop-notify.el/ @@ -85,6 +86,9 @@ (unless (require 'alert nil t) (require 'notifications nil t)) +(declare-function alert "alert") +(declare-function notifications-notify "notifications") + ;;; Custom variables (defgroup gnus-desktop-notify nil @@ -191,20 +195,6 @@ the notification of new messages (depending on the value of (defvar gnus-desktop-notify-counts () "Map Gnus group names to their total number of articles.") -(defvar gnus-desktop-notify-html-lut - '(("&" . "&") - ("<" . "<" ) - (">" . ">" )) - "Map special characters to their HTML entities.") - -;; FIXME: Do not reinvent the wheel if possible -(defun gnus-desktop-notify-escape-html-entities (str) - "Escape HTML character entity references." - (let* ((lut gnus-desktop-notify-html-lut) - (chars (format "[%s]" (mapconcat #'car lut "")))) - (replace-regexp-in-string - chars (lambda (s) (cdr (assoc-string s lut))) str))) - (defun gnus-desktop-notify-read-count (group) (let* ((range (gnus-range-normalize (gnus-info-read group))) (count (gnus-last-element range))) @@ -223,7 +213,7 @@ collapsing." GROUP should have the form (NAME . COUNT), where NAME is the group name to display and COUNT is the corresponding number of articles." - (let ((name (gnus-desktop-notify-escape-html-entities (car group))) + (let ((name (url-insert-entities-in-string (car group))) (count (cdr group))) (format-spec gnus-desktop-notify-format (format-spec-make ?n count @@ -246,7 +236,7 @@ multiple uniline strings." ((eq gnus-desktop-notify-behavior 'gnus-desktop-notify-multi) `(,bodies)))))) -(defun gnus-desktop-notify-check (&rest _ignored) +(defun gnus-desktop-notify-check () "Check all groups for and notify of new articles." (interactive) (let ((updated-groups ())) |