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

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

[elpa] externals/detached f08110df57 2/2: Update comint-read-input-ring-


From: ELPA Syncer
Subject: [elpa] externals/detached f08110df57 2/2: Update comint-read-input-ring-advice
Date: Fri, 27 May 2022 06:57:30 -0400 (EDT)

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

    Update comint-read-input-ring-advice
    
    Instead of having the correctly set the detached-shell-history-file
    for local and remote hosts, we can make sure to use the same logic as
    in the shell function to deduce the history file based on the
    shell--start-prog.
---
 detached-shell.el | 14 ++++++++++----
 detached.el       |  2 ++
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/detached-shell.el b/detached-shell.el
index f00583bd71..62a420a450 100644
--- a/detached-shell.el
+++ b/detached-shell.el
@@ -106,10 +106,16 @@ cluttering the comint-history with dtach commands."
 (defun detached-shell--comint-read-input-ring-advice (orig-fun &rest args)
   "Set `comint-input-ring-file-name' before calling ORIG-FUN with ARGS."
   (with-connection-local-variables
-   (let ((comint-input-ring-file-name
-          (concat
-           (file-remote-p default-directory)
-           detached-shell-history-file)))
+   (let* ((history-file (cond ((string= shell--start-prog "bash") 
"~/.bash_history")
+                              ((string= shell--start-prog "ksh") 
"~/.sh_history")
+                              ((string= shell--start-prog "zsh") 
"~/.zsh_history")
+                              (t nil)))
+          (comint-input-ring-file-name
+           (if history-file
+               (concat
+                (file-remote-p default-directory)
+                history-file)
+             comint-input-ring-file-name)))
      (apply orig-fun args)
      (advice-remove 'comint-read-input-ring 
#'detached-shell--comint-read-input-ring-advice))))
 
diff --git a/detached.el b/detached.el
index 77b5fa859d..f712898e1a 100644
--- a/detached.el
+++ b/detached.el
@@ -184,6 +184,8 @@ Valid values are: create, new and attach")
   "Variable to specify the origin of the session.")
 (defvar detached-session-action nil
   "A property list of actions for a session.")
+;; TODO Consider removing `detached-shell-command-history' if the new
+;; history override solution works.
 (defvar detached-shell-command-history nil
   "History of commands run with `detached-shell-command'.")
 (defvar detached-local-session nil



reply via email to

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