emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 24fa4ff: Further work on suppressing shell history


From: Michael Albinus
Subject: [Emacs-diffs] master 24fa4ff: Further work on suppressing shell history in Tramp
Date: Tue, 03 Feb 2015 08:25:22 +0000

branch: master
commit 24fa4ff944c63cda41ea8ad041f9e434603157fc
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Further work on suppressing shell history in Tramp
    
    Fixes: debbugs:19731
    
    * net/tramp-sh.el (tramp-histfile-override): Fix docstring.
    (tramp-open-shell, tramp-maybe-open-connection): Set also
    HISTFILESIZE and HISTSIZE when needed.
---
 lisp/ChangeLog       |    6 ++++++
 lisp/net/tramp-sh.el |   33 +++++++++++++++++++--------------
 2 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 77361bc..80ee86a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-03  Michael Albinus  <address@hidden>
+
+       * net/tramp-sh.el (tramp-histfile-override): Fix docstring.
+       (tramp-open-shell, tramp-maybe-open-connection): Set also
+       HISTFILESIZE and HISTSIZE when needed.  (Bug#19731)
+
 2015-02-02  Artur Malabarba  <address@hidden>
 
        * emacs-lisp/package.el (package--find-non-dependencies): New
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 8e519b1..9c8a222 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -71,10 +71,11 @@ When setting to a string, it redirects the shell history to 
that
 file.  Be careful when setting to \"/dev/null\"; this might
 result in undesired results when using \"bash\" as shell.
 
-The value t, the default value, unsets any setting of HISTFILE.
-If you set this variable to nil, however, the *override* is
-disabled, so the history will go to the default storage
-location, e.g. \"$HOME/.sh_history\"."
+The value t, the default value, unsets any setting of HISTFILE,
+and sets both HISTFILESIZE and HISTSIZE to 0.  If you set this
+variable to nil, however, the *override* is disabled, so the
+history will go to the default storage location,
+e.g. \"$HOME/.sh_history\"."
   :group 'tramp
   :version "25.1"
   :type '(choice (const :tag "Do not override HISTFILE" nil)
@@ -3901,15 +3902,16 @@ file exists and nonzero exit status otherwise."
       ;; when called as sh) on startup; this way, we avoid the startup
       ;; file clobbering $PS1.  $PROMPT_COMMAND is another way to set
       ;; the prompt in /bin/bash, it must be discarded as well.
+      ;; $HISTFILE is set according to `tramp-histfile-override'.
       (tramp-send-command
        vec (format
            "exec env ENV='' %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s"
-            (if tramp-histfile-override
-                (concat
-                "HISTFILE="
-                (if (stringp tramp-histfile-override)
-                    (tramp-shell-quote-argument tramp-histfile-override) ""))
-              "")
+           (if (stringp tramp-histfile-override)
+               (format "HISTFILE=%s"
+                       (tramp-shell-quote-argument tramp-histfile-override))
+             (if tramp-histfile-override
+                 "HISTFILE='' HISTFILESIZE=0 HISTSIZE=0"
+               ""))
            (tramp-shell-quote-argument tramp-end-of-output)
            shell (or extra-args ""))
        t))
@@ -4631,10 +4633,13 @@ connection if a previous connection has died for some 
reason."
                (delete-process p))
              (setenv "TERM" tramp-terminal-type)
              (setenv "LC_ALL" "en_US.utf8")
-             (when tramp-histfile-override
-                (setenv "HISTFILE"
-                       (and (stringp tramp-histfile-override)
-                            tramp-histfile-override)))
+             (if (stringp tramp-histfile-override)
+                 (setenv "HISTFILE" tramp-histfile-override)
+               (if tramp-histfile-override
+                   (progn
+                     (setenv "HISTFILE")
+                     (setenv "HISTFILESIZE" "0")
+                     (setenv "HISTSIZE" "0"))))
              (setenv "PROMPT_COMMAND")
              (setenv "PS1" tramp-initial-end-of-output)
              (let* ((target-alist (tramp-compute-multi-hops vec))



reply via email to

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