master e88195732e7 1/3: Merge from origin/emacs-31

Eli Zaretskii <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit e88195732e788ba1d8fb46d289332660599bd83e
Merge: 945667d1053 a027452c715
Author: Eli Zaretskii <[email protected]>
Commit: Eli Zaretskii <[email protected]>

    Merge from origin/emacs-31
    
    a027452c715 Fix progress-reporter-echo-area update-text
    bc92224c5f1 VC-Git: Pass --no-optional-locks
    ed1a2e82390 Fix text-property-search-backward skipping one character ...
---
 lisp/emacs-lisp/text-property-search.el            | 10 +++++-----
 lisp/subr.el                                       |  2 +-
 lisp/vc/vc-git.el                                  | 15 +++++++++++++--
 test/lisp/emacs-lisp/text-property-search-tests.el | 16 ++++++++--------
 4 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/lisp/emacs-lisp/text-property-search.el b/lisp/emacs-lisp/text-property-search.el
index f7709b27f31..4396a1212f8 100644
--- a/lisp/emacs-lisp/text-property-search.el
+++ b/lisp/emacs-lisp/text-property-search.el
@@ -174,12 +174,12 @@ and if a matching region is found, place point at the start of the region."
             (progn
               (goto-char origin)
               (setq ended t))
-          (goto-char (1- pos))
-          (if (text-property--match-p value (get-text-property (point) property)
+          (goto-char pos)
+          (if (text-property--match-p value (get-text-property (1- (point)) property)
                                       predicate)
               (setq ended
                     (text-property--find-end-backward
-                     (point) property value predicate))
+                     (1- (point)) property value predicate))
             ;; Skip past this section of non-matches.
             (setq pos (previous-single-property-change (point) property))
             (unless pos
@@ -203,9 +203,9 @@ and if a matching region is found, place point at the start of the region."
                   (goto-char (point-min))
                   (setq end (point)
                         ended t))
-              (goto-char (1- end))
+              (goto-char end)
               (unless (text-property--match-p
-                       value (get-text-property (point) property) predicate)
+                       value (get-text-property (1- (point)) property) predicate)
                 (goto-char end)
                 (setq ended t)))))
       ;; End this at the first place the property changes value.
diff --git a/lisp/subr.el b/lisp/subr.el
index a4705488540..d3818ac9292 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -7238,7 +7238,7 @@ area is busy with something else."
     (unless (and (eq (progress-reporter-context reporter) 'async)
                  (current-message)
                  (not (string-prefix-p text (current-message))))
-      (setq update-text (concat (if update-text " " "") update-text))
+      (setq update-text (if update-text (format " %s" update-text) ""))
       (pcase state
         ((pred floatp)
          (if (plusp state)
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index cb4943f15e6..c98b01fe262 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -2911,6 +2911,13 @@ page for the meanings of these attributes."
                (equal subcommand "status"))
            '("GIT_OPTIONAL_LOCKS=0"))))
 
+;; This is for the same purpose as `vc-git--env-vars' except that it
+;; covers older Git, which doesn't recognise the environment variable.
+(defun vc-git--no-optional-locks (subcommand)
+  (and (or revert-buffer-in-progress
+           (equal subcommand "status"))
+       '("--no-optional-locks")))
+
 (defun vc-git-command (buffer okstatus file-or-list &rest flags)
   "A wrapper around `vc-do-command' for use in vc-git.el.
 The difference to `vc-do-command' is that this function always invokes
@@ -2956,7 +2963,9 @@ The difference to `vc-do-command' is that this function always invokes
                   ".")
                  ((not file-list-is-rootdir)
                   file-or-list))
-           (cons "--no-pager" flags))))
+           (cons "--no-pager"
+                 (append (vc-git--no-optional-locks (car flags))
+                         flags)))))
 
 (defun vc-git--empty-db-p ()
   "Check if the git db is empty (no commit done yet)."
@@ -2976,7 +2985,9 @@ The difference to `vc-do-command' is that this function always invokes
 	(process-environment (append (vc-git--env-vars command)
                                      process-environment)))
     (apply #'process-file vc-git-program infile buffer nil
-           "--no-pager" command args)))
+           (cons "--no-pager"
+                 (append (vc-git--no-optional-locks command)
+                         (cons command args))))))
 
 (defun vc-git--out-ok (command &rest args)
   "Run `git COMMAND ARGS...' and insert standard output in current buffer.
diff --git a/test/lisp/emacs-lisp/text-property-search-tests.el b/test/lisp/emacs-lisp/text-property-search-tests.el
index 57d7f272b80..4fe90d1b41b 100644
--- a/test/lisp/emacs-lisp/text-property-search-tests.el
+++ b/test/lisp/emacs-lisp/text-property-search-tests.el
@@ -36,7 +36,7 @@
           " and this is "
           (propertize "italic1" 'face 'italic)
           (propertize "bold2" 'face 'bold)
-          (propertize "italic2" 'face 'italic)
+          (propertize "i" 'face 'italic) ; One char long to test bug#81539.
           " at the end")
   (goto-char (point-min)))
 
@@ -59,7 +59,7 @@
 
 (ert-deftest text-property-search-forward-bold-nil ()
   (with-test (text-property-search-forward 'face 'bold nil)
-             '("This is " " and this is italic1" "italic2 at the end")))
+             '("This is " " and this is italic1" "i at the end")))
 
 (ert-deftest text-property-search-forward-nil-t ()
   (with-test (text-property-search-forward 'face nil t)
@@ -67,7 +67,7 @@
 
 (ert-deftest text-property-search-forward-nil-nil ()
   (with-test (text-property-search-forward 'face nil nil)
-             '("bold1" "italic1" "bold2" "italic2")))
+             '("bold1" "italic1" "bold2" "i")))
 
 (ert-deftest text-property-search-forward-partial-bold-t ()
   (with-test (text-property-search-forward 'face 'bold t)
@@ -87,7 +87,7 @@
 
 (ert-deftest text-property-search-backward-bold-nil ()
   (with-test (text-property-search-backward 'face 'bold nil)
-             '( "italic2 at the end" " and this is italic1" "This is ")
+             '("i at the end" " and this is italic1" "This is ")
              (point-max)))
 
 (ert-deftest text-property-search-backward-nil-t ()
@@ -97,7 +97,7 @@
 
 (ert-deftest text-property-search-backward-nil-nil ()
   (with-test (text-property-search-backward 'face nil nil)
-             '("italic2" "bold2" "italic1" "bold1")
+             '("i" "bold2" "italic1" "bold1")
              (point-max)))
 
 (ert-deftest text-property-search-backward-partial-bold-t ()
@@ -138,19 +138,19 @@
 (ert-deftest text-property-search-backward-prop-match-match-face-nil-nil ()
   (with-match-test
    (text-property-search-backward 'face nil nil)
-   39 46 'italic
+   39 40 'italic
    (point-max)))
 
 (ert-deftest text-property-search-backward-prop-match-match-face-italic-t ()
   (with-match-test
    (text-property-search-backward 'face 'italic t)
-   39 46 'italic
+   39 40 'italic
    (point-max)))
 
 (ert-deftest text-property-search-backward-prop-match-match-face-italic-nil ()
   (with-match-test
    (text-property-search-backward 'face 'italic nil)
-   46 57 nil
+   40 51 nil
    (point-max)))
 
 
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.