1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Obey tramp-histfile-override in remote direct async processes

* 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)
This commit is contained in:
Michael Albinus 2024-05-29 17:11:49 +02:00
parent 4e836407ce
commit 063b67325b
3 changed files with 22 additions and 0 deletions

View file

@ -1607,6 +1607,13 @@ matches all buffers with a remote default directory.
and setting these profiles to criteria which could match in parallel. and setting these profiles to criteria which could match in parallel.
It is unspecified which variable value is used then. 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 @node Key Bindings
@section Customizing Key Bindings @section Customizing Key Bindings
@cindex key bindings @cindex key bindings

View file

@ -64,6 +64,7 @@ If it is nil, out-of-the-band copy will be used without a check."
:group 'tramp :group 'tramp
:type '(choice (const nil) integer)) :type '(choice (const nil) integer))
;;;###tramp-autoload
(defcustom tramp-histfile-override "~/.tramp_history" (defcustom tramp-histfile-override "~/.tramp_history"
"When invoking a shell, override the HISTFILE with this value. "When invoking a shell, override the HISTFILE with this value.
When setting to a string, it redirects the shell history to that When setting to a string, it redirects the shell history to that
@ -80,6 +81,8 @@ the default storage location, e.g. \"$HOME/.sh_history\"."
(const :tag "Unset HISTFILE" t) (const :tag "Unset HISTFILE" t)
(string :tag "Redirect to a file"))) (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 ;; ksh on OpenBSD 4.5 requires that $PS1 contains a `#' character for
;; root users. It uses the `$' character for other users. In order ;; root users. It uses the `$' character for other users. In order
;; to guarantee a proper prompt, we use "#$ " for the prompt. ;; to guarantee a proper prompt, we use "#$ " for the prompt.

View file

@ -4962,6 +4962,18 @@ should be set conmnection-local.")
(string-join (tramp-get-remote-path v) ":"))) (string-join (tramp-get-remote-path v) ":")))
(setenv-internal env "PATH" remote-path 'keep) (setenv-internal env "PATH" remote-path 'keep)
env)) 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 (setenv-internal
env "INSIDE_EMACS" (tramp-inside-emacs) 'keep)) env "INSIDE_EMACS" (tramp-inside-emacs) 'keep))
(env (mapcar #'tramp-shell-quote-argument (delq nil env))) (env (mapcar #'tramp-shell-quote-argument (delq nil env)))