[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dtache b75af1b9a7 059/158: Update notification setup
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dtache b75af1b9a7 059/158: Update notification setup |
Date: |
Wed, 19 Jan 2022 18:57:56 -0500 (EST) |
branch: externals/dtache
commit b75af1b9a70ba00ef16f7f03d4e8eed8b1724d6e
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>
Update notification setup
Notification function is now defined with the variable
dtache-notification-function. Which makes it possible for users to
define their own and assign to this variable.
---
README.org | 14 +++++---------
dtache.el | 10 ++++++----
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/README.org b/README.org
index c3641cfb74..1b57eb930d 100644
--- a/README.org
+++ b/README.org
@@ -172,8 +172,8 @@ The
[[https://gitlab.com/niklaseklund/consult-dtache][consult-dtache]] package p
By default =dtache= uses the echo area to notify the user when a session has
finished. An alternative is to utilize the
[[https://github.com/jwiegley/alert][alert]] package to get a system
notification instead.
#+begin_src elisp :lexical t :results none
- (defun my/dtache-session-finish-alert (session)
- "Send an alert notification when SESSION finish."
+ (defun my/dtache-inactive-session-notification (session)
+ "Send an `alert' notification when SESSION becomes inactive."
(let ((status (dtache--session-status session))
(title
(pcase (dtache--session-status session)
@@ -186,14 +186,10 @@ By default =dtache= uses the echo area to notify the user
when a session has fin
('failure 'high))
:category 'compile
:id (pcase status
- ('success 'compile-ok)
- ('failure 'compile-fail)))))
-#+end_src
-
-With the usage of =advice= the user can override the default implantation with
the alert version.
+ ('success 'dtache-success)
+ ('failure 'dtache-failure)))))
-#+begin_src elisp :lexical t :results none
- (advice-add 'dtache-session-finish-notification :override
#'my/dtache-session-finish-alert)
+ (setq dtache-notification-function #'my/dtache-inactive-session-notification)
#+end_src
* Customization
diff --git a/dtache.el b/dtache.el
index db7628bf12..9725af6eb5 100644
--- a/dtache.el
+++ b/dtache.el
@@ -70,8 +70,10 @@
"Variable to specify the origin of the session.")
(defvar dtache-open-session-function nil
"Custom function to use to open a session.")
+(defvar dtache-notification-function #'dtache-inactive-session-notification
+ "Variable to specify notification function when a session becomes inactive.")
(defvar dtache-session-callback-function nil
- "Custom function to callback when a session finish.")
+ "Custom function to callback when a session becomes inactive.")
(defvar dtache-session-status-function nil
"Custom function to deduce the status of a session.")
(defvar dtache-compile-hooks nil
@@ -535,8 +537,8 @@ Optionally make the path LOCAL to host."
(point-max))))
(buffer-substring beginning end)))))
-(defun dtache-session-finish-notification (session)
- "Send a notification when SESSION finish."
+(defun dtache-inactive-session-notification (session)
+ "Send a notification when SESSION becomes inactive."
(let ((status (pcase (dtache--session-status session)
('success "Dtache finished")
('failure "Dtache failed")) ))
@@ -815,7 +817,7 @@ Optionally make the path LOCAL to host."
(setf (dtache--session-status session) (dtache-session-exit-code-status
session)))
;; Send notification
- (dtache-session-finish-notification session)
+ (funcall dtache-notification-function session)
;; Update session in database
(dtache--db-update-entry session t)
- [elpa] externals/dtache afb2684f38 027/158: Improve dtache-env command, (continued)
- [elpa] externals/dtache afb2684f38 027/158: Improve dtache-env command, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache c29079e0c0 047/158: Remove dtache-session-history, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache db230154e4 016/158: Merge develop branch into master, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 2a38a9b538 030/158: Robustify against failures in configuration, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 115de6c1a2 022/158: Add default value for dtache-max-command-length, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 09d378e50a 024/158: Fix read-only problematic, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 4e99fc9daa 049/158: Deprecate dtache-list-sessions, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache cb1762ffc2 052/158: Add presentation about dtache version 0.2, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 5d9c8aa54f 053/158: Add macOS support, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 01a27b4dc2 056/158: Update README with reference to consult-dtache, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache b75af1b9a7 059/158: Update notification setup,
ELPA Syncer <=
- [elpa] externals/dtache b47bc3be09 061/158: Update copyright years, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 182ab7ccc6 064/158: Add integration with consult, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache ea6d8ae426 068/158: Add missing autoloads, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache e2efe466e0 076/158: Improve error handling with dtache-valid-session, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 79f1d905a9 078/158: Add example of how to enhance a command with dtach, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache dae6db33db 083/158: Fix various minor problems, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 52e839ff4a 007/158: Update README with links, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 7e8727f3a2 020/158: Add TODO to investigate unknown inactive sessions, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache b94baaeecd 021/158: Fix bug in setup notification, ELPA Syncer, 2022/01/19
- [elpa] externals/dtache 763246bffe 026/158: Remove explicit dependency on dtache-env, ELPA Syncer, 2022/01/19