From abb11eb3a3c1a8a29a43c584bcaa8917db52a541 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 22 May 2023 16:08:23 +0200 Subject: [PATCH 1/4] Support existing sshfs and rclone mount points in Tramp * lisp/net/tramp-fuse.el (tramp-fuse-mount-point, tramp-fuse-mounted-p): Support existing mount points. --- lisp/net/tramp-fuse.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/net/tramp-fuse.el b/lisp/net/tramp-fuse.el index 8112e564a2c..5c0bb8e8d96 100644 --- a/lisp/net/tramp-fuse.el +++ b/lisp/net/tramp-fuse.el @@ -141,7 +141,7 @@ (defun tramp-fuse-mount-point (vec) "Return local mount point of VEC." - (or (tramp-get-connection-property vec "mount-point") + (or (tramp-get-file-property vec "/" "mount-point") (expand-file-name (concat tramp-temp-name-prefix @@ -173,8 +173,11 @@ It has the same meaning as `remote-file-name-inhibit-cache'.") (tramp-set-file-property vec "/" "mounted" (when (string-match - (rx bol (group (literal (tramp-fuse-mount-spec vec))) blank) + (rx bol (group (literal (tramp-fuse-mount-spec vec))) + " on " (group (+ (not blank))) blank) mount) + (tramp-set-file-property + vec "/" "mount-point" (match-string 2 mount)) (match-string 1 mount))))))) (defun tramp-fuse-get-fusermount () From 0cb1d695b429fceb45a11cd7ed73f3bb9ce7002f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mattias=20Engdeg=C3=A5rd?= Date: Mon, 22 May 2023 16:27:00 +0200 Subject: [PATCH 2/4] Attempt to speed up filenotify-tests * test/lisp/filenotify-tests.el (file-notify-test04-autorevert): Run with a lower `auto-revert-interval` (1 s) and adjust the a timeout value. This should lower the time for this particular test from 25 to below 10 s. --- test/lisp/filenotify-tests.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el index 97b7c46c689..0873910ddf9 100644 --- a/test/lisp/filenotify-tests.el +++ b/test/lisp/filenotify-tests.el @@ -939,10 +939,13 @@ delivered." :tags '(:expensive-test) (skip-unless (file-notify--test-local-enabled)) - ;; `auto-revert-buffers' runs every 5". And we must wait, until the - ;; file has been reverted. - (let ((timeout (if (file-remote-p temporary-file-directory) 60 10)) - buf) + ;; Run with shortened `auto-revert-interval' for a faster test. + (let* ((auto-revert-interval 1) + (timeout (if (file-remote-p temporary-file-directory) + 60 ; FIXME: can this be shortened? + (* auto-revert-interval 2.5))) + buf) + (auto-revert-set-timer) (unwind-protect (progn ;; In the remote case, `vc-refresh-state' returns undesired @@ -960,10 +963,9 @@ delivered." (sleep-for 1) (auto-revert-mode 1) - ;; `auto-revert-buffers' runs every 5". (with-timeout (timeout (ignore)) (while (null auto-revert-notify-watch-descriptor) - (sleep-for 1))) + (sleep-for 0.2))) ;; `file-notify--test-monitor' needs to know ;; `file-notify--test-desc' in order to compute proper From f33b301c29380cb0b295e1343e59c0faaf6ab621 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Mon, 22 May 2023 16:09:07 +0000 Subject: [PATCH 3/4] Fix syntax bugs involving escaped newlines in comments This fixes bug#63535 * src/syntax.c (forw_comment): take the initial syntax from the argument PREV_SYNTAX rather than checking the buffer position for a backslash. Update the state at each character scanned. (scan_sexps_forward): When the end position is escaped after a call to forw_comment, return this status to the caller. --- src/syntax.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/syntax.c b/src/syntax.c index 839ab36bb2f..0cac923bba7 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -2323,13 +2323,16 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, return 0; } c = FETCH_CHAR_AS_MULTIBYTE (from_byte); + prev_syntax = syntax; syntax = SYNTAX_WITH_FLAGS (c); code = syntax & 0xff; if (code == Sendcomment && SYNTAX_FLAGS_COMMENT_STYLE (syntax, 0) == style && (SYNTAX_FLAGS_COMMENT_NESTED (syntax) ? (nesting > 0 && --nesting == 0) : nesting < 0) - && !(comment_end_can_be_escaped && char_quoted (from, from_byte))) + && !(comment_end_can_be_escaped + && ((prev_syntax & 0xff) == Sescape + || (prev_syntax & 0xff) == Scharquote))) /* We have encountered a comment end of the same style as the comment sequence which began this comment section. */ @@ -2353,7 +2356,11 @@ forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, inc_both (&from, &from_byte); UPDATE_SYNTAX_TABLE_FORWARD (from); if (from == stop) continue; /* Failure */ - } + c = FETCH_CHAR_AS_MULTIBYTE (from_byte); + prev_syntax = syntax; + syntax = Smax; + code = syntax; + } inc_both (&from, &from_byte); UPDATE_SYNTAX_TABLE_FORWARD (from); @@ -3334,7 +3341,14 @@ do { prev_from = from; \ are invalid now. Luckily, the `done' doesn't use them and the INC_FROM sets them to a sane value without looking at them. */ - if (!found) goto done; + if (!found) + { + if ((prev_from_syntax & 0xff) == Sescape + || (prev_from_syntax & 0xff) == Scharquote) + goto endquoted; + else + goto done; + } INC_FROM; state->incomment = 0; state->comstyle = 0; /* reset the comment style */ From d4ff1d74209e97730c52ddd50c4d643c79087a33 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Fri, 12 May 2023 15:28:06 -0400 Subject: [PATCH 4/4] Use faster option for running vc-hg status (Bug#63470) In modern Mercurial, removing the "re:" "-I" "." options provides a 10x-20x speedup because it allows the Rust implementation of "hg status" to be used. * lisp/vc/vc-hg.el (vc-hg--program-version): Add. (vc-hg-dir-status-files): Use --config commands.status.relative=1 to make paths relative when available. --- lisp/vc/vc-hg.el | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el index 78480fd8062..182d76882bb 100644 --- a/lisp/vc/vc-hg.el +++ b/lisp/vc/vc-hg.el @@ -1372,17 +1372,28 @@ REV is the revision to check out into WORKFILE." ;; Follows vc-exec-after. (declare-function vc-set-async-update "vc-dispatcher" (process-buffer)) +(defvar vc-hg--program-version nil) + +(defun vc-hg--program-version () + (or vc-hg--program-version + (setq vc-hg--program-version + (with-temp-buffer + (condition-case _ (vc-hg-command t 0 nil "version") + (error "0") + (:success + (goto-char (point-min)) + (re-search-forward "Mercurial Distributed SCM (version \\([0-9][0-9.]+\\)") + (string-trim-right (match-string 1) "\\."))))))) + (defun vc-hg-dir-status-files (dir files update-function) ;; XXX: We can't pass DIR directly to 'hg status' because that ;; returns all ignored files if FILES is non-nil (bug#22481). (let ((default-directory dir)) - ;; TODO: Use "--config 'status.relative=1'" instead of "re:" - ;; when we're allowed to depend on Mercurial 4.2+ - ;; (it's a bit faster). - (vc-hg-command (current-buffer) 'async files - "status" "re:" "-I" "." - (concat "-mardu" (if files "i")) - "-C")) + (apply #'vc-hg-command (current-buffer) 'async files + "status" (concat "-mardu" (if files "i")) "-C" + (if (version<= "4.2" (vc-hg--program-version)) + '("--config" "commands.status.relative=1") + '("re:" "-I" ".")))) (vc-run-delayed (vc-hg-after-dir-status update-function)))