diff options
| author | Michael Albinus | 2015-02-03 09:24:57 +0100 |
|---|---|---|
| committer | Michael Albinus | 2015-02-03 09:24:57 +0100 |
| commit | 24fa4ff944c63cda41ea8ad041f9e434603157fc (patch) | |
| tree | 73659bef2af3f2bd4b0222fb40789ab12c640779 | |
| parent | 1905cb763738396e16849006ffb07b24c9795b4d (diff) | |
| download | emacs-24fa4ff944c63cda41ea8ad041f9e434603157fc.tar.gz emacs-24fa4ff944c63cda41ea8ad041f9e434603157fc.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 33 |
2 files changed, 25 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 77361bc3a01..80ee86ac958 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2015-02-03 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/tramp-sh.el (tramp-histfile-override): Fix docstring. | ||
| 4 | (tramp-open-shell, tramp-maybe-open-connection): Set also | ||
| 5 | HISTFILESIZE and HISTSIZE when needed. (Bug#19731) | ||
| 6 | |||
| 1 | 2015-02-02 Artur Malabarba <bruce.connor.am@gmail.com> | 7 | 2015-02-02 Artur Malabarba <bruce.connor.am@gmail.com> |
| 2 | 8 | ||
| 3 | * emacs-lisp/package.el (package--find-non-dependencies): New | 9 | * emacs-lisp/package.el (package--find-non-dependencies): New |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 8e519b13e5f..9c8a222285c 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 | |||
| 71 | file. Be careful when setting to \"/dev/null\"; this might | 71 | file. Be careful when setting to \"/dev/null\"; this might |
| 72 | result in undesired results when using \"bash\" as shell. | 72 | result in undesired results when using \"bash\" as shell. |
| 73 | 73 | ||
| 74 | The value t, the default value, unsets any setting of HISTFILE. | 74 | The value t, the default value, unsets any setting of HISTFILE, |
| 75 | If you set this variable to nil, however, the *override* is | 75 | and sets both HISTFILESIZE and HISTSIZE to 0. If you set this |
| 76 | disabled, so the history will go to the default storage | 76 | variable to nil, however, the *override* is disabled, so the |
| 77 | location, e.g. \"$HOME/.sh_history\"." | 77 | history will go to the default storage location, |
| 78 | e.g. \"$HOME/.sh_history\"." | ||
| 78 | :group 'tramp | 79 | :group 'tramp |
| 79 | :version "25.1" | 80 | :version "25.1" |
| 80 | :type '(choice (const :tag "Do not override HISTFILE" nil) | 81 | :type '(choice (const :tag "Do not override HISTFILE" nil) |
| @@ -3901,15 +3902,16 @@ file exists and nonzero exit status otherwise." | |||
| 3901 | ;; when called as sh) on startup; this way, we avoid the startup | 3902 | ;; when called as sh) on startup; this way, we avoid the startup |
| 3902 | ;; file clobbering $PS1. $PROMPT_COMMAND is another way to set | 3903 | ;; file clobbering $PS1. $PROMPT_COMMAND is another way to set |
| 3903 | ;; the prompt in /bin/bash, it must be discarded as well. | 3904 | ;; the prompt in /bin/bash, it must be discarded as well. |
| 3905 | ;; $HISTFILE is set according to `tramp-histfile-override'. | ||
| 3904 | (tramp-send-command | 3906 | (tramp-send-command |
| 3905 | vec (format | 3907 | vec (format |
| 3906 | "exec env ENV='' %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s" | 3908 | "exec env ENV='' %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s" |
| 3907 | (if tramp-histfile-override | 3909 | (if (stringp tramp-histfile-override) |
| 3908 | (concat | 3910 | (format "HISTFILE=%s" |
| 3909 | "HISTFILE=" | 3911 | (tramp-shell-quote-argument tramp-histfile-override)) |
| 3910 | (if (stringp tramp-histfile-override) | 3912 | (if tramp-histfile-override |
| 3911 | (tramp-shell-quote-argument tramp-histfile-override) "")) | 3913 | "HISTFILE='' HISTFILESIZE=0 HISTSIZE=0" |
| 3912 | "") | 3914 | "")) |
| 3913 | (tramp-shell-quote-argument tramp-end-of-output) | 3915 | (tramp-shell-quote-argument tramp-end-of-output) |
| 3914 | shell (or extra-args "")) | 3916 | shell (or extra-args "")) |
| 3915 | t)) | 3917 | t)) |
| @@ -4631,10 +4633,13 @@ connection if a previous connection has died for some reason." | |||
| 4631 | (delete-process p)) | 4633 | (delete-process p)) |
| 4632 | (setenv "TERM" tramp-terminal-type) | 4634 | (setenv "TERM" tramp-terminal-type) |
| 4633 | (setenv "LC_ALL" "en_US.utf8") | 4635 | (setenv "LC_ALL" "en_US.utf8") |
| 4634 | (when tramp-histfile-override | 4636 | (if (stringp tramp-histfile-override) |
| 4635 | (setenv "HISTFILE" | 4637 | (setenv "HISTFILE" tramp-histfile-override) |
| 4636 | (and (stringp tramp-histfile-override) | 4638 | (if tramp-histfile-override |
| 4637 | tramp-histfile-override))) | 4639 | (progn |
| 4640 | (setenv "HISTFILE") | ||
| 4641 | (setenv "HISTFILESIZE" "0") | ||
| 4642 | (setenv "HISTSIZE" "0")))) | ||
| 4638 | (setenv "PROMPT_COMMAND") | 4643 | (setenv "PROMPT_COMMAND") |
| 4639 | (setenv "PS1" tramp-initial-end-of-output) | 4644 | (setenv "PS1" tramp-initial-end-of-output) |
| 4640 | (let* ((target-alist (tramp-compute-multi-hops vec)) | 4645 | (let* ((target-alist (tramp-compute-multi-hops vec)) |