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

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

[elpa] externals/dtache cd2b19e66e: Add last command as initial input


From: ELPA Syncer
Subject: [elpa] externals/dtache cd2b19e66e: Add last command as initial input
Date: Sat, 5 Feb 2022 07:57:25 -0500 (EST)

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

    Add last command as initial input
    
    This commit adds the last command used in dtache-shell-command as
    initial input next time dtache-shell-command is called. This will only
    apply when dtache-shell-command is called as a command, and not when
    called as a function.
    
    Its possible to opt out of this feature by setting
    dtache-shell-command-initial-input to nil.
---
 README.org | 37 +++++++++++++++++++------------------
 dtache.el  | 16 +++++++++++++---
 2 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/README.org b/README.org
index 2b7ed1ccb2..833a293414 100644
--- a/README.org
+++ b/README.org
@@ -76,8 +76,8 @@ A minimal configuration for =dtache=.
 
 There are tree different ways to create a dtache session.
 
-| Function                   | Description                   |
-|----------------------------+-------------------------------|
+| Function                 | Description                   |
+|--------------------------+-------------------------------|
 | =dtache-shell-command=     | Called from M-x               |
 | =dtache-shell-send-input=  | Called from inside M-x shell  |
 | =dtache-eshell-send-input= | Called from inside eshell     |
@@ -227,25 +227,26 @@ Examples of the different sources are featured in this 
[[https://niklaseklund.gi
 
 The package provides the following customizable variables.
 
-| Name                          | Description                                  
                |
-|-------------------------------+--------------------------------------------------------------|
-| dtache-session-directory      | A host specific directory to store sessions 
in               |
-| dtache-db-directory           | A localhost specific directory to store the 
database         |
-| dtache-dtach-program          | Name or path to the =dtach= program          
                |
-| dtache-shell-program          | Name or path to the =shell= that =dtache= 
should use         |
-| dtache-timer-configuration    | Configuration of the timer that runs on 
remote hosts         |
-| dtache-env                    | Name or path to the =dtache-env= script      
                |
-| dtache-annotation-format      | A list of annotations that should be present 
in completion   |
-| dtache-max-command-length     | How many characters should be used when 
displaying a command |
-| dtache-tail-interval          | How often =dtache= should refresh the output 
when tailing    |
-| dtache-nonattachable-commands | A list of commands that should be considered 
nonattachable   |
-| dtache-notification-function  | Specifies which function to issue 
notifications with         |
-| dtache-detach-key             | Specifies which keybinding to use to detach 
from a session   |
+| Name                               | Description                             
                     |
+|------------------------------------+--------------------------------------------------------------|
+| dtache-session-directory           | A host specific directory to store 
sessions in               |
+| dtache-db-directory                | A localhost specific directory to store 
the database         |
+| dtache-dtach-program               | Name or path to the =dtach= program     
                       |
+| dtache-shell-program               | Name or path to the =shell= that 
=dtache= should use             |
+| dtache-timer-configuration         | Configuration of the timer that runs on 
remote hosts         |
+| dtache-env                         | Name or path to the =dtache-env= script 
                       |
+| dtache-annotation-format           | A list of annotations that should be 
present in completion   |
+| dtache-max-command-length          | How many characters should be used when 
displaying a command |
+| dtache-tail-interval               | How often =dtache= should refresh the 
output when tailing      |
+| dtache-nonattachable-commands      | A list of commands that should be 
considered nonattachable   |
+| dtache-notification-function       | Specifies which function to issue 
notifications with         |
+| dtache-detach-key                  | Specifies which keybinding to use to 
detach from a session   |
+| dtache-shell-command-initial-input | Enables latest value in history to be 
used as initial input  |
 
 Apart from those variables there is also the different =action= variables, 
which can be configured differently depending on the origin of the session.
 
-| Name                                | Description                            
                       |
-|-------------------------------------+---------------------------------------------------------------|
+| Name                                | Description                            
                     |
+|-------------------------------------+-------------------------------------------------------------|
 | dtache-shell-command-session-action | Actions for sessions launched with 
=dtache-shell-command=     |
 | dtache-eshell-session-action        | Actions for sessions launched with 
=dtache-eshell-send-input= |
 | dtache-shell-session-action         | Actions for sessions launched with 
=dtache-shell-send-input=  |
diff --git a/dtache.el b/dtache.el
index 4780101c9e..5d583fdd84 100644
--- a/dtache.el
+++ b/dtache.el
@@ -108,8 +108,16 @@
             :view dtache-view-dwim
             :run dtache-shell-command)
   "Actions for a session created with `dtache-shell-command'."
-  :group 'dtache
-  :type 'plist)
+  :type 'plist
+  :group 'dtache)
+
+(defcustom dtache-shell-command-initial-input t
+  "Variable to control initial command input for `dtache-shell-command'.
+If set to a non nil value the latest entry to
+`dtache-shell-command-history' will be used as the initial input in
+`dtache-shell-command' when it is used as a command."
+  :type 'bool
+  :group 'dtache)
 
 (defcustom dtache-nonattachable-commands nil
   "A list of commands which `dtache' should consider nonattachable."
@@ -265,7 +273,9 @@ Optionally SUPPRESS-OUTPUT if prefix-argument is provided."
                                             (abbreviate-file-name
                                              default-directory))
                           "Dtache shell command: ")
-                        nil 'dtache-shell-command-history)
+                        (when dtache-shell-command-initial-input
+                          (car dtache-shell-command-history))
+                        'dtache-shell-command-history)
     current-prefix-arg))
   (let* ((dtache-session-origin 'shell-command)
          (dtache-session-action dtache-shell-command-session-action)



reply via email to

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