From 281fca36b70d0b5fdc5bc3756f8ce013e5343b96 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Sun, 26 Apr 2026 18:32:54 +0200 Subject: [PATCH] update alert --- elpa/alert-20260316.2025/README-elpa | 158 ++++++++++++ .../alert-autoloads.el | 8 +- .../alert-pkg.el | 6 +- .../alert.el | 24 +- elpa/elfeed-20241202.22/xml-query.el | 232 ------------------ 5 files changed, 185 insertions(+), 243 deletions(-) create mode 100644 elpa/alert-20260316.2025/README-elpa rename elpa/{alert-20250823.650 => alert-20260316.2025}/alert-autoloads.el (96%) rename elpa/{alert-20250823.650 => alert-20260316.2025}/alert-pkg.el (75%) rename elpa/{alert-20250823.650 => alert-20260316.2025}/alert.el (98%) delete mode 100644 elpa/elfeed-20241202.22/xml-query.el diff --git a/elpa/alert-20260316.2025/README-elpa b/elpa/alert-20260316.2025/README-elpa new file mode 100644 index 00000000..fda70156 --- /dev/null +++ b/elpa/alert-20260316.2025/README-elpa @@ -0,0 +1,158 @@ +Alert is a Growl-workalike for Emacs which uses a common notification +interface and multiple, selectable "styles", whose use is fully +customizable by the user. + +* For module writers + +Just use `alert' instead of `message' as follows: + + (require 'alert) + + ;; This is the most basic form usage + (alert "This is an alert") + + ;; You can adjust the severity for more important messages + (alert "This is an alert" :severity 'high) + + ;; Or decrease it for purely informative ones + (alert "This is an alert" :severity 'trivial) + + ;; Alerts can have optional titles. Otherwise, the title is the + ;; buffer-name of the (current-buffer) where the alert originated. + (alert "This is an alert" :title "My Alert") + + ;; Further, alerts can have categories. This allows users to + ;; selectively filter on them. + (alert "This is an alert" :title "My Alert" :category 'debug) + +* For users + +For the user, there are several variables to control when and how alerts +are presented. By default, they appear in the minibuffer much the same +as a normal Emacs message. But there are many more possibilities: + + `alert-fade-time' + Normally alerts disappear after this many seconds, if the style + supports it. The default is 5 seconds. + + `alert-default-style' + Pick the style to use if no other config rule matches. The + default is `message', but `growl' works well too. + + `alert-reveal-idle-time' + If a config rule choose to match on `idle', this is how many + seconds idle the user has to be. Defaults to 5 so that users + don't miss any alerts, but 120 is also good. + + `alert-persist-idle-time' + After this many idle seconds, alerts will become sticky, and not + fade away more. The default is 15 minutes. + + `alert-log-messages' + By default, all alerts are logged to *Alerts* (and to *Messages*, + if the `message' style is being used). Set to nil to disable. + + `alert-hide-all-notifications' + Want alerts off entirely? They still get logged, however, unless + you've turned that off too. + + `alert-user-configuration' + This variable lets you control exactly how and when a particular + alert, a class of alerts, or all alerts, get reported -- or if at + all. Use this to make some alerts use Growl, while others are + completely silent. + +* Programmatically adding rules + +Users can also programmatically add configuration rules, in addition to +customizing `alert-user-configuration'. Here is one that the author +currently uses with ERC, so that the fringe gets colored whenever people +chat on BitlBee: + + (alert-add-rule :status '(buried visible idle) + :severity '(moderate high urgent) + :mode 'erc-mode + :predicate + #'(lambda (info) + (string-match (concat "\\`[^&].*@BitlBee\\'") + (erc-format-target-and/or-network))) + :persistent + #'(lambda (info) + ;; If the buffer is buried, or the user has been + ;; idle for `alert-reveal-idle-time' seconds, + ;; make this alert persistent. Normally, alerts + ;; become persistent after + ;; `alert-persist-idle-time' seconds. + (memq (plist-get info :status) '(buried idle))) + :style 'fringe + :continue t) + +* Builtin alert styles + +There are several builtin styles, and it is trivial to create new ones. +The builtins are: + + fringe - Changes the current frame's fringe background color + mode-line - Changes the current frame's mode-line background color + gntp - Uses gntp, it requires gntp.el (see https://github.com/tekai/gntp.el) + growl - Uses Growl on OS X, if growlnotify is on the PATH + ignore - Ignores the alert entirely + libnotify - Uses libnotify if notify-send is on the PATH + log - Logs the alert text to *Alerts*, with a timestamp + message - Uses the Emacs `message' facility + momentary - Uses the Emacs `momentary-string-display' facility + notifications - Uses notifications library via D-Bus + notifier - Uses terminal-notifier on OS X, if it is on the PATH + osx-notifier - Native OSX notifier using AppleScript + toaster - Use the toast notification system + x11 - Changes the urgency property of the window in the X Window System + termux - Use termux-notification from the Termux API + +* Defining new styles + +To create a new style, you need to at least write a "notifier", which is +a function that receives the details of the alert. These details are +given in a plist which uses various keyword to identify the parts of the +alert. Here is a prototypical style definition: + + (alert-define-style 'style-name :title "My Style's title" + :notifier + (lambda (info) + ;; The message text is :message + (plist-get info :message) + ;; The :title of the alert + (plist-get info :title) + ;; The :category of the alert + (plist-get info :category) + ;; The major-mode this alert relates to + (plist-get info :mode) + ;; The buffer the alert relates to + (plist-get info :buffer) + ;; Severity of the alert. It is one of: + ;; `urgent' + ;; `high' + ;; `moderate' + ;; `normal' + ;; `low' + ;; `trivial' + (plist-get info :severity) + ;; Whether this alert should persist, or fade away + (plist-get info :persistent) + ;; Data which was passed to `alert'. Can be + ;; anything. + (plist-get info :data)) + + ;; Removers are optional. Their job is to remove + ;; the visual or auditory effect of the alert. + :remover + (lambda (info) + ;; It is the same property list that was passed to + ;; the notifier function. + )) + +You can test a specific style with something like this: + +(let ((alert-user-configuration '((((:severity high)) momentary nil)))) + (alert "Same buffer momentary alert" :title "My Alert" :severity 'high) + (alert "This is a momentary alert in another visible buffer" :title "My Alert" + :severity 'high :buffer (other-buffer (current-buffer) t))) diff --git a/elpa/alert-20250823.650/alert-autoloads.el b/elpa/alert-20260316.2025/alert-autoloads.el similarity index 96% rename from elpa/alert-20250823.650/alert-autoloads.el rename to elpa/alert-20260316.2025/alert-autoloads.el index e5a40af6..bbb102de 100644 --- a/elpa/alert-20250823.650/alert-autoloads.el +++ b/elpa/alert-20260316.2025/alert-autoloads.el @@ -11,8 +11,8 @@ ;;; Generated autoloads from alert.el -(autoload 'alert-add-rule "alert" "\ -Programmatically add an alert configuration rule. +(autoload 'alert-add-rule "alert" +"Programmatically add an alert configuration rule. Normally, users should custoimze `alert-user-configuration'. This facility is for module writers and users that need to do @@ -40,8 +40,8 @@ fringe gets colored whenever people chat on BitlBee: :continue t) (fn &key SEVERITY STATUS MODE CATEGORY TITLE MESSAGE PREDICATE ICON (STYLE alert-default-style) PERSISTENT CONTINUE NEVER-PERSIST APPEND)") -(autoload 'alert "alert" "\ -Alert the user that something has happened. +(autoload 'alert "alert" +"Alert the user that something has happened. MESSAGE is what the user will see. You may also use keyword arguments to specify additional details. Here is a full example: diff --git a/elpa/alert-20250823.650/alert-pkg.el b/elpa/alert-20260316.2025/alert-pkg.el similarity index 75% rename from elpa/alert-20250823.650/alert-pkg.el rename to elpa/alert-20260316.2025/alert-pkg.el index 3901c368..ae96c1f2 100644 --- a/elpa/alert-20250823.650/alert-pkg.el +++ b/elpa/alert-20260316.2025/alert-pkg.el @@ -1,12 +1,12 @@ ;; -*- no-byte-compile: t; lexical-binding: nil -*- -(define-package "alert" "20250823.650" +(define-package "alert" "20260316.2025" "Growl-style notification system for Emacs." '((gntp "0.1") (log4e "0.3.0") (cl-lib "0.5")) :url "https://github.com/jwiegley/alert" - :commit "79f6936ab4d85227530959811143429347a6971b" - :revdesc "79f6936ab4d8" + :commit "fb8f1fc7f769d7b3ed93b47bd8252f2947c96d9c" + :revdesc "fb8f1fc7f769" :keywords '("notification" "emacs" "message") :authors '(("John Wiegley" . "jwiegley@gmail.com")) :maintainers '(("John Wiegley" . "jwiegley@gmail.com"))) diff --git a/elpa/alert-20250823.650/alert.el b/elpa/alert-20260316.2025/alert.el similarity index 98% rename from elpa/alert-20250823.650/alert.el rename to elpa/alert-20260316.2025/alert.el index f2828d5f..bf9ebb64 100644 --- a/elpa/alert-20250823.650/alert.el +++ b/elpa/alert-20260316.2025/alert.el @@ -5,8 +5,8 @@ ;; Author: John Wiegley ;; Created: 24 Aug 2011 ;; Updated: 16 Mar 2015 -;; Package-Version: 20250823.650 -;; Package-Revision: 79f6936ab4d8 +;; Package-Version: 20260316.2025 +;; Package-Revision: fb8f1fc7f769 ;; Package-Requires: ((gntp "0.1") (log4e "0.3.0") (cl-lib "0.5")) ;; Keywords: notification emacs message ;; X-URL: https://github.com/jwiegley/alert @@ -201,6 +201,22 @@ ;; shut up the byte compiler (declare-function alert-gntp-notify "alert") (declare-function alert-notifications-notify "alert") +(declare-function x-change-window-property "xfns.c") +(declare-function x-window-property "xfns.c") +(declare-function notifications-notify "notifications") +(declare-function notifications-close-notification "notifications") +(declare-function do-applescript "nsfns.m") + +;; Functions generated dynamically by log4e:deflogger +(declare-function alert--log-set-level "alert") +(declare-function alert--log-enable-logging "alert") +(declare-function alert--log-clear-log "alert") +(declare-function alert--log-fatal "alert") +(declare-function alert--log-error "alert") +(declare-function alert--log-warn "alert") +(declare-function alert--log-info "alert") +(declare-function alert--log-debug "alert") +(declare-function alert--log-trace "alert") (defgroup alert nil "Notification system for Emacs similar to Growl" @@ -420,7 +436,7 @@ These details are given in a plist which uses various keyword to identify the parts of the alert. Here is a prototypical style definition: -\(alert-define-style 'style-name :title \"My Style's title\" +\(alert-define-style \\='style-name :title \"My Style\\='s title\" :notifier (lambda (info) ;; The message text is :message @@ -834,7 +850,7 @@ by the `notifications' style.") :urgency (cdr (assq (plist-get info :severity) alert-notifications-priorities)) :actions '("default" "Open corresponding buffer") - :on-action (lambda (id action) + :on-action (lambda (_id action) (when (string= action "default") (switch-to-buffer (plist-get info :buffer))))))) (when (plist-get info :id) diff --git a/elpa/elfeed-20241202.22/xml-query.el b/elpa/elfeed-20241202.22/xml-query.el deleted file mode 100644 index 875e5e70..00000000 --- a/elpa/elfeed-20241202.22/xml-query.el +++ /dev/null @@ -1,232 +0,0 @@ -;; -*- lexical-binding: t; -*- -;;; xml-query.el --- query engine complimenting the xml package - -;; This is free and unencumbered software released into the public domain. - -;;; Commentary: - -;; This provides a very rudimentary, jQuery-like, XML selector -;; s-expression language. It operates on the output of the xml -;; package, such as `xml-parse-region' and `xml-parse-file'. It was -;; written to support Elfeed. - -;; See the docstring for `xml-query-all'. - -;; The macro forms, `xml-query*' and `xml-query-all*', are an order of -;; magnitude faster, but only work on static selectors and need the -;; namespaces to be pre-stripped. - -;; Examples: - -;; This query grabs the top-level paragraph content from XHTML. - -;; (xml-query-all '(html body p *) xhtml) - -;; This query extracts all the links from an Atom feed. - -;; (xml-query-all '(feed entry link [rel "alternate"] :href) xml) - -;;; Code: - -(require 'cl-lib) - -(defun xml-query-strip-ns (tag) - "Remove the namespace, if any, from TAG." - (when (symbolp tag) - (let ((name (symbol-name tag))) - (if (cl-find ?\: name) - (intern (replace-regexp-in-string "^.+:" "" name)) - tag)))) - -(defun xml-query--tag-all (match xml) - (cl-loop for (tag attribs . content) in (cl-remove-if-not #'listp xml) - when (or (eq tag match) (eq (xml-query-strip-ns tag) match)) - collect (cons tag (cons attribs content)))) - -(defun xml-query--attrib-all (attrib value xml) - (cl-loop for (tag attribs . content) in (cl-remove-if-not #'listp xml) - when (equal (cdr (assoc attrib attribs)) value) - collect (cons tag (cons attribs content)))) - -(defun xml-query--keyword (matcher xml) - (cl-loop with match = (intern (substring (symbol-name matcher) 1)) - for (tag attribs . content) in (cl-remove-if-not #'listp xml) - when (cdr (assoc match attribs)) - collect it)) - -(defun xml-query--symbol (matcher xml) - (xml-query--tag-all matcher xml)) - -(defun xml-query--vector (matcher xml) - (let ((attrib (aref matcher 0)) - (value (aref matcher 1))) - (xml-query--attrib-all attrib value xml))) - -(defun xml-query--list (matchers xml) - (cl-loop for matcher in matchers - append (xml-query-all (if (listp matcher) - matcher - (list matcher)) xml))) - -(defun xml-query--append (xml) - (cl-loop for (tag attribs . content) in (cl-remove-if-not #'listp xml) - append content)) - -(defun xml-query--stringp (thing) - "Return non-nil of THING is a non-blank string." - (and (stringp thing) (string-match "[^ \t\r\n]" thing))) - -(defun xml-query-all (query xml) - "Given a list of tags, XML, apply QUERY and return a list of -matching tags. - -A query is a list of matchers. - - SYMBOL: filters to matching tags - - LIST: each element is a full sub-query, whose results are concatenated - - VECTOR: filters to tags with matching attribute, [tag attrib value] - - KEYWORD: filters to an attribute value (must be last) - - * (an asterisk symbol): filters to content strings (must be last) - -For example, to find all the \"alternate\" link URL in a typical -Atom feed: - - (xml-query-all \\='(feed entry link [rel \"alternate\"] :href) xml)" - (if (null query) - xml - (cl-destructuring-bind (matcher . rest) query - (cond - ((keywordp matcher) (xml-query--keyword matcher xml)) - ((eq matcher '*) - (cl-remove-if-not #'xml-query--stringp (xml-query--append xml))) - (:else - (let ((matches - (cl-etypecase matcher - (symbol (xml-query--symbol matcher xml)) - (vector (xml-query--vector matcher xml)) - (list (xml-query--list matcher xml))))) - (cond - ((null rest) matches) - ((and (or (symbolp (car rest)) - (listp (car rest))) - (not (keywordp (car rest))) - (not (eq '* (car rest)))) - (xml-query-all (cdr query) (xml-query--append matches))) - (:else (xml-query-all rest matches))))))))) - -(defun xml-query (query xml) - "Like `xml-query-all' but only return the first result." - (let ((result (xml-query-all query xml))) - (if (xml-query--stringp result) - result - (car (xml-query-all query xml))))) - -;; Macro alternatives: - -;; This is a slightly less capable alternative with significantly -;; better performance (x10 speedup) that requires a static selector. -;; The selector is compiled into Lisp code via macro at compile-time, -;; which is then carried through to byte-code by the compiler. In -;; byte-code form, the macro performs no function calls other than -;; `throw' in the case of `xml-query*', where it's invoked less than -;; once per evaluation (only on success). - -;; Queries are compiled tail-to-head with a result handler at the -;; deepest level. The generated code makes multiple bindings of the -;; variable "v" as it dives deeper into the query, using the layers of -;; bindings as a breadcrumb stack. - -;; For `xml-query*', which has a single result, the whole expression -;; is wrapped in a catch, and the first successful match is thrown to -;; it from the result handler. - -;; For `xml-query-all*', the result is pushed into an output list. - -(defun xml-query--compile-tag (tag subexp subloop-p) - `(when (and (consp v) (eq (car v) ',tag)) - ,(if subloop-p - `(dolist (v (cddr v)) - ,subexp) - subexp))) - -(defun xml-query--compile-attrib (pair subexp subloop-p) - `(let ((value (cdr (assq ',(aref pair 0) (cadr v))))) - (when (equal value ,(aref pair 1)) - ,(if subloop-p - `(dolist (v (cddr v)) - ,subexp) - subexp)))) - -(defun xml-query--compile-keyword (keyword subexp) - (let ((attrib (intern (substring (symbol-name keyword) 1)))) - `(let ((v (cdr (assq ',attrib (cadr v))))) - (when v - ,subexp)))) - -(defun xml-query--compile-star (subexp) - `(when (and (stringp v) (string-match "[^ \t\r\n]" v)) - ,subexp)) - -(defun xml-query--compile-top (query input subexp) - (let* ((rquery (reverse query)) - (prev nil)) - (while rquery - (let ((matcher (pop rquery)) - ;; Should the next item loop over its children? - (subloop-p (and (not (null prev)) - (not (keywordp prev)) - (symbolp prev)))) - (cond - ((eq '* matcher) - (setf subexp (xml-query--compile-star subexp))) - ((keywordp matcher) - (setf subexp (xml-query--compile-keyword matcher subexp))) - ((symbolp matcher) - (setf subexp (xml-query--compile-tag matcher subexp subloop-p))) - ((vectorp matcher) - (setf subexp (xml-query--compile-attrib matcher subexp subloop-p))) - ((error "Bad query: %S" query))) - (setf prev matcher))) - `(dolist (v ,input) - ,subexp))) - -(defun xml-query--compile (query input) - (let ((tag (make-symbol "done"))) - `(catch ',tag - ,(xml-query--compile-top query input `(throw ',tag v))))) - -(defmacro xml-query* (query sexp) - "Like `xml-query' but generate code to execute QUERY on SEXP. - -Unlike `xml-query', QUERY must be a static, compile-time -s-expression. See `xml-query-all*' for more information. - -QUERY is *not* evaluated, so it should not be quoted." - (xml-query--compile query sexp)) - -(defun xml-query-all--compile (query input) - (let ((output (make-symbol "output"))) - `(let ((,output ())) - ,(xml-query--compile-top query input `(push v ,output)) - (nreverse ,output)))) - -(defmacro xml-query-all* (query sexp) - "Like `xml-query-all' but generate code to execute QUERY on SEXP. - -Unlike `xml-query-all', QUERY must be a static, compile-time -s-expression. This macro compiles the query into actual code. The -result is faster since the query will be compiled into byte-code -rather than \"interpreted\" at run time. - -Also unlike `xml-query-all', the parsed XML s-expression must -also have its namespace pre-stripped. This is accomplished by -setting the optional PARSE-NS argument of `xml-parse-region' to -symbol-qnames. - -Sub-expression lists are not supported by this macro. - -QUERY is *not* evaluated, so it should not be quoted." - (xml-query-all--compile query sexp)) - -(provide 'xml-query) - -;;; xml-query.el ends here -- 2.47.3