commit a52ad71cc5d036f1973ff2e504e45992fec3fc04 (HEAD, refs/remotes/origin/master) Author: Juri Linkov Date: Fri Nov 29 09:35:13 2024 +0200 * lisp/progmodes/c-ts-mode.el: Improve logic of outlines (bug#74448). (c-ts-mode--outline-predicate): Instead of checking only for function_declarator nodes at the beginning of line (like in GNU coding style) handle other coding styles that start the function line with either storage class (e.g. static) or type. Suggested by Filippo Argiolas diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index c815ee35501..9bbb78e0862 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -973,9 +973,14 @@ Return nil if NODE is not a defun node or doesn't have a name." (defun c-ts-mode--outline-predicate (node) "Match outlines on lines with function names." - (or (and (equal (treesit-node-type node) "function_declarator") - (equal (treesit-node-type (treesit-node-parent node)) - "function_definition")) + (or (when-let* ((decl (treesit-node-child-by-field-name + (treesit-node-parent node) "declarator")) + (node-pos (treesit-node-start node)) + (decl-pos (treesit-node-start decl)) + (eol (save-excursion (goto-char node-pos) (line-end-position)))) + (and (equal (treesit-node-type decl) "function_declarator") + (<= node-pos decl-pos) + (< decl-pos eol))) ;; DEFUNs in Emacs sources. (and c-ts-mode-emacs-sources-support (c-ts-mode--emacs-defun-p node)))) commit e54c218d661c2d2f6f693342d2cf78d4be754d65 Author: Michael Albinus Date: Thu Nov 28 13:28:58 2024 +0100 Extend Tramp tests * test/lisp/net/tramp-tests.el (tramp-test47-read-password) (tramp-test47-read-otp-password, tramp-test47-read-fingerprint): Use `tramp-default-remote-shell' and `tramp-connection-properties'. Cleanup at the end. (tramp-test47-read-security-key): New test. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 032ddaef953..b28b76ac979 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -7983,25 +7983,24 @@ process sentinels. They shall not disturb each other." ;; Not all read commands understand argument "-s" or "-p". (skip-unless (string-empty-p - (let ((shell-file-name "sh")) + (let ((shell-file-name tramp-default-remote-shell)) (shell-command-to-string "read -s -p Password: pass")))) - (let ((pass "secret") - (mock-entry (copy-tree (assoc "mock" tramp-methods))) - mocked-input tramp-methods auth-sources) + (let* ((pass "secret") + (tramp-connection-properties + `((nil "login-args" + (("-c") + (,(tramp-shell-quote-argument + (concat + "read -s -p 'Password: ' pass; echo; " + "(test \"pass$pass\" != \"pass" pass "\" && " + "echo \"Login incorrect\" || " + tramp-default-remote-shell " -i)"))))))) + mocked-input auth-sources) ;; We must mock `read-string', in order to avoid interactive ;; arguments. (cl-letf* (((symbol-function #'read-string) (lambda (&rest _args) (pop mocked-input)))) - (setcdr - (assq 'tramp-login-args mock-entry) - `((("-c") - (,(tramp-shell-quote-argument - (concat - "read -s -p 'Password: ' pass; echo; " - "(test \"pass$pass\" != \"pass" pass "\" && " - "echo \"Login incorrect\" || sh -i)")))))) - (setq tramp-methods `(,mock-entry)) ;; Reading password from stdin works. (tramp-cleanup-connection tramp-test-vec 'keep-debug) @@ -8062,7 +8061,10 @@ process sentinels. They shall not disturb each other." (should-not (password-in-cache-p (auth-source-format-cache-entry - (tramp-get-connection-property tramp-test-vec " pw-spec")))))))))) + (tramp-get-connection-property tramp-test-vec " pw-spec"))))))))) + + ;; Cleanup. + (tramp-cleanup-connection tramp-test-vec 'keep-debug)) (ert-deftest tramp-test47-read-otp-password () "Check Tramp one-time password handling." @@ -8071,25 +8073,24 @@ process sentinels. They shall not disturb each other." ;; Not all read commands understand argument "-s" or "-p". (skip-unless (string-empty-p - (let ((shell-file-name "sh")) + (let ((shell-file-name tramp-default-remote-shell)) (shell-command-to-string "read -s -p Password: pass")))) - (let ((pass "secret") - (mock-entry (copy-tree (assoc "mock" tramp-methods))) - mocked-input tramp-methods) + (let* ((pass "secret") + (tramp-connection-properties + `((nil "login-args" + (("-c") + (,(tramp-shell-quote-argument + (concat + "read -s -p 'Verification code: ' pass; echo; " + "(test \"pass$pass\" != \"pass" pass "\" && " + "echo \"Login incorrect\" || " + tramp-default-remote-shell " -i)"))))))) + mocked-input auth-sources) ;; We must mock `read-string', in order to avoid interactive ;; arguments. (cl-letf* (((symbol-function #'read-string) (lambda (&rest _args) (pop mocked-input)))) - (setcdr - (assq 'tramp-login-args mock-entry) - `((("-c") - (,(tramp-shell-quote-argument - (concat - "read -s -p 'Verification code: ' pass; echo; " - "(test \"pass$pass\" != \"pass" pass "\" && " - "echo \"Login incorrect\" || sh -i)")))))) - (setq tramp-methods `(,mock-entry)) ;; Reading password from stdin works. (tramp-cleanup-connection tramp-test-vec 'keep-debug) @@ -8121,7 +8122,86 @@ process sentinels. They shall not disturb each other." pass) (let ((auth-sources `(,netrc-file))) (should-error - (file-exists-p ert-remote-temporary-file-directory))))))))) + (file-exists-p ert-remote-temporary-file-directory)))))))) + + ;; Cleanup. + (tramp-cleanup-connection tramp-test-vec 'keep-debug)) + +(ert-deftest tramp-test47-read-security-key () + "Check Tramp security key handling." + :tags '(:expensive-test) + (skip-unless (tramp--test-mock-p)) + ;; Not all read commands understand argument "-s" or "-p". + (skip-unless + (string-empty-p + (let ((shell-file-name tramp-default-remote-shell)) + (shell-command-to-string "read -s -p Password: pass")))) + + (let (;; Suppress "exec". + (tramp-restricted-shell-hosts-alist `(,tramp-system-name))) + + ;; Reading security key works. + (tramp-cleanup-connection tramp-test-vec 'keep-debug) + (let ((tramp-connection-properties + `((nil "login-args" + (("-c") + (,(tramp-shell-quote-argument + "echo Confirm user presence for key XXX")) + (";") ("sleep" "1") + (";") ("echo" "User presence confirmed") + (";") ("sleep" "1") + (";") (,tramp-default-remote-shell "-i")))))) + (should (file-exists-p ert-remote-temporary-file-directory))) + + (let* ((pin "1234") + (tramp-connection-properties + `((nil "login-args" + (("-c") + (,(tramp-shell-quote-argument + (concat + "echo Confirm user presence for key XXX; sleep 1; " + "read -s -p 'Enter PIN for XXX ' pin; echo; " + "(test \"pin$pin\" != \"pin" pin "\" && " + "echo \"Login incorrect\" || " + "(echo User presence confirmed; " + tramp-default-remote-shell " -i))"))))))) + mocked-input auth-sources) + ;; We must mock `read-string', in order to avoid interactive + ;; arguments. + (cl-letf* (((symbol-function #'read-string) + (lambda (&rest _args) (pop mocked-input)))) + + ;; Reading security PIN works. + (tramp-cleanup-connection tramp-test-vec 'keep-debug) + ;; We don't want to invalidate the pin. + (setq mocked-input `(,(copy-sequence pin))) + (should (file-exists-p ert-remote-temporary-file-directory)) + + ;; Don't entering a security PIN returns in error. + (tramp-cleanup-connection tramp-test-vec 'keep-debug) + (setq mocked-input nil) + (should-error (file-exists-p ert-remote-temporary-file-directory)) + + ;; A wrong security PIN doesn't work either. + (tramp-cleanup-connection tramp-test-vec 'keep-debug) + (setq mocked-input `(,(concat pin pin))) + (should-error (file-exists-p ert-remote-temporary-file-directory)))) + + ;; Timeout is detected. + (tramp-cleanup-connection tramp-test-vec 'keep-debug) + (let ((tramp-connection-properties + `((nil "login-args" + (("-c") + (,(tramp-shell-quote-argument + "echo Confirm user presence for key XXX")) + (";") ("sleep" "1") + (";") ("echo" "sign_and_send_pubkey: signing failed for XXX") + (";") ("sleep" "1") + (";") ("exit" "1")))))) + (should-error (file-exists-p ert-remote-temporary-file-directory)))) + + ;; Cleanup. + (tramp-cleanup-connection tramp-test-vec 'keep-debug)) (ert-deftest tramp-test47-read-fingerprint () "Check Tramp fingerprint handling." @@ -8139,7 +8219,7 @@ process sentinels. They shall not disturb each other." (,(tramp-shell-quote-argument "echo Place your finger on the fingerprint reader")) (";") ("sleep" "1") - (";") ("sh" "-i")))))) + (";") (,tramp-default-remote-shell "-i")))))) (should (file-exists-p ert-remote-temporary-file-directory))) ;; Falling back after a timeout works. @@ -8151,7 +8231,7 @@ process sentinels. They shall not disturb each other." "echo Place your finger on the fingerprint reader")) (";") ("sleep" "1") (";") ("echo" "Failed to match fingerprint") - (";") ("sh" "-i")))))) + (";") (,tramp-default-remote-shell "-i")))))) (should (file-exists-p ert-remote-temporary-file-directory))) ;; Interrupting the fingerprint handshaking works. @@ -8162,9 +8242,12 @@ process sentinels. They shall not disturb each other." (,(tramp-shell-quote-argument "echo Place your finger on the fingerprint reader")) (";") ("sleep" "1") - (";") ("sh" "-i"))))) + (";") (,tramp-default-remote-shell "-i"))))) tramp-use-fingerprint) - (should (file-exists-p ert-remote-temporary-file-directory))))) + (should (file-exists-p ert-remote-temporary-file-directory)))) + + ;; Cleanup. + (tramp-cleanup-connection tramp-test-vec 'keep-debug)) ;; This test is inspired by Bug#29163. (ert-deftest tramp-test48-auto-load () commit b0ba0d42b0fdf70a20cd7a070128db8abe4a0826 Author: Andrea Corallo Date: Wed Nov 27 14:18:24 2024 +0100 * src/lisp.h (EQ): Improve generated code. Outside compilation 'symbols_with_pos_enabled' is always false, so ask the compiler to organize the most likely execution path in a sequential fashion in order to favor run-time performance. diff --git a/src/lisp.h b/src/lisp.h index 5ef97047f76..832a1755c04 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1353,10 +1353,10 @@ INLINE bool INLINE bool EQ (Lisp_Object x, Lisp_Object y) { - return BASE_EQ ((symbols_with_pos_enabled && SYMBOL_WITH_POS_P (x) - ? XSYMBOL_WITH_POS_SYM (x) : x), - (symbols_with_pos_enabled && SYMBOL_WITH_POS_P (y) - ? XSYMBOL_WITH_POS_SYM (y) : y)); + return BASE_EQ ((__builtin_expect (symbols_with_pos_enabled, false) + && SYMBOL_WITH_POS_P (x) ? XSYMBOL_WITH_POS_SYM (x) : x), + (__builtin_expect (symbols_with_pos_enabled, false) + && SYMBOL_WITH_POS_P (y) ? XSYMBOL_WITH_POS_SYM (y) : y)); } INLINE intmax_t commit 8184f64ab0025afb0b901b9cae3917e6f722974b Author: Michael Albinus Date: Wed Nov 27 20:51:51 2024 +0100 ; Minor Tramp cleanup * lisp/net/tramp-message.el (tramp-warning): Fix `lwarn' call. * lisp/net/tramp-sh.el (tramp-sh-handle-make-process): Don't set connection property "remote-pid", it's unused. diff --git a/lisp/net/tramp-message.el b/lisp/net/tramp-message.el index c9bb9648fdb..2681be3a0c2 100644 --- a/lisp/net/tramp-message.el +++ b/lisp/net/tramp-message.el @@ -467,7 +467,7 @@ to `tramp-message'." (declare (tramp-suppress-trace t)) (let (signal-hook-function) (apply 'tramp-message vec-or-proc 2 fmt-string arguments) - (lwarn 'tramp :warning fmt-string arguments))) + (apply 'lwarn 'tramp :warning fmt-string arguments))) (defun tramp-test-message (fmt-string &rest arguments) "Emit a Tramp message according `default-directory'." diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 46108b48768..5535ed3ab60 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -3104,8 +3104,7 @@ will be used." ;; needed when sending signals remotely. (let ((pid (tramp-send-command-and-read v "echo $$"))) (setq p (tramp-get-connection-process v)) - (process-put p 'remote-pid pid) - (tramp-set-connection-property p "remote-pid" pid)) + (process-put p 'remote-pid pid)) (when (memq connection-type '(nil pipe)) ;; Disable carriage return to newline ;; translation. This does not work on commit bef9eeb05981ee5fe09c202116d725f9c69b9520 Author: Eli Zaretskii Date: Wed Nov 27 15:54:39 2024 +0200 ; * etc/NEWS: Fix typo and wording of a recently-added entry. diff --git a/etc/NEWS b/etc/NEWS index 56b03fdb0ac..4d2a2c893d0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -783,11 +783,13 @@ will not prompt the user for confirmation before installing packages. ** Xref +--- +*** Xref commands that jump to some location use 'display-buffer'. The commands that jump to some location use 'display-buffer' and specify -the category 'xref-jump'. As a result you can customize how the +the category 'xref-jump'. As a result, you can customize how the destination window is chosen using 'display-buffer-alist'. Example: - (setq display-buffer-alist '(((category . xref) + (setq display-buffer-alist '(((category . xref-jump) (display-buffer-reuse-window display-buffer-use-some-window) (some-window . mru)))) commit 51fb0331b3cd9e3c22c11c503899a60e65c64ffe Author: Eli Zaretskii Date: Wed Nov 27 15:49:55 2024 +0200 ; * etc/NEWS: Fix typos and wording of last added entry. diff --git a/etc/NEWS b/etc/NEWS index e2fbfa41abf..56b03fdb0ac 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -944,9 +944,10 @@ provide a ':columns' spec, so that the number of columns and their widths can be determined. Columns widths can be set explicitly, or they will be calculated based on the window width. -** New symbol propery 'repeat-continue-only' for 'repeat-mode'. -A command with this symbol propery will not activate the repeat map, -but will only continue the already activated repeating sequence. +** New symbol property 'repeat-continue-only' for 'repeat-mode'. +A command with this symbol property whose value is non-nil will not +activate the repeat map in 'repeat-mode', it will only continue the +already activated repeating sequence. * Changes in Emacs 31.1 on Non-Free Operating Systems