emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dtache f1447b5655: Add projectile integration example t


From: ELPA Syncer
Subject: [elpa] externals/dtache f1447b5655: Add projectile integration example to README
Date: Wed, 2 Feb 2022 08:57:36 -0500 (EST)

branch: externals/dtache
commit f1447b56550ff580d92f2e60cb838b4c6ca49db3
Author: Niklas Eklund <niklas.eklund@posteo.net>
Commit: Niklas Eklund <niklas.eklund@posteo.net>

    Add projectile integration example to README
    
    Add example on how to integrate dtache with projectile.
---
 README.org | 76 +++++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 46 insertions(+), 30 deletions(-)

diff --git a/README.org b/README.org
index 28a548001e..2b7ed1ccb2 100644
--- a/README.org
+++ b/README.org
@@ -222,36 +222,6 @@ The command =dtache-consult-session= is a replacement for 
=dtache-open-session=.
 
 Examples of the different sources are featured in this 
[[https://niklaseklund.gitlab.io/blog/posts/dtache_consult/][blog post]].
 
-** 3rd party
-*** Embark
-
-The user have the possibility to integrate =dtache= with the package 
[[https://github.com/oantolin/embark/][embark]]. The =dtache-action-map= can be 
reused for this purpose, so the user doesn't need to bind it to any key. 
Instead the user simply adds the following to their =dtache= configuration in 
order to get embark actions for =dtache-open-session=.
-
-#+begin_src elisp :lexical t :results none
-  (defvar embark-dtache-map (make-composed-keymap dtache-action-map 
embark-general-map))
-  (add-to-list 'embark-keymap-alist '(dtache . embark-dtache-map))
-#+end_src
-
-*** Alert
-
-By default =dtache= uses the built in =notifications= library to issue a 
notification. This solution uses =dbus= but if that doesn't work for the user 
there is the possibility to set the =dtache-notification-function= to 
=dtache-state-transitionion-echo-message= to use the echo area instead. If that 
doesn't suffice there is the possibility to use the 
[[https://github.com/jwiegley/alert][alert]] package to get a system 
notification instead.
-
-#+begin_src elisp :lexical t :results none
-  (defun my/dtache-state-transition-alert-notification (session)
-    "Send an `alert' notification when SESSION becomes inactive."
-    (let ((status (car (dtache--session-status session)))
-          (host (car (dtache--session-host session))))
-      (alert (dtache--session-command session)
-       :title (pcase status
-                ('success (format "Dtache finished [%s]" host))
-                ('failure (format "Dtache failed [%s]" host)))
-       :severity (pcase status
-                  ('success 'moderate)
-                  ('failure 'high)))))
-
-  (setq dtache-notification-function 
#'my/dtache-state-transition-alert-notification)
-#+end_src
-
 * Customization
 ** Customizable variables
 
@@ -356,6 +326,52 @@ For these situations =dtache= provides the 
=dtache-nonattachable-commands= varia
 
 Here a command beginning with =ls= would from now on be considered 
nonattachable.
 
+* Tips & Tricks
+** 3rd party extensions
+
+*** Embark
+
+The user have the possibility to integrate =dtache= with the package 
[[https://github.com/oantolin/embark/][embark]]. The =dtache-action-map= can be 
reused for this purpose, so the user doesn't need to bind it to any key. 
Instead the user simply adds the following to their =dtache= configuration in 
order to get embark actions for =dtache-open-session=.
+
+#+begin_src elisp :lexical t :results none
+  (defvar embark-dtache-map (make-composed-keymap dtache-action-map 
embark-general-map))
+  (add-to-list 'embark-keymap-alist '(dtache . embark-dtache-map))
+#+end_src
+
+*** Alert
+
+By default =dtache= uses the built in =notifications= library to issue a 
notification. This solution uses =dbus= but if that doesn't work for the user 
there is the possibility to set the =dtache-notification-function= to 
=dtache-state-transitionion-echo-message= to use the echo area instead. If that 
doesn't suffice there is the possibility to use the 
[[https://github.com/jwiegley/alert][alert]] package to get a system 
notification instead.
+
+#+begin_src elisp :lexical t :results none
+  (defun my/dtache-state-transition-alert-notification (session)
+    "Send an `alert' notification when SESSION becomes inactive."
+    (let ((status (car (dtache--session-status session)))
+          (host (car (dtache--session-host session))))
+      (alert (dtache--session-command session)
+       :title (pcase status
+                ('success (format "Dtache finished [%s]" host))
+                ('failure (format "Dtache failed [%s]" host)))
+       :severity (pcase status
+                  ('success 'moderate)
+                  ('failure 'high)))))
+
+  (setq dtache-notification-function 
#'my/dtache-state-transition-alert-notification)
+#+end_src
+
+*** Projectile
+
+The package can be integrated with 
[[https://github.com/bbatsov/projectile][projectile]], by overriding its 
compilation command in the following fashion.
+
+#+begin_src elisp :lexical t :results none
+  (defun my/dtache-projectile-run-compilation (cmd &optional use-comint-mode)
+    "If CMD is a string execute it with `dtache-compile', optionally 
USE-COMINT-MODE."
+    (if (functionp cmd)
+        (funcall cmd)
+      (dtache-compile cmd use-comint-mode)))
+
+  (advice-add 'projectile-run-compilation :override 
#'my/dtache-projectile-run-compilation)
+#+end_src
+
 * Versions
 
 Information about larger changes that has been made between versions can be 
found in the =CHANGELOG.org=



reply via email to

[Prev in Thread] Current Thread [Next in Thread]