master 017c7c8c871 1/7: Merge from origin/emacs-31

Eli Zaretskii <[email protected]> Sat, 4 Jul 2026 04:30:54 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit 017c7c8c871e373546a3c01d73ed6e5cc8088b94
Merge: 43f2c8f9699 7b812bc38aa
Author: Eli Zaretskii <[email protected]>
Commit: Eli Zaretskii <[email protected]>

    Merge from origin/emacs-31
    
    7b812bc38aa Don't use window manager activation when a child frame ha...
    b8f71a60119 Compile User Lisp files after adjusting 'load-path'
    1ac2f60b534 Fix strange logic in vc-git-incoming-revision
    10ae134ceba ; Add new text for xdisp.c
    4d2701ecde9 Fix 'format-mode-line' when faces are in format string
    a34c29e4598 Restore frame's fullheight/fullwidth after exiting from f...
    c12c91563ee Fix interactive mode spec of `xwidget-webkit-end-edit-tex...
    
    # Conflicts:
    #       src/xterm.c
---
 lisp/startup.el         | 15 ++++++++-------
 lisp/vc/vc-git.el       | 34 ++++++++++++----------------------
 lisp/xwidget.el         |  2 +-
 src/xdisp.c             | 18 ++++++++++++++----
 src/xterm.c             | 31 ++++++-------------------------
 test/src/xdisp-tests.el | 21 ++++++++++++++++++++-
 6 files changed, 61 insertions(+), 60 deletions(-)

diff --git a/lisp/startup.el b/lisp/startup.el
index e6f2087604f..24cb3fc2582 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1263,22 +1263,23 @@ unconditionally."
             (not (string-match-p ignored (file-name-nondirectory dir)))))
          (dir (expand-file-name user-lisp-directory))
          (backup-inhibited t)
-         (dirs (list dir)))
+         (dirs (list dir)) (files '()))
     (add-to-list 'load-path (directory-file-name dir))
     (dolist (file (directory-files-recursively dir "" t pred t))
       (cond
        ((and (file-regular-p file) (string-suffix-p ".el" file))
-        (unless just-activate
-          (with-demoted-errors "Error while compiling: %S"
-            (byte-recompile-file file force 0)
-            (when (native-comp-available-p)
-              (native-compile-async file)))))
+        (push file files))
        ((and (file-directory-p file)
              (not (string-match-p ignored (file-name-nondirectory file))))
         (add-to-list 'load-path (directory-file-name file))
         (push file dirs))))
     (unless just-activate
-      (loaddefs-generate dirs autoload-file nil nil nil force))
+      (loaddefs-generate dirs autoload-file nil nil nil force)
+      (dolist (file files)
+        (with-demoted-errors "Error while compiling: %S"
+          (byte-recompile-file file force 0)
+          (when (native-comp-available-p)
+            (native-compile-async file)))))
     (when (file-exists-p autoload-file)
       (load autoload-file nil t))))
 
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 73b0df4d16b..638edd6c703 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1925,28 +1925,18 @@ If LIMIT is a non-empty string, use it as a base revision."
 		'("--")))))))
 
 (defun vc-git-incoming-revision (&optional upstream-location refresh)
-  (let* ((remotes (and (not upstream-location) (vc-git--branch-remotes)))
-         (rev (or upstream-location
-                  (cdr (assq 'push remotes))
-                  (cdr (assq 'upstream remotes)))))
-    (when (and (or refresh (null (vc-git--rev-parse rev)))
-               ;; If the branch has no upstream, and we weren't supplied
-               ;; with one, then fetching is always useless (bug#79952).
-               (or upstream-location
-                   (and-let* ((branch (vc-git-working-branch)))
-                     (with-temp-buffer
-                       (vc-git--out-ok "config" "--get"
-                                       (format "branch.%s.remote"
-                                               branch))))))
-      (vc-git-command nil 0 nil "fetch"
-                      (and upstream-location
-                           ;; Extract remote from "remote/branch".
-                           (replace-regexp-in-string "/.*" ""
-                                                     upstream-location))))
-    (ignore-errors            ; in order to return nil if no such branch
-      (with-output-to-string
-        (vc-git-command standard-output 0 nil
-                        "log" "--max-count=1" "--pretty=format:%H" rev)))))
+  (let ((remotes (and (not upstream-location) (vc-git--branch-remotes))))
+    (and-let* ((rev (or upstream-location
+                        (cdr (assq 'push remotes))
+                        (cdr (assq 'upstream remotes)))))
+      (when (or refresh (null (vc-git--rev-parse rev)))
+        (vc-git-command nil 0 nil "fetch"
+                        ;; Extract remote from "remote/branch".
+                        (replace-regexp-in-string "/.*" "" rev)))
+      (ignore-errors          ; in order to return nil if no such branch
+        (with-output-to-string
+          (vc-git-command standard-output 0 nil
+                          "log" "--max-count=1" "--pretty=format:%H" rev))))))
 
 (defun vc-git-log-search (buffer pattern)
   "Search the log of changes for PATTERN and output results into BUFFER.
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index c75cd047495..a24814c0e89 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -672,7 +672,7 @@ XW is the xwidget identifier, TEXT is retrieved from the webkit."
 
 (defun xwidget-webkit-end-edit-textarea ()
   "End editing of a webkit text area."
-  (interactive nil xwidget-webkit-mode)
+  (interactive)
   (goto-char (point-min))
   (while (search-forward "\n" nil t)
     (replace-match "\\n" nil t))
diff --git a/src/xdisp.c b/src/xdisp.c
index e08c52078be..0ce9c4ebab9 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -28973,14 +28973,24 @@ store_mode_line_string (const char *string, Lisp_Object lisp_string,
       if (!NILP (mode_line_string_face))
 	{
 	  Lisp_Object face;
-	  if (NILP (props))
-	    props = Ftext_properties_at (make_fixnum (0), lisp_string);
-	  face = plist_get (props, Qface);
+	  Lisp_Object string_face =
+	    plist_get (Ftext_properties_at (make_fixnum (0), lisp_string),
+		       Qface);
+	  /* Use the face in PROPS, if any, falling back to the face of
+	     LISP_STRING.  */
+	  face = string_face;
+	  if (!NILP (props))
+	    {
+	      Lisp_Object propface = plist_get (props, Qface);
+	      if (!NILP (propface))
+		face = propface;
+	    }
 	  if (NILP (face))
 	    face = mode_line_string_face;
 	  else
 	    face = list2 (face, mode_line_string_face);
-	  props = list2 (Qface, face);
+	  props = Fcopy_sequence (props);
+	  props = plist_put (props, Qface, face);
 	  if (copy_string)
 	    lisp_string = Fcopy_sequence (lisp_string);
 	}
diff --git a/src/xterm.c b/src/xterm.c
index aaccc563839..549b5007f26 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -28122,7 +28122,8 @@ do_ewmh_fullscreen (struct frame *f)
 		  || cur == FULLSCREEN_MAXIMIZED)
 		set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
 			      dpyinfo->Xatom_net_wm_state_maximized_vert);
-	      if (cur != FULLSCREEN_MAXIMIZED || x_frame_normalize_before_maximize)
+	      if ((cur != FULLSCREEN_MAXIMIZED  && cur != FULLSCREEN_BOTH)
+		  || x_frame_normalize_before_maximize)
 		set_wm_state (frame, true,
 			      dpyinfo->Xatom_net_wm_state_maximized_horz, None);
 	    }
@@ -28142,7 +28143,8 @@ do_ewmh_fullscreen (struct frame *f)
 		  || cur == FULLSCREEN_MAXIMIZED)
 		set_wm_state (frame, false, dpyinfo->Xatom_net_wm_state_fullscreen,
 			      dpyinfo->Xatom_net_wm_state_maximized_horz);
-	      if (cur != FULLSCREEN_MAXIMIZED || x_frame_normalize_before_maximize)
+	      if ((cur != FULLSCREEN_MAXIMIZED && cur != FULLSCREEN_BOTH)
+		  || x_frame_normalize_before_maximize)
 		set_wm_state (frame, true,
 			      dpyinfo->Xatom_net_wm_state_maximized_vert, None);
 	    }
@@ -28948,25 +28950,6 @@ x_get_focus_frame (struct frame *f)
   return lisp_focus;
 }
 
-/* Return the toplevel parent of F, if it is a child frame.
-   Otherwise, return NULL.  */
-
-static struct frame *
-x_get_toplevel_parent (struct frame *f)
-{
-  struct frame *parent;
-
-  if (!FRAME_PARENT_FRAME (f))
-    return NULL;
-
-  parent = FRAME_PARENT_FRAME (f);
-
-  while (FRAME_PARENT_FRAME (parent))
-    parent = FRAME_PARENT_FRAME (parent);
-
-  return parent;
-}
-
 static void
 x_set_input_focus (struct x_display_info *dpyinfo, Window window,
 		   Time time)
@@ -29090,11 +29073,9 @@ x_focus_frame (struct frame *f, bool noactivate)
 	     may not work if its parent is not activated.  */
 	  && !FRAME_PARENT_FRAME (f)
 	  /* If the focus is being transferred from a child frame to
-	     its toplevel parent, also use SetInputFocus.  */
+	     another frame, also use SetInputFocus.  */
 	  && (!dpyinfo->x_focus_frame
-	      || (x_get_toplevel_parent (dpyinfo->x_focus_frame)
-		  != f))
-	  && x_wm_supports (f, dpyinfo->Xatom_net_active_window)
+	      || !FRAME_PARENT_FRAME (dpyinfo->x_focus_frame))
 	  && !EQ (focus_follows_mouse, Qauto_raise))
 	{
 	  /* When window manager activation is possible, use it
diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el
index 4369c00ca34..f3df858e218 100644
--- a/test/src/xdisp-tests.el
+++ b/test/src/xdisp-tests.el
@@ -190,6 +190,25 @@ int main () {
     (insert (format-mode-line
              (propertize "x" 'face 'bold-italic)
              1200000000000000000000000000))
-    (should (null (get-text-property 1 'face)))))
+    (should (null (get-text-property 1 'face))))
+  (should
+   (equal
+    (text-properties-at
+     0
+     (format-mode-line '((:propertize "Hello!" face bold)) 'mode-line))
+    (list 'face '(bold mode-line) 'mode-line-elt-no 3)))
+  (with-temp-buffer
+    ;; This test is due to Markus Triska <[email protected]>.
+    (let ((m1 (format-mode-line mode-line-format nil))
+	  (m2 (format-mode-line mode-line-format 'default))
+	  s1 s2)
+      (font-lock-mode 0)
+      (insert "\n")
+      (insert m1)
+      (setq s1 (window-text-pixel-size nil (line-beginning-position) (point)))
+      (insert "\n")
+      (insert m2)
+      (setq s2 (window-text-pixel-size nil (line-beginning-position) (point)))
+      (should (equal m1 m2)))))
 
 ;;; xdisp-tests.el ends here