master a465009585b: Merge from origin/emacs-31

Sean Whitton <[email protected]> Fri, 10 Jul 2026 08:06:03 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit a465009585bbbb0011998ace6374cfa7723124b4
Merge: 300deca4a8f d0bd9b39a31
Author: Sean Whitton <[email protected]>
Commit: Sean Whitton <[email protected]>

    Merge from origin/emacs-31
    
    d0bd9b39a31 ; completion-pcm-bug80914: Only look at the car of the list.
    8e5c0386f18 Improve eldoc-help-at-pt docstrings
    f9a8c61f504 Fix 'eldoc-show-help-at-pt'
    7621ee1d012 Fix uninit read in Android TrueType font scan
    95ab9ef627b Fix OOB read in Android TrueType font scan
    4ccf2584e35 Have 'replace-buffer-in-windows' remove BUFFER-OR-NAME ev...
    0b30e299f51 Fix test breakage in files-tests
    549d2f86379 Check for a live buffer in 'quit-restore-window'
---
 lisp/emacs-lisp/eldoc.el      | 14 ++++++++------
 lisp/window.el                | 27 ++++++++++++++-------------
 src/sfnt.c                    | 10 +++++-----
 test/lisp/files-tests.el      |  4 ++--
 test/lisp/minibuffer-tests.el |  8 +++-----
 5 files changed, 32 insertions(+), 31 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index d1c56b7f82f..7b12024cba6 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -140,9 +140,9 @@ is only skipped if the documentation needs to be truncated there."
 
 (defcustom eldoc-help-at-pt nil
   "If non-nil, show `help-at-pt-kbd-string' at point via Eldoc.
-This setting is an alternative to `help-at-pt-display-when-idle'.  If
-the value is non-nil, `eldoc-show-help-at-pt' will show help-at-point
-via Eldoc."
+This setting is an alternative to `help-at-pt-display-when-idle'.  In
+order to enable help at point only in certain buffers add
+`eldoc-show-help-at-pt' locally to `eldoc-documentation-functions'."
   :type 'boolean
   :set (lambda (sym val)
          (custom-set-default sym val)
@@ -980,9 +980,11 @@ the docstrings eventually produced, using
              (eldoc--invoke-strategy nil))))))
 
 (defun eldoc-show-help-at-pt (&rest _)
-  "Show help at point via Eldoc if `eldoc-help-at-pt' is non-nil.
-Intended for `eldoc-documentation-functions' (which see)."
-  (when-let* ((help (and eldoc-help-at-pt (help-at-pt-kbd-string))))
+  "Show help at point via Eldoc taken from `help-at-pt-kbd-string'.
+This function is intended to be added buffer-locally by major modes to
+`eldoc-documentation-functions'.  In order to enable help at point
+globally, users can set `eldoc-help-at-pt' to t."
+  (when-let* ((help (help-at-pt-kbd-string)))
     (format "Help: %s" (substitute-command-keys help))))
 
 
