From edf510d3d26ff2e61e5645a680ad9d901995f32a Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Thu, 11 May 2023 17:47:44 +0200 Subject: [PATCH] update alert Signed-off-by: Andreas Gerler --- elpa/alert-20200303.2118/alert-pkg.el | 2 - .../alert-autoloads.el | 32 ++--- elpa/alert-20221213.1619/alert-pkg.el | 2 + .../alert.el | 111 ++++++++++++------ 4 files changed, 97 insertions(+), 50 deletions(-) delete mode 100644 elpa/alert-20200303.2118/alert-pkg.el rename elpa/{alert-20200303.2118 => alert-20221213.1619}/alert-autoloads.el (71%) create mode 100644 elpa/alert-20221213.1619/alert-pkg.el rename elpa/{alert-20200303.2118 => alert-20221213.1619}/alert.el (91%) diff --git a/elpa/alert-20200303.2118/alert-pkg.el b/elpa/alert-20200303.2118/alert-pkg.el deleted file mode 100644 index 5470c6c4..00000000 --- a/elpa/alert-20200303.2118/alert-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; Generated package description from /Users/baron/.emacs.d/elpa/alert-20200303.2118/alert.el -*- no-byte-compile: t -*- -(define-package "alert" "20200303.2118" "Growl-style notification system for Emacs" '((gntp "0.1") (log4e "0.3.0") (cl-lib "0.5")) :commit "7046393272686c7a1a9b3e7f7b1d825d2e5250a6" :authors '(("John Wiegley" . "jwiegley@gmail.com")) :maintainer '("John Wiegley" . "jwiegley@gmail.com") :keywords '("notification" "emacs" "message") :url "https://github.com/jwiegley/alert") diff --git a/elpa/alert-20200303.2118/alert-autoloads.el b/elpa/alert-20221213.1619/alert-autoloads.el similarity index 71% rename from elpa/alert-20200303.2118/alert-autoloads.el rename to elpa/alert-20221213.1619/alert-autoloads.el index 102a8e9f..7192db95 100644 --- a/elpa/alert-20200303.2118/alert-autoloads.el +++ b/elpa/alert-20221213.1619/alert-autoloads.el @@ -1,4 +1,4 @@ -;;; alert-autoloads.el --- automatically extracted autoloads +;;; alert-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- ;; ;;; Code: @@ -45,19 +45,21 @@ MESSAGE is what the user will see. You may also use keyword arguments to specify additional details. Here is a full example: \(alert \"This is a message\" - :severity \\='high ;; The default severity is `normal' - :title \"Title\" ;; An optional title - :category \\='example ;; A symbol to identify the message - :mode \\='text-mode ;; Normally determined automatically - :buffer (current-buffer) ;; This is the default - :data nil ;; Unused by alert.el itself - :persistent nil ;; Force the alert to be persistent; - ;; it is best not to use this - :never-persist nil ;; Force this alert to never persist - :id \\='my-id) ;; Used to replace previous message of - ;; the same id in styles that support it - :style \\='fringe) ;; Force a given style to be used; - ;; this is only for debugging! + :severity \\='high ;; The default severity is `normal' + :title \"Title\" ;; An optional title + :category \\='example ;; A symbol to identify the message + :mode \\='text-mode ;; Normally determined automatically + :buffer (current-buffer) ;; This is the default + :data nil ;; Unused by alert.el itself + :persistent nil ;; Force the alert to be persistent; + ;; it is best not to use this + :never-persist nil ;; Force this alert to never persist + :id \\='my-id) ;; Used to replace previous message of + ;; the same id in styles that support it + :style \\='fringe) ;; Force a given style to be used; + ;; this is only for debugging! + :icon \\=\"mail-message-new\" ;; if style supports icon then add icon + ;; name or path here If no :title is given, the buffer-name of :buffer is used. If :buffer is nil, it is the current buffer at the point of call. @@ -87,7 +89,7 @@ Here are some more typical examples of usage: \(fn MESSAGE &key (SEVERITY \\='normal) TITLE ICON CATEGORY BUFFER MODE DATA STYLE PERSISTENT NEVER-PERSIST ID)" nil nil) -(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "alert" '("alert-" "x-urgen"))) +(register-definition-prefixes "alert" '("alert-" "x-urgen")) ;;;*** diff --git a/elpa/alert-20221213.1619/alert-pkg.el b/elpa/alert-20221213.1619/alert-pkg.el new file mode 100644 index 00000000..669a19f4 --- /dev/null +++ b/elpa/alert-20221213.1619/alert-pkg.el @@ -0,0 +1,2 @@ +;;; Generated package description from alert.el -*- no-byte-compile: t -*- +(define-package "alert" "20221213.1619" "Growl-style notification system for Emacs" '((gntp "0.1") (log4e "0.3.0") (cl-lib "0.5")) :commit "c762380ff71c429faf47552a83605b2578656380" :authors '(("John Wiegley" . "jwiegley@gmail.com")) :maintainers '(("John Wiegley" . "jwiegley@gmail.com")) :maintainer '("John Wiegley" . "jwiegley@gmail.com") :keywords '("notification" "emacs" "message") :url "https://github.com/jwiegley/alert") diff --git a/elpa/alert-20200303.2118/alert.el b/elpa/alert-20221213.1619/alert.el similarity index 91% rename from elpa/alert-20200303.2118/alert.el rename to elpa/alert-20221213.1619/alert.el index 349aa1fc..51af988e 100644 --- a/elpa/alert-20200303.2118/alert.el +++ b/elpa/alert-20221213.1619/alert.el @@ -6,8 +6,8 @@ ;; Created: 24 Aug 2011 ;; Updated: 16 Mar 2015 ;; Version: 1.2 -;; Package-Version: 20200303.2118 -;; Package-Commit: 7046393272686c7a1a9b3e7f7b1d825d2e5250a6 +;; Package-Version: 20221213.1619 +;; Package-Commit: c762380ff71c429faf47552a83605b2578656380 ;; Package-Requires: ((gntp "0.1") (log4e "0.3.0") (cl-lib "0.5")) ;; Keywords: notification emacs message ;; X-URL: https://github.com/jwiegley/alert @@ -137,6 +137,7 @@ ;; 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 ;; @@ -635,9 +636,8 @@ fringe gets colored whenever people chat on BitlBee: :notifier #'alert-fringe-notify :remover #'alert-fringe-restore) - +(copy-face 'mode-line 'alert-saved-mode-line-face) (defun alert-mode-line-notify (info) - (copy-face 'mode-line 'alert-saved-mode-line-face) (set-face-background 'mode-line (cdr (assq (plist-get info :severity) alert-severity-colors))) (set-face-foreground 'mode-line "white")) @@ -673,17 +673,33 @@ This is found in the Growl Extras: http://growl.info/extras.php." (defun alert-growl-notify (info) (if alert-growl-command - (let ((args - (list "--appIcon" "Emacs" - "--name" "Emacs" - "--title" (alert-encode-string (plist-get info :title)) - "--message" (alert-encode-string (plist-get info :message)) - "--priority" (number-to-string - (cdr (assq (plist-get info :severity) - alert-growl-priorities)))))) + (let* ((title (alert-encode-string (plist-get info :title))) + (priority (number-to-string + (cdr (assq (plist-get info :severity) + alert-growl-priorities)))) + (args + (cl-case system-type + ('windows-nt (mapcar + (lambda (lst) (apply #'concat lst)) + `( + ;; http://www.growlforwindows.com/gfw/help/growlnotify.aspx + ("/i:" ,(file-truename (concat invocation-directory "../share/icons/hicolor/48x48/apps/emacs.png"))) + ("/t:" ,title) + ("/p:" ,priority)))) + (t (list + "--appIcon" "Emacs" + "--name" "Emacs" + "--title" title + "--priority" priority))))) (if (and (plist-get info :persistent) (not (plist-get info :never-persist))) - (nconc args (list "--sticky"))) + (cl-case system-type + ('windows-nt (nconc args (list "/s:true"))) + (t (nconc args (list "--sticky"))))) + (let ((message (alert-encode-string (plist-get info :message)))) + (cl-case system-type + ('windows-nt (nconc args (list message))) + (t (nconc args (list "--message" message))))) (apply #'call-process alert-growl-command nil nil nil args)) (alert-message-notify info))) @@ -870,12 +886,12 @@ From https://github.com/julienXX/terminal-notifier." (alert-encode-string (plist-get info :title))))) (alert-message-notify info)) -(when (fboundp 'mac-do-applescript) +(when (fboundp 'do-applescript) ;; Use built-in AppleScript support when possible. (defun alert-osx-notifier-notify (info) - (mac-do-applescript (format "display notification %S with title %S" - (alert-encode-string (plist-get info :message)) - (alert-encode-string (plist-get info :title)))) + (do-applescript (format "display notification %S with title %S" + (alert-encode-string (plist-get info :message)) + (alert-encode-string (plist-get info :title)))) (alert-message-notify info))) (alert-define-style 'osx-notifier :title "Notify using native OSX notification" :notifier #'alert-osx-notifier-notify) @@ -973,6 +989,30 @@ This is found at https://github.com/nels-o/toaster." (alert-define-style 'toaster :title "Notify using Toaster" :notifier #'alert-toaster-notify) +(defcustom alert-termux-command (executable-find "termux-notification") + "Path to the termux-notification command. +This is found in the termux-api package, and it requires the Termux +API addon app to be installed." + :type 'file + :group 'alert) + +(defun alert-termux-notify (info) + "Send INFO using termux-notification. +Handles :TITLE and :MESSAGE keywords from the +INFO plist." + (if alert-termux-command + (let ((args (nconc + (when (plist-get info :title) + (list "-t" (alert-encode-string (plist-get info :title)))) + (list "-c" (alert-encode-string (plist-get info :message)))))) + (apply #'call-process alert-termux-command nil + (list (get-buffer-create " *termux-notification output*") t) + nil args)) + (alert-message-notify info))) + +(alert-define-style 'termux :title "Notify using termux" + :notifier #'alert-termux-notify) + ;; jww (2011-08-25): Not quite working yet ;;(alert-define-style 'frame :title "Popup buffer in a frame" ;; :notifier #'alert-frame-notify @@ -1037,19 +1077,21 @@ MESSAGE is what the user will see. You may also use keyword arguments to specify additional details. Here is a full example: \(alert \"This is a message\" - :severity \\='high ;; The default severity is `normal' - :title \"Title\" ;; An optional title - :category \\='example ;; A symbol to identify the message - :mode \\='text-mode ;; Normally determined automatically - :buffer (current-buffer) ;; This is the default - :data nil ;; Unused by alert.el itself - :persistent nil ;; Force the alert to be persistent; - ;; it is best not to use this - :never-persist nil ;; Force this alert to never persist - :id \\='my-id) ;; Used to replace previous message of - ;; the same id in styles that support it - :style \\='fringe) ;; Force a given style to be used; - ;; this is only for debugging! + :severity \\='high ;; The default severity is `normal' + :title \"Title\" ;; An optional title + :category \\='example ;; A symbol to identify the message + :mode \\='text-mode ;; Normally determined automatically + :buffer (current-buffer) ;; This is the default + :data nil ;; Unused by alert.el itself + :persistent nil ;; Force the alert to be persistent; + ;; it is best not to use this + :never-persist nil ;; Force this alert to never persist + :id \\='my-id) ;; Used to replace previous message of + ;; the same id in styles that support it + :style \\='fringe) ;; Force a given style to be used; + ;; this is only for debugging! + :icon \\=\"mail-message-new\" ;; if style supports icon then add icon + ;; name or path here If no :title is given, the buffer-name of :buffer is used. If :buffer is nil, it is the current buffer at the point of call. @@ -1091,9 +1133,11 @@ Here are some more typical examples of usage: :severity severity :category category :buffer alert-buffer + :persistent persistent :mode current-major-mode :id id - :data data)) + :data data + :persistent persistent)) matched) (if alert-log-messages @@ -1101,8 +1145,9 @@ Here are some more typical examples of usage: (unless alert-hide-all-notifications (catch 'finish - (dolist (config (append alert-user-configuration - alert-internal-configuration)) + (dolist (config (or (append alert-user-configuration + alert-internal-configuration) + (when style '(nil)))) (let* ((style-def (cdr (assq (or style (nth 1 config)) alert-styles))) (options (nth 2 config)) -- 2.47.3