* doc/emacs/custom.texi (Connection Variables):
Mention `permanent-local' symbol property.
* lisp/net/tramp-sh.el (tramp-histfile-override):
Add ;;;###tramp-autoload cookie and `permanent-local' symbol
property.
* lisp/net/tramp.el (tramp-handle-make-process):
Obey `tramp-histfile-override'. (Bug#71049)
(cherry picked from commit
063b67325b4e00a31c1178b340529a94e0de1c4e)
and setting these profiles to criteria which could match in parallel.
It is unspecified which variable value is used then.
+ Be also careful when setting connection-local variables in a buffer,
+which changes its major mode afterwards. Because all buffer-local
+variables will be killed when changing the major mode, the
+connection-local variable's value would be lost. You can prevent this
+by setting the respective variable's @code{permanent-local} symbol
+property to non-@code{nil}.
+
@node Key Bindings
@section Customizing Key Bindings
@cindex key bindings
:group 'tramp
:type '(choice (const nil) integer))
+;;;###tramp-autoload
(defcustom tramp-histfile-override "~/.tramp_history"
"When invoking a shell, override the HISTFILE with this value.
When setting to a string, it redirects the shell history to that
(const :tag "Unset HISTFILE" t)
(string :tag "Redirect to a file")))
+(put 'tramp-histfile-override 'permanent-local t)
+
;; ksh on OpenBSD 4.5 requires that $PS1 contains a `#' character for
;; root users. It uses the `$' character for other users. In order
;; to guarantee a proper prompt, we use "#$ " for the prompt.
(string-join (tramp-get-remote-path v) ":")))
(setenv-internal env "PATH" remote-path 'keep)
env))
+ ;; Add HISTFILE if indicated.
+ (env (if-let ((sh-file-name-handler-p))
+ (cond
+ ((stringp tramp-histfile-override)
+ (setenv-internal env "HISTFILE" tramp-histfile-override 'keep))
+ (tramp-histfile-override
+ (setq env (setenv-internal env "HISTFILE" "''" 'keep))
+ (setq env (setenv-internal env "HISTSIZE" "0" 'keep))
+ (setenv-internal env "HISTFILESIZE" "0" 'keep))
+ (t env))
+ env))
+ ;; Add INSIDE_EMACS.
(env (setenv-internal
env "INSIDE_EMACS" (tramp-inside-emacs) 'keep))
(env (mapcar #'tramp-shell-quote-argument (delq nil env)))