diff --git a/lisp/window.el b/lisp/window.el
index 35b49a19a5e..06128cf0483 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5328,18 +5328,18 @@ buffer by itself."
 	      (set-window-dedicated-p window nil)
 	      (if (switch-to-prev-buffer window 'kill)
                   (and dedicated-side (set-window-dedicated-p window 'side))
-		(window--delete window nil 'kill))))))
-
-	(when (window-live-p window)
-	  ;; If the fourth elements of the 'quit-restore' or
-	  ;; 'quit-restore-prev' parameters equal BUFFER, these
-	  ;; parameters become useless - in 'quit-restore-window' the
-	  ;; fourth element must equal the buffer of WINDOW in order to
-	  ;; use that parameter.  If BUFFER is mentioned in the second
-	  ;; element of the parameter, 'quit-restore-window' cannot
-	  ;; possibly show BUFFER instead; so this parameter becomes
-	  ;; useless too.
-	  (unrecord-window-buffer window buffer t))))))
+		(window--delete window nil 'kill)))))))
+
+      (when (window-live-p window)
+	;; If the fourth elements of the 'quit-restore' or
+	;; 'quit-restore-prev' parameters equal BUFFER, these
+	;; parameters become useless - in 'quit-restore-window' the
+	;; fourth element must equal the buffer of WINDOW in order to
+	;; use that parameter.  If BUFFER is mentioned in the second
+	;; element of the parameter, 'quit-restore-window' cannot
+	;; possibly show BUFFER instead; so this parameter becomes
+	;; useless too.
+	(unrecord-window-buffer window buffer t)))))
 
 (defcustom quit-window-hook nil
   "Hook run before performing any other actions in the `quit-window' command."
@@ -5432,7 +5432,8 @@ elsewhere.  This value is used by `quit-windows-on'."
 	 (quit-restore-prev-2 (nth 2 quit-restore-prev))
          (prev-buffer (catch 'prev-buffer
                         (dolist (buf (window-prev-buffers window))
-                          (unless (eq (car buf) buffer)
+                          (when (and (not (eq (car buf) buffer))
+                                     (buffer-live-p (car buf)))
                             (throw 'prev-buffer (car buf))))))
          (dedicated (window-dedicated-p window))
 	 (frame (window-frame window))
diff --git a/src/sfnt.c b/src/sfnt.c
index d436421c79b..10fce7e4063 100644
--- a/src/sfnt.c
+++ b/src/sfnt.c
@@ -303,7 +303,7 @@ sfnt_read_table_directory (int fd)
 
   rc = read (fd, subtable->subtables, subtable_size);
 
-  if (rc == -1 || rc < offset)
+  if (rc == -1 || rc < subtable_size)
     {
       xfree (subtable);
       return NULL;
@@ -15626,8 +15626,8 @@ sfnt_vary_simple_glyph (struct sfnt_blend *blend, sfnt_glyph id,
 	      sfnt_swap16 (&coords[j]);
 	    }
 	}
-      else if ((index & 0xfff) > gvar->shared_coord_count)
-	/* index exceeds the number of shared tuples present.  */
+      else if (gvar->shared_coord_count <= (index & 0xfff))
+	/* The index is too large.  */
 	goto fail1;
       else
 	/* index points into gvar->axis_count coordinates making up
@@ -15987,8 +15987,8 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
 	      sfnt_swap16 (&coords[j]);
 	    }
 	}
-      else if ((index & 0xfff) > gvar->shared_coord_count)
-	/* index exceeds the number of shared tuples present.  */
+      else if (gvar->shared_coord_count <= (index & 0xfff))
+	/* The index is too large.  */
 	goto fail1;
       else
 	/* index points into gvar->axis_count coordinates making up
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 822e031e0bf..fdfc1f92b47 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -2160,10 +2160,10 @@ CALLERS-DIR specifies the value to let-bind
             (setq nb-saved-buffers 0)
             (with-current-buffer (car buffers)
               (cl-letf
-                  (((symbol-function 'read-key)
+                  (((symbol-function 'read-key-sequence-vector)
                     ;; Increase counter and answer 'n' when prompted
                     ;; to save a buffer.
-                    (lambda (&rest _) (incf nb-saved-buffers) ?n))
+                    (lambda (&rest _) (incf nb-saved-buffers) [?n]))
                    ;; Do not kill Emacs.
                    ((symbol-function 'kill-emacs) #'ignore)
                    (save-some-buffers-default-predicate callers-dir))
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index 59ae6ae3758..d7f0ae73d2b 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -349,11 +349,9 @@
         (input "pcm/s/cl"))
     ;; The pattern has a single `point' at the end rather than an extra
     ;; `point' after the "s".
-    (should (equal (completion-pcm--find-all-completions
-                    input #'completion--file-name-table nil (length input))
-                   '(("s" any "/" "cl" point)
-                     ("sources/clang" "sys/class")
-                     "pcm/" "")))))
+    (should (equal (car (completion-pcm--find-all-completions
+                    input #'completion--file-name-table nil (length input)))
+                   '("s" any "/" "cl" point)))))
 
 (ert-deftest completion-initials ()
   ;; Should expand initials: