diff options
| author | Po Lu | 2023-03-07 08:43:36 +0800 |
|---|---|---|
| committer | Po Lu | 2023-03-07 08:43:36 +0800 |
| commit | a11ad7149bc1908d205e78ecfb240b76ce190bef (patch) | |
| tree | 44730f37863840a2b565cabe6a1e7c7ebf53a984 | |
| parent | 7c8cc9a633d18ce0eb8ad14e86ec492ed8391136 (diff) | |
| parent | 1e5393a57a3bbe3f9167fee59232c2e424afadf2 (diff) | |
| download | emacs-a11ad7149bc1908d205e78ecfb240b76ce190bef.tar.gz emacs-a11ad7149bc1908d205e78ecfb240b76ce190bef.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
| -rw-r--r-- | doc/misc/tramp.texi | 29 | ||||
| -rw-r--r-- | etc/NEWS | 14 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cconv.el | 37 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 80 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/cconv-tests.el | 12 |
5 files changed, 114 insertions, 58 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index 7f6182ae17c..acf32726895 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -2728,6 +2728,7 @@ entry, @option{Seconds between keepalives} option. Set this to 5. | |||
| 2728 | There is no counter which could be set. | 2728 | There is no counter which could be set. |
| 2729 | 2729 | ||
| 2730 | 2730 | ||
| 2731 | @anchor{Using ssh connection sharing} | ||
| 2731 | @subsection Using ssh connection sharing | 2732 | @subsection Using ssh connection sharing |
| 2732 | 2733 | ||
| 2733 | @vindex ControlPath@r{, ssh option} | 2734 | @vindex ControlPath@r{, ssh option} |
| @@ -2758,19 +2759,32 @@ Note how @samp{%r}, @samp{%h} and @samp{%p} must be encoded as | |||
| 2758 | @samp{%%r}, @samp{%%h} and @samp{%%p}. | 2759 | @samp{%%r}, @samp{%%h} and @samp{%%p}. |
| 2759 | 2760 | ||
| 2760 | @vindex tramp-use-ssh-controlmaster-options | 2761 | @vindex tramp-use-ssh-controlmaster-options |
| 2761 | If the @file{~/.ssh/config} file is configured appropriately for the | 2762 | Using a predefined string in @code{tramp-ssh-controlmaster-options}, |
| 2762 | above behavior, then any changes to @command{ssh} can be suppressed | 2763 | or puzzling an own string, happens only when user option |
| 2763 | with this @code{nil} setting: | 2764 | @code{tramp-use-ssh-controlmaster-options} is set to @code{t}. If the |
| 2765 | @file{~/.ssh/config} file is configured appropriately for the above | ||
| 2766 | behavior, then any changes to @command{ssh} can be suppressed with | ||
| 2767 | this @code{nil} setting: | ||
| 2764 | 2768 | ||
| 2765 | @lisp | 2769 | @lisp |
| 2766 | (customize-set-variable 'tramp-use-ssh-controlmaster-options nil) | 2770 | (customize-set-variable 'tramp-use-ssh-controlmaster-options nil) |
| 2767 | @end lisp | 2771 | @end lisp |
| 2768 | 2772 | ||
| 2773 | Sometimes, it is not possible to use OpenSSH's @option{ControlMaster} | ||
| 2774 | option for remote processes. This could result in concurrent access | ||
| 2775 | to the OpenSSH socket when reading data by different processes, which | ||
| 2776 | could block Emacs. In this case, setting | ||
| 2777 | @code{tramp-use-ssh-controlmaster-options} to @code{suppress} disables | ||
| 2778 | shared access. It is not needed to set this user option permanently | ||
| 2779 | to @code{suppress}, binding the user option prior calling | ||
| 2780 | @code{make-process} is sufficient. @value{tramp} does this for | ||
| 2781 | esxample for compilation processes on its own. | ||
| 2782 | |||
| 2769 | @vindex ProxyCommand@r{, ssh option} | 2783 | @vindex ProxyCommand@r{, ssh option} |
| 2770 | @vindex ProxyJump@r{, ssh option} | 2784 | @vindex ProxyJump@r{, ssh option} |
| 2771 | This should also be set to @code{nil} if you use the | 2785 | @code{tramp-use-ssh-controlmaster-options} should also be set to |
| 2772 | @option{ProxyCommand} or @option{ProxyJump} options in your | 2786 | @code{nil} or @code{suppress} if you use the @option{ProxyCommand} or |
| 2773 | @command{ssh} configuration. | 2787 | @option{ProxyJump} options in your @command{ssh} configuration. |
| 2774 | 2788 | ||
| 2775 | In order to use the @option{ControlMaster} option, @value{tramp} must | 2789 | In order to use the @option{ControlMaster} option, @value{tramp} must |
| 2776 | check whether the @command{ssh} client supports this option. This is | 2790 | check whether the @command{ssh} client supports this option. This is |
| @@ -4288,7 +4302,8 @@ In order to gain even more performance, it is recommended to bind | |||
| 4288 | @code{start-file-process}. Furthermore, you might set | 4302 | @code{start-file-process}. Furthermore, you might set |
| 4289 | @code{tramp-use-ssh-controlmaster-options} to @code{nil} in order to | 4303 | @code{tramp-use-ssh-controlmaster-options} to @code{nil} in order to |
| 4290 | bypass @value{tramp}'s handling of the @option{ControlMaster} options, | 4304 | bypass @value{tramp}'s handling of the @option{ControlMaster} options, |
| 4291 | and use your own settings in @file{~/.ssh/config}. | 4305 | and use your own settings in @file{~/.ssh/config}, @ref{Using ssh |
| 4306 | connection sharing}. | ||
| 4292 | 4307 | ||
| 4293 | 4308 | ||
| 4294 | @node Cleanup remote connections | 4309 | @node Cleanup remote connections |
| @@ -112,7 +112,7 @@ If you want to get back the old behavior, set the user option to the value | |||
| 112 | *** New user option 'grep-use-headings'. | 112 | *** New user option 'grep-use-headings'. |
| 113 | When non-nil, the output of Grep is split into sections, one for each | 113 | When non-nil, the output of Grep is split into sections, one for each |
| 114 | file, instead of having file names prefixed to each line. It is | 114 | file, instead of having file names prefixed to each line. It is |
| 115 | equivalent to the --heading option of some tools such as 'git grep' | 115 | equivalent to the "--heading" option of some tools such as 'git grep' |
| 116 | and 'rg'. The headings are displayed using the new 'grep-heading' | 116 | and 'rg'. The headings are displayed using the new 'grep-heading' |
| 117 | face. | 117 | face. |
| 118 | 118 | ||
| @@ -128,7 +128,7 @@ switches for shortlogs, such as the one produced by 'C-x v L'. | |||
| 128 | 128 | ||
| 129 | +++ | 129 | +++ |
| 130 | *** 'diff-ignore-whitespace-hunk' can now be applied to all hunks. | 130 | *** 'diff-ignore-whitespace-hunk' can now be applied to all hunks. |
| 131 | When called with a non-nil prefix argument | 131 | When called with a non-nil prefix argument, |
| 132 | 'diff-ignore-whitespace-hunk' now iterates over all the hunks in the | 132 | 'diff-ignore-whitespace-hunk' now iterates over all the hunks in the |
| 133 | current diff, regenerating them without whitespace changes. | 133 | current diff, regenerating them without whitespace changes. |
| 134 | 134 | ||
| @@ -173,7 +173,7 @@ this to your configuration: | |||
| 173 | 173 | ||
| 174 | --- | 174 | --- |
| 175 | *** You can now properly unload Eshell. | 175 | *** You can now properly unload Eshell. |
| 176 | Calling "(unload-feature 'eshell)" no longer signals an error, and now | 176 | Calling '(unload-feature 'eshell)' no longer signals an error, and now |
| 177 | correctly unloads Eshell and all of its modules. | 177 | correctly unloads Eshell and all of its modules. |
| 178 | 178 | ||
| 179 | +++ | 179 | +++ |
| @@ -196,6 +196,12 @@ point is not in a comment or a string. It is by default bound to | |||
| 196 | *** New connection method "toolbox". | 196 | *** New connection method "toolbox". |
| 197 | This allows accessing system containers provided by Toolbox. | 197 | This allows accessing system containers provided by Toolbox. |
| 198 | 198 | ||
| 199 | +++ | ||
| 200 | *** New value 'suppress' for user option 'tramp-use-ssh-controlmaster-options'. | ||
| 201 | This user option allows now the values t, nil, and 'suppress'. The | ||
| 202 | latter suppresses also "ControlMaster" settings in the user's | ||
| 203 | "~/.ssh/config" file. | ||
| 204 | |||
| 199 | ** EWW | 205 | ** EWW |
| 200 | 206 | ||
| 201 | +++ | 207 | +++ |
| @@ -223,7 +229,7 @@ asynchronously (which is the default behavior). | |||
| 223 | 229 | ||
| 224 | * New Modes and Packages in Emacs 30.1 | 230 | * New Modes and Packages in Emacs 30.1 |
| 225 | 231 | ||
| 226 | ** New major modes based on the tree-sitter library. | 232 | ** New major modes based on the tree-sitter library |
| 227 | 233 | ||
| 228 | +++ | 234 | +++ |
| 229 | *** New major mode 'html-ts-mode'. | 235 | *** New major mode 'html-ts-mode'. |
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index ad9d8ab0a51..601e2c13d61 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el | |||
| @@ -477,7 +477,7 @@ places where they originally did not directly appear." | |||
| 477 | branch)) | 477 | branch)) |
| 478 | cond-forms))) | 478 | cond-forms))) |
| 479 | 479 | ||
| 480 | (`(function (lambda ,args . ,body) . ,_) | 480 | (`(function (lambda ,args . ,body) . ,rest) |
| 481 | (let* ((docstring (if (eq :documentation (car-safe (car body))) | 481 | (let* ((docstring (if (eq :documentation (car-safe (car body))) |
| 482 | (cconv-convert (cadr (pop body)) env extend))) | 482 | (cconv-convert (cadr (pop body)) env extend))) |
| 483 | (bf (if (stringp (car body)) (cdr body) body)) | 483 | (bf (if (stringp (car body)) (cdr body) body)) |
| @@ -485,15 +485,32 @@ places where they originally did not directly appear." | |||
| 485 | (gethash form cconv--interactive-form-funs))) | 485 | (gethash form cconv--interactive-form-funs))) |
| 486 | (wrapped (pcase if (`#'(lambda (&rest _cconv--dummy) .,_) t) (_ nil))) | 486 | (wrapped (pcase if (`#'(lambda (&rest _cconv--dummy) .,_) t) (_ nil))) |
| 487 | (cif (when if (cconv-convert if env extend))) | 487 | (cif (when if (cconv-convert if env extend))) |
| 488 | (_ (pcase cif | 488 | (cf nil)) |
| 489 | ('nil nil) | 489 | ;; TODO: Because we need to non-destructively modify body, this code |
| 490 | (`#',f | 490 | ;; is particularly ugly. This should ideally be moved to |
| 491 | (setf (cadr (car bf)) (if wrapped (nth 2 f) cif)) | 491 | ;; cconv--convert-function. |
| 492 | (setq cif nil)) | 492 | (pcase cif |
| 493 | ;; The interactive form needs special treatment, so the form | 493 | ('nil (setq bf nil)) |
| 494 | ;; inside the `interactive' won't be used any further. | 494 | (`#',f |
| 495 | (_ (setf (cadr (car bf)) nil)))) | 495 | (pcase-let ((`((,f1 . (,_ . ,f2)) . ,f3) bf)) |
| 496 | (cf (cconv--convert-function args body env form docstring))) | 496 | (setq bf `((,f1 . (,(if wrapped (nth 2 f) cif) . ,f2)) . ,f3))) |
| 497 | (setq cif nil)) | ||
| 498 | ;; The interactive form needs special treatment, so the form | ||
| 499 | ;; inside the `interactive' won't be used any further. | ||
| 500 | (_ (pcase-let ((`((,f1 . (,_ . ,f2)) . ,f3) bf)) | ||
| 501 | (setq bf `((,f1 . (nil . ,f2)) . ,f3))))) | ||
| 502 | (when bf | ||
| 503 | ;; If we modified bf, re-build body and form as | ||
| 504 | ;; copies with the modified bits. | ||
| 505 | (setq body (if (stringp (car body)) | ||
| 506 | (cons (car body) bf) | ||
| 507 | bf) | ||
| 508 | form `(function (lambda ,args . ,body) . ,rest)) | ||
| 509 | ;; Also, remove the current old entry on the alist, replacing | ||
| 510 | ;; it with the new one. | ||
| 511 | (let ((entry (pop cconv-freevars-alist))) | ||
| 512 | (push (cons body (cdr entry)) cconv-freevars-alist))) | ||
| 513 | (setq cf (cconv--convert-function args body env form docstring)) | ||
| 497 | (if (not cif) | 514 | (if (not cif) |
| 498 | ;; Normal case, the interactive form needs no special treatment. | 515 | ;; Normal case, the interactive form needs no special treatment. |
| 499 | cf | 516 | cf |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 49da0e425ff..3ae5208154a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -108,11 +108,18 @@ detected as prompt when being sent on echoing hosts, therefore.") | |||
| 108 | 108 | ||
| 109 | (defcustom tramp-use-ssh-controlmaster-options (not (eq system-type 'windows-nt)) | 109 | (defcustom tramp-use-ssh-controlmaster-options (not (eq system-type 'windows-nt)) |
| 110 | "Whether to use `tramp-ssh-controlmaster-options'. | 110 | "Whether to use `tramp-ssh-controlmaster-options'. |
| 111 | Set it to t, if you want Tramp to apply these options. | ||
| 111 | Set it to nil, if you use Control* or Proxy* options in your ssh | 112 | Set it to nil, if you use Control* or Proxy* options in your ssh |
| 112 | configuration." | 113 | configuration. |
| 114 | Set it to `suppress' if you want to disable settings in your | ||
| 115 | \"~/.ssh/config¸\"." | ||
| 113 | :group 'tramp | 116 | :group 'tramp |
| 114 | :version "28.1" | 117 | :version "29.2" |
| 115 | :type 'boolean) | 118 | :type '(choice (const :tag "Set ControlMaster" t) |
| 119 | (const :tag "Don't set ControlMaster" nil) | ||
| 120 | (const :tag "Suppress ControlMaster" suppress)) | ||
| 121 | ;; Check with (safe-local-variable-p 'tramp-use-ssh-controlmaster-options 'suppress) | ||
| 122 | :safe (lambda (val) (and (memq val '(t nil suppress)) t))) | ||
| 116 | 123 | ||
| 117 | (defvar tramp-ssh-controlmaster-options nil | 124 | (defvar tramp-ssh-controlmaster-options nil |
| 118 | "Which ssh Control* arguments to use. | 125 | "Which ssh Control* arguments to use. |
| @@ -123,8 +130,8 @@ If it is a string, it should have the form | |||
| 123 | spec must be doubled, because the string is used as format string. | 130 | spec must be doubled, because the string is used as format string. |
| 124 | 131 | ||
| 125 | Otherwise, it will be auto-detected by Tramp, if | 132 | Otherwise, it will be auto-detected by Tramp, if |
| 126 | `tramp-use-ssh-controlmaster-options' is non-nil. The value | 133 | `tramp-use-ssh-controlmaster-options' is t. The value depends on |
| 127 | depends on the installed local ssh version. | 134 | the installed local ssh version. |
| 128 | 135 | ||
| 129 | The string is used in `tramp-methods'.") | 136 | The string is used in `tramp-methods'.") |
| 130 | 137 | ||
| @@ -4811,6 +4818,15 @@ Goes through the list `tramp-inline-compress-commands'." | |||
| 4811 | (tramp-message | 4818 | (tramp-message |
| 4812 | vec 2 "Couldn't find an inline transfer compress command"))))) | 4819 | vec 2 "Couldn't find an inline transfer compress command"))))) |
| 4813 | 4820 | ||
| 4821 | (defun tramp-ssh-option-exists-p (vec option) | ||
| 4822 | "Check, whether local ssh OPTION is applicable." | ||
| 4823 | ;; We don't want to cache it persistently. | ||
| 4824 | (with-tramp-connection-property nil option | ||
| 4825 | ;; We use a non-existing IP address for check, in order to avoid | ||
| 4826 | ;; useless connections, and DNS timeouts. | ||
| 4827 | (zerop | ||
| 4828 | (tramp-call-process vec "ssh" nil nil nil "-G" "-o" option "0.0.0.1")))) | ||
| 4829 | |||
| 4814 | (defun tramp-ssh-controlmaster-options (vec) | 4830 | (defun tramp-ssh-controlmaster-options (vec) |
| 4815 | "Return the Control* arguments of the local ssh." | 4831 | "Return the Control* arguments of the local ssh." |
| 4816 | (cond | 4832 | (cond |
| @@ -4820,40 +4836,30 @@ Goes through the list `tramp-inline-compress-commands'." | |||
| 4820 | "") | 4836 | "") |
| 4821 | 4837 | ||
| 4822 | ;; There is already a value to be used. | 4838 | ;; There is already a value to be used. |
| 4823 | ((stringp tramp-ssh-controlmaster-options) tramp-ssh-controlmaster-options) | 4839 | ((and (eq tramp-use-ssh-controlmaster-options t) |
| 4840 | (stringp tramp-ssh-controlmaster-options)) | ||
| 4841 | tramp-ssh-controlmaster-options) | ||
| 4824 | 4842 | ||
| 4825 | ;; Determine the options. | 4843 | ;; Determine the options. |
| 4826 | (t (setq tramp-ssh-controlmaster-options "") | 4844 | (t (ignore-errors |
| 4827 | (let ((case-fold-search t)) | 4845 | ;; ControlMaster and ControlPath options are introduced in OpenSSH 3.9. |
| 4828 | (ignore-errors | 4846 | (when (tramp-ssh-option-exists-p vec "ControlMaster=auto") |
| 4829 | (with-tramp-progress-reporter | 4847 | (concat |
| 4830 | vec 4 "Computing ControlMaster options" | 4848 | "-o ControlMaster=" |
| 4831 | ;; We use a non-existing IP address, in order to avoid | 4849 | (if (eq tramp-use-ssh-controlmaster-options 'suppress) |
| 4832 | ;; useless connections, and DNS timeouts. | 4850 | "no" "auto") |
| 4833 | (when (zerop | 4851 | |
| 4834 | (tramp-call-process | 4852 | " -o ControlPath=" |
| 4835 | vec "ssh" nil nil nil | 4853 | (if (eq tramp-use-ssh-controlmaster-options 'suppress) |
| 4836 | "-G" "-o" "ControlMaster=auto" "0.0.0.1")) | 4854 | "none" |
| 4837 | (setq tramp-ssh-controlmaster-options | 4855 | ;; Hashed tokens are introduced in OpenSSH 6.7. |
| 4838 | "-o ControlMaster=auto") | 4856 | (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C") |
| 4839 | (if (zerop | 4857 | "tramp.%%C" "tramp.%%r@%%h:%%p")) |
| 4840 | (tramp-call-process | 4858 | |
| 4841 | vec "ssh" nil nil nil | 4859 | ;; ControlPersist option is introduced in OpenSSH 5.6. |
| 4842 | "-G" "-o" "ControlPath=tramp.%C" "0.0.0.1")) | 4860 | (when (and (not (eq tramp-use-ssh-controlmaster-options 'suppress)) |
| 4843 | (setq tramp-ssh-controlmaster-options | 4861 | (tramp-ssh-option-exists-p vec "ControlPersist=no")) |
| 4844 | (concat tramp-ssh-controlmaster-options | 4862 | " -o ControlPersist=no"))))))) |
| 4845 | " -o ControlPath=tramp.%%C")) | ||
| 4846 | (setq tramp-ssh-controlmaster-options | ||
| 4847 | (concat tramp-ssh-controlmaster-options | ||
| 4848 | " -o ControlPath=tramp.%%r@%%h:%%p"))) | ||
| 4849 | (when (zerop | ||
| 4850 | (tramp-call-process | ||
| 4851 | vec "ssh" nil nil nil | ||
| 4852 | "-G" "-o" "ControlPersist=no" "0.0.0.1")) | ||
| 4853 | (setq tramp-ssh-controlmaster-options | ||
| 4854 | (concat tramp-ssh-controlmaster-options | ||
| 4855 | " -o ControlPersist=no"))))))) | ||
| 4856 | tramp-ssh-controlmaster-options))) | ||
| 4857 | 4863 | ||
| 4858 | (defun tramp-scp-strict-file-name-checking (vec) | 4864 | (defun tramp-scp-strict-file-name-checking (vec) |
| 4859 | "Return the strict file name checking argument of the local scp." | 4865 | "Return the strict file name checking argument of the local scp." |
diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el index 349ffeb7e47..6facd3452ea 100644 --- a/test/lisp/emacs-lisp/cconv-tests.el +++ b/test/lisp/emacs-lisp/cconv-tests.el | |||
| @@ -376,6 +376,18 @@ | |||
| 376 | (eval '(lambda (x) :closure-dont-trim-context (+ x 1)) | 376 | (eval '(lambda (x) :closure-dont-trim-context (+ x 1)) |
| 377 | `((y . ,magic-string))))))) | 377 | `((y . ,magic-string))))))) |
| 378 | 378 | ||
| 379 | (ert-deftest cconv-tests-interactive-form-modify-bug60974 () | ||
| 380 | (let* ((f '(function (lambda (&optional arg) | ||
| 381 | (interactive | ||
| 382 | (list (if current-prefix-arg | ||
| 383 | (prefix-numeric-value current-prefix-arg) | ||
| 384 | 'toggle))) | ||
| 385 | (ignore arg)))) | ||
| 386 | (if (cadr (nth 2 (cadr f)))) | ||
| 387 | (if2)) | ||
| 388 | (cconv-closure-convert f) | ||
| 389 | (setq if2 (cadr (nth 2 (cadr f)))) | ||
| 390 | (should (eq if if2)))) | ||
| 379 | 391 | ||
| 380 | (provide 'cconv-tests) | 392 | (provide 'cconv-tests) |
| 381 | ;;; cconv-tests.el ends here | 393 | ;;; cconv-tests.el ends here |