diff --git a/lisp/comint.el b/lisp/comint.el index 3804932e01c..2415435546e 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -249,6 +249,11 @@ comint-input-ignoredups :type 'boolean :group 'comint) +(defcustom remote-file-name-inhibit-input-ring nil + "If non-nil, inhibit `comint-input-ring'." + :type 'boolean + :version "30.1") + (defcustom comint-input-ring-file-name nil "If non-nil, name of the file to read/write input history. See also `comint-read-input-ring' and `comint-write-input-ring'. diff --git a/lisp/shell.el b/lisp/shell.el index e6b315ee5c0..1ed04c46cf9 100644 --- a/lisp/shell.el +++ b/lisp/shell.el @@ -726,9 +726,13 @@ shell-mode (hsize (getenv "HISTSIZE")) (hfile (getenv "HISTFILE"))) (when remote - ;; `shell-snarf-envar' does not work trustworthy. - (setq hsize (shell-command-to-string "echo -n $HISTSIZE") - hfile (shell-command-to-string "echo -n $HISTFILE"))) + (if remote-file-name-inhibit-input-ring + (setq remote nil + hsize nil + hfile nil) + ;; `shell-snarf-envar' does not work trustworthy. + (setq hsize (shell-command-to-string "echo -n $HISTSIZE") + hfile (shell-command-to-string "echo -n $HISTFILE")))) (and (string-equal hfile "") (setq hfile nil)) (and (stringp hsize) (integerp (setq hsize (string-to-number hsize)))