diff options
| author | Michael Albinus | 2024-05-29 17:11:49 +0200 |
|---|---|---|
| committer | Michael Albinus | 2024-05-29 17:11:49 +0200 |
| commit | 063b67325b4e00a31c1178b340529a94e0de1c4e (patch) | |
| tree | 63b334e020a42dbf28771b0bad93fc0b5d565cf1 | |
| parent | 4e836407ce3a2140725c7ddc2cedc3478d34a479 (diff) | |
| download | emacs-063b67325b4e00a31c1178b340529a94e0de1c4e.tar.gz emacs-063b67325b4e00a31c1178b340529a94e0de1c4e.zip | |
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)
| -rw-r--r-- | doc/emacs/custom.texi | 7 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 12 |
3 files changed, 22 insertions, 0 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 4725af0ee5f..0d695032d77 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -1607,6 +1607,13 @@ matches all buffers with a remote default directory. | |||
| 1607 | and setting these profiles to criteria which could match in parallel. | 1607 | and setting these profiles to criteria which could match in parallel. |
| 1608 | It is unspecified which variable value is used then. | 1608 | It is unspecified which variable value is used then. |
| 1609 | 1609 | ||
| 1610 | Be also careful when setting connection-local variables in a buffer, | ||
| 1611 | which changes its major mode afterwards. Because all buffer-local | ||
| 1612 | variables will be killed when changing the major mode, the | ||
| 1613 | connection-local variable's value would be lost. You can prevent this | ||
| 1614 | by setting the respective variable's @code{permanent-local} symbol | ||
| 1615 | property to non-@code{nil}. | ||
| 1616 | |||
| 1610 | @node Key Bindings | 1617 | @node Key Bindings |
| 1611 | @section Customizing Key Bindings | 1618 | @section Customizing Key Bindings |
| 1612 | @cindex key bindings | 1619 | @cindex key bindings |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index c079455a444..615f9219448 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -64,6 +64,7 @@ If it is nil, out-of-the-band copy will be used without a check." | |||
| 64 | :group 'tramp | 64 | :group 'tramp |
| 65 | :type '(choice (const nil) integer)) | 65 | :type '(choice (const nil) integer)) |
| 66 | 66 | ||
| 67 | ;;;###tramp-autoload | ||
| 67 | (defcustom tramp-histfile-override "~/.tramp_history" | 68 | (defcustom tramp-histfile-override "~/.tramp_history" |
| 68 | "When invoking a shell, override the HISTFILE with this value. | 69 | "When invoking a shell, override the HISTFILE with this value. |
| 69 | When setting to a string, it redirects the shell history to that | 70 | 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\"." | |||
| 80 | (const :tag "Unset HISTFILE" t) | 81 | (const :tag "Unset HISTFILE" t) |
| 81 | (string :tag "Redirect to a file"))) | 82 | (string :tag "Redirect to a file"))) |
| 82 | 83 | ||
| 84 | (put 'tramp-histfile-override 'permanent-local t) | ||
| 85 | |||
| 83 | ;; ksh on OpenBSD 4.5 requires that $PS1 contains a `#' character for | 86 | ;; ksh on OpenBSD 4.5 requires that $PS1 contains a `#' character for |
| 84 | ;; root users. It uses the `$' character for other users. In order | 87 | ;; root users. It uses the `$' character for other users. In order |
| 85 | ;; to guarantee a proper prompt, we use "#$ " for the prompt. | 88 | ;; to guarantee a proper prompt, we use "#$ " for the prompt. |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 9385b023392..b2442f4538c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -4962,6 +4962,18 @@ should be set conmnection-local.") | |||
| 4962 | (string-join (tramp-get-remote-path v) ":"))) | 4962 | (string-join (tramp-get-remote-path v) ":"))) |
| 4963 | (setenv-internal env "PATH" remote-path 'keep) | 4963 | (setenv-internal env "PATH" remote-path 'keep) |
| 4964 | env)) | 4964 | env)) |
| 4965 | ;; Add HISTFILE if indicated. | ||
| 4966 | (env (if-let ((sh-file-name-handler-p)) | ||
| 4967 | (cond | ||
| 4968 | ((stringp tramp-histfile-override) | ||
| 4969 | (setenv-internal env "HISTFILE" tramp-histfile-override 'keep)) | ||
| 4970 | (tramp-histfile-override | ||
| 4971 | (setq env (setenv-internal env "HISTFILE" "''" 'keep)) | ||
| 4972 | (setq env (setenv-internal env "HISTSIZE" "0" 'keep)) | ||
| 4973 | (setenv-internal env "HISTFILESIZE" "0" 'keep)) | ||
| 4974 | (t env)) | ||
| 4975 | env)) | ||
| 4976 | ;; Add INSIDE_EMACS. | ||
| 4965 | (env (setenv-internal | 4977 | (env (setenv-internal |
| 4966 | env "INSIDE_EMACS" (tramp-inside-emacs) 'keep)) | 4978 | env "INSIDE_EMACS" (tramp-inside-emacs) 'keep)) |
| 4967 | (env (mapcar #'tramp-shell-quote-argument (delq nil env))) | 4979 | (env (mapcar #'tramp-shell-quote-argument (delq nil env))) |