master 202d29726d8: Merge from origin/emacs-31

Sean Whitton <[email protected]> Tue, 7 Jul 2026 11:02:16 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit 202d29726d8a8494637cd54c6dc09bffcda6bd24
Merge: 0f043af4dd0 0748af27c03
Author: Sean Whitton <[email protected]>
Commit: Sean Whitton <[email protected]>

    Merge from origin/emacs-31
    
    0748af27c03 ; * admin/notes/repo (Bisecting): Refine 'git bisect run'...
    c565251dd6a ; * admin/notes/repo (Bisecting): Provide a 'git bisect r...
    ba781ed7544 Fix blinking Eldoc messages
    3e7908fe233 ; Fix two tests
    924d88a736e ; Warn about killed buffers returned by 'window-prev-buff...
    b07e634e4cf Fix undefined behavior in pbm_load
    5404761a477 ; Correct treesit-font-lock-level customize type (issue#8...
    6464453558e Avoid destructively modifying 'package--builtin-alist'
    ffad15bf738 Update to Org 9.8.7
    9ab1aa887ab Ensure, that `buffer-file-name' is expanded in tramp-archive
    4721a44e8ab ; * doc/lispref/buffers.texi (Buffer File Name): Clarify ...
    9777acdc95a ; etc/NEWS: Fix duplicate "Emacs Lisp mode" heading.
    
    # Conflicts:
    #       etc/NEWS
---
 admin/notes/repo                    | 30 ++++++++++++++++++++++++++++++
 doc/lispref/buffers.texi            |  7 ++++---
 doc/lispref/windows.texi            |  5 +++++
 doc/misc/org.org                    | 18 ++++++++++--------
 etc/NEWS.31                         | 16 +++++++---------
 etc/refcards/orgcard.tex            |  2 +-
 lisp/emacs-lisp/eldoc.el            | 11 +++++++++--
 lisp/emacs-lisp/package.el          |  4 ++--
 lisp/net/tramp-archive.el           |  3 ++-
 lisp/org/org-agenda.el              |  6 ++++--
 lisp/org/org-feed.el                |  2 +-
 lisp/org/org-version.el             |  4 ++--
 lisp/org/org.el                     |  2 +-
 lisp/org/ox-beamer.el               |  1 +
 lisp/treesit.el                     |  2 +-
 src/image.c                         | 23 +++++++++++++----------
 src/window.c                        |  6 +++++-
 test/manual/cedet/semantic-tests.el |  2 +-
 test/src/undo-tests.el              |  2 +-
 19 files changed, 100 insertions(+), 46 deletions(-)

diff --git a/admin/notes/repo b/admin/notes/repo
index 2ed51c5cfc7..5bf6c9d0218 100644
--- a/admin/notes/repo
+++ b/admin/notes/repo
@@ -118,6 +118,8 @@ again.
 This is a semi-automated way to find the revision that introduced a bug.
 Browse 'git help bisect' for technical instructions.
 
+** Starting a bisection
+
 It is recommended to start a bisection with the admin/git-bisect-start
 script.  Using that script ensures that commits in branches that are
 the result of merging external trees into the Emacs repository, as
@@ -126,6 +128,34 @@ during the bisection process.  That script can also be executed
 automatically when 'git bisect start' is called, with the help of a
 wrapper script that is included in its commentary section.
 
+** Automated bisection
+
+In the case that you have a command which exits non-zero if and only if
+the bug is present, then after starting the bisection, you can have Git
+automatically recompile Emacs at the relevant revisions and run that
+command for you, recording a result based on the exit code.
+
+Suppose 'emacs -batch -eval "(foo)"' exits non-zero if and only if the
+bug is present.  Then you may be able to use something like this:
+
+    git bisect run sh -xc '{ test -e Makefile && { make || make bootstrap; }; } \
+	|| { git clean -xdff && ./autogen.sh autoconf && ./configure && make; } \
+	|| exit 125; src/emacs -batch -eval "(foo)"'
+
+This tries to recompile Emacs, tries a bootstrap build if that fails,
+and completely empties out your working tree of build products with 'git
+clean -xdff' if even that fails.  If that isn't enough for a successful
+build, returning code 125 tells Git to skip evaluating that commit.
+
+You can substitute in any options to './configure' you need on your
+machine, and the test command at the end.  It is usually best to
+configure with '--without-native-compilation' for rebuild speed, unless
+the bug only occurs with native compilation enabled.
+
+Note that this runs 'git clean -xdff', which deletes **any and all
+untracked files**, so it is best to run it in a throwaway Git worktree.
+You can create these using 'C-x v w c' from inside Emacs.
+
 * Maintaining ChangeLog history
 
 Older ChangeLog entries are kept in history files named ChangeLog.1,
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 054efba9ae1..33fab9e89bc 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -391,7 +391,7 @@ the buffer name are distinct and can be set independently.
 @xref{Visiting Files}.
 
 @defun buffer-file-name &optional buffer
-This function returns the absolute file name of the file that
+This function returns the fully-expanded absolute file name of the file that
 @var{buffer} is visiting.  If @var{buffer} is not visiting any file,
 @code{buffer-file-name} returns @code{nil}.  If @var{buffer} is not
 supplied, it defaults to the current buffer.
@@ -405,10 +405,11 @@ supplied, it defaults to the current buffer.
 @end defun
 
 @defvar buffer-file-name
-This buffer-local variable contains the name of the file being visited
+This buffer-local variable contains the absolute name of the file being visited
 in the current buffer, or @code{nil} if it is not visiting a file.  It
 is a permanent local variable, unaffected by
-@code{kill-all-local-variables}.
+@code{kill-all-local-variables}.  The value is identical to the one
+which the @code{buffer-file-name} function returns.
 
 @example
 @group
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 16b82a6a29e..9caaa5e6901 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -4939,6 +4939,11 @@ and @var{window-pos} is a marker that gives the window point position
 The list is ordered so that earlier elements correspond to more
 recently-shown buffers, and the first element usually corresponds to the
 buffer most recently removed from the window.
+
+As a rule, elements are removed from this list when their buffer gets
+killed.  In rare cases, however, elements may have survived the killing
+of their buffer.  It's a good idea therefore to always check buffers for
+liveness when processing the return value of this function.
 @end defun
 
 @defun set-window-prev-buffers window prev-buffers
diff --git a/doc/misc/org.org b/doc/misc/org.org
index 8644109a6a1..d4bf8cb009c 100644
--- a/doc/misc/org.org
+++ b/doc/misc/org.org
@@ -10013,8 +10013,8 @@ entries with a =NEXT= TODO keyword.
          ((org-agenda-max-entries 5)))))
 #+end_src
 
-Once you mark one of these five entry as DONE, rebuilding the agenda
-will again the next five entries again, including the first entry that
+Once you mark one of these five entries as DONE, rebuilding the agenda
+will show the next five entries again, including the first entry that
 was excluded so far.
 
 You can also dynamically set temporary limits, which are lost when
@@ -10269,7 +10269,7 @@ the other commands, point needs to be in the desired line.
   Toggle Archives mode.  In Archives mode, trees that are archived
   (see [[*Internal archiving]]) are also scanned when producing the
   agenda.  To exit archives mode, press {{{kbd(v a)}}} again.  The
-  initial setting for this mode in new agenda buffers can set with the
+  initial setting for this mode in new agenda buffers can be set with the
   variable ~org-agenda-start-with-archives-mode~, which can be set
   with the same values as ~org-agenda-archives-mode~.
 
@@ -14552,11 +14552,13 @@ include:
   #+vindex: org-latex-tables-booktabs
   #+vindex: org-latex-tables-centered
   All three commands are toggles.  =:booktabs= brings in modern
-  typesetting enhancements to regular tables.  The booktabs package
-  has to be loaded through ~org-latex-packages-alist~.  =:center= is
-  for centering the table.  =:rmlines= removes all but the very first
-  horizontal line made of ASCII characters from "table.el" tables
-  only.
+  typesetting enhancements to regular tables.  The =booktabs= package
+  needs to be loaded through ~org-latex-packages-alist~, unless it is
+  already included by your document class[fn:: For example,
+  [[https://authors.acm.org/proceedings/production-information/preparing-your-article-with-latex][the
+  ACM article template]].].  =:center= is for centering the table.
+  =:rmlines= removes all but the very first horizontal line made of
+  ASCII characters from "table.el" tables only.
 
 - =:math-prefix=, =:math-suffix=, =:math-arguments= ::
 
diff --git a/etc/NEWS.31 b/etc/NEWS.31
index 89c8e592f9c..4609e9b6910 100644
--- a/etc/NEWS.31
+++ b/etc/NEWS.31
@@ -1640,15 +1640,6 @@ at run-time for the use of the associated deprecated features.
 '(setq eieio-backward-compatibility t)' can be used to recover
 the previous silence.
 
-** Emacs Lisp mode
-
-+++
-*** Semantic highlighting support for Emacs Lisp.
-'emacs-lisp-mode' can now use code analysis to highlight more symbols
-more accurately.  Customize the new user option
-'elisp-fontify-semantically' to non-nil to enable this feature, and see
-the Info node "(emacs) Semantic Font Lock" for more information.
-
 ** Text mode
 
 ---
@@ -2338,6 +2329,13 @@ To get the old behavior back, add an element '(enum-open
 
 ** Emacs Lisp mode
 
++++
+*** Semantic highlighting support for Emacs Lisp.
+'emacs-lisp-mode' can now use code analysis to highlight more symbols
+more accurately.  Customize the new user option
+'elisp-fontify-semantically' to non-nil to enable this feature, and see
+the Info node "(emacs) Semantic Font Lock" for more information.
+
 ---
 *** Checkdoc no longer warns about missing footer lines in some cases.
 Emacs Lisp libraries have traditionally ended with a footer line
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 300af8d9d8c..f558d05ae74 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,5 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{9.8.6}
+\def\orgversionnumber{9.8.7}
 \def\versionyear{2026}          % latest update
 \input emacsver.tex
 
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 55f9fb1988b..d1c56b7f82f 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -144,6 +144,11 @@ 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."
   :type 'boolean
+  :set (lambda (sym val)
+         (custom-set-default sym val)
+         (if val
+             (add-hook 'eldoc-documentation-functions #'eldoc-show-help-at-pt 90)
+           (remove-hook 'eldoc-documentation-functions #'eldoc-show-help-at-pt)))
   :version "31.1")
 
 (defface eldoc-highlight-function-argument
@@ -417,7 +422,7 @@ Also store it in `eldoc-last-message' and return that value."
                       (overlay-end show-paren--overlay)))))))
 
 
-(defvar eldoc-documentation-functions (list #'eldoc-show-help-at-pt)
+(defvar eldoc-documentation-functions nil
   "Hook of functions that produce doc strings.
 
 A doc string is typically relevant if point is on a function-like
@@ -813,7 +818,9 @@ all."
 
 (defun eldoc--supported-p ()
   "Non-nil if an ElDoc function is set for this buffer."
-  (and (not (memq eldoc-documentation-strategy '(nil ignore)))
+  ;; Exclude ephemeral *eldoc* buffers, to avoid blinking (bug#81356).
+  (and (not (string-prefix-p " *eldoc" (buffer-name)))
+       (not (memq eldoc-documentation-strategy '(nil ignore)))
        (or eldoc-documentation-functions
            ;; The old API had major modes set `eldoc-documentation-function'
            ;; to provide eldoc support.  It's impossible now to determine
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 67474ccf0f7..062659fc912 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -2186,8 +2186,8 @@ NAME should be a symbol."
                   (package-desc-version (cadr elt))
                   (package-desc-version available)))
              (not (package-vc-p (cadr elt))))))
-    (nconc (and include-builtins (package--builtin-alist))
-           (package--alist)))))
+    (append (and include-builtins (package--builtin-alist))
+            (package--alist)))))
 
 ;;;###autoload
 (defun package-upgrade-all (&optional query)
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index e970fd1cd56..2c7a65b375f 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -710,11 +710,12 @@ offered."
 (defun tramp-archive-handle-insert-file-contents
   (filename &optional visit beg end replace)
   "Like `insert-file-contents' for file archives."
+  (setq filename (expand-file-name filename))
   (let ((result
 	 (insert-file-contents
 	  (tramp-archive-gvfs-file-name filename) visit beg end replace)))
     (when visit (setq buffer-file-name filename))
-    (cons (expand-file-name filename) (cdr result))))
+    (cons filename (cdr result))))
 
 (defun tramp-archive-handle-load
     (file &optional noerror nomessage nosuffix must-suffix)
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 481eba50313..d727ab4cef0 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -9723,8 +9723,10 @@ the dedicated frame."
 	 (pos (marker-position marker)))
     (with-current-buffer buffer
       (save-excursion
-	(goto-char pos)
-	(org-tree-to-indirect-buffer arg))))
+	(save-restriction
+	  (widen)
+	  (goto-char pos)
+	  (org-tree-to-indirect-buffer arg)))))
   (setq org-agenda-last-indirect-buffer org-last-indirect-buffer))
 
 (defvar org-last-heading-marker (make-marker)
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el
index 139c7f729ef..8ed79121711 100644
--- a/lisp/org/org-feed.el
+++ b/lisp/org/org-feed.el
@@ -112,7 +112,7 @@
 
 (defcustom org-feed-alist nil
   "Alist specifying RSS feeds that should create inputs for Org.
-Each entry in this list specified an RSS feed tat should be queried
+Each entry in this list specified an RSS feed that should be queried
 to create inbox items in Org.  Each entry is a list with the following items:
 
 name         a custom name for this feed
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index 25cbd97621b..9a46c453c2f 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -5,13 +5,13 @@
 (defun org-release ()
   "The release version of Org.
 Inserted by installing Org mode or when a release is made."
-   (let ((org-release "9.8.6"))
+   (let ((org-release "9.8.7"))
      org-release))
 ;;;###autoload
 (defun org-git-version ()
   "The Git version of Org mode.
 Inserted by installing Org or when a release is made."
-   (let ((org-git-version "release_9.8.6"))
+   (let ((org-git-version "release_9.8.7"))
      org-git-version))
 
 (provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index be9f31ecc9e..a20ecc3c38f 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -9,7 +9,7 @@
 ;; URL: https://orgmode.org
 ;; Package-Requires: ((emacs "28.2"))
 
-;; Version: 9.8.6
+;; Version: 9.8.7
 
 ;; This file is part of GNU Emacs.
 ;;
diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el
index 72fe18acdb8..302ebdc6a40 100644
--- a/lisp/org/ox-beamer.el
+++ b/lisp/org/ox-beamer.el
@@ -4,6 +4,7 @@
 
 ;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
 ;;         Nicolas Goaziou <n.goaziou AT gmail DOT com>
+;; Maintainer: Pedro A. Aranda <paaguti aT gmail d.T com>
 ;; Keywords: org, text, tex
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/treesit.el b/lisp/treesit.el
index b5c7f2852d8..43544160cb3 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1598,7 +1598,7 @@ variable `treesit-font-lock-feature-list'.
 
 Setting this variable directly with `setq' or `let' doesn't work;
 use `setopt' or \\[customize-option] instead."
-  :type 'integer
+  :type '(choice integer (alist :key-type symbol :value-type integer))
   :set #'treesit--font-lock-level-setter
   :version "29.1")
 
diff --git a/src/image.c b/src/image.c
index 9724094f81c..1086f474eec 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7774,19 +7774,22 @@ pbm_load (struct frame *f, struct image *img)
     }
   else
     {
-      int expected_size = height * width;
       bool two_byte = 255 < max_color_idx;
-      if (two_byte)
-	expected_size *= 2;
-      if (type == PBM_COLOR)
-	expected_size *= 3;
 
-      if (raw_p && p + expected_size > end)
+      if (raw_p)
 	{
-	  image_destroy_x_image (ximg);
-	  image_clear_image (f, img);
-	  image_error ("Invalid image size in image `%s'", img->spec);
-	  goto error;
+	  ptrdiff_t expected_size;
+	  bool bad = ckd_mul (&expected_size, height, width);
+	  bad |= ckd_mul (&expected_size, expected_size,
+			  (two_byte ? 2 : 1) * (type == PBM_COLOR ? 3 : 1));
+	  bad |= end - p < expected_size;
+	  if (bad)
+	    {
+	      image_destroy_x_image (ximg);
+	      image_clear_image (f, img);
+	      image_error ("Invalid image size in image `%s'", img->spec);
+	      goto error;
+	    }
 	}
 
       for (y = 0; y < height; ++y)
diff --git a/src/window.c b/src/window.c
index 0f114412204..f5f2e1b91f0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2326,7 +2326,11 @@ WINDOW must be a live window and defaults to the selected one.
 
 The return value is a list of elements (BUFFER WINDOW-START POS),
 where BUFFER is a buffer, WINDOW-START is the start position of the
-window for that buffer, and POS is a window-specific point value.  */)
+window for that buffer, and POS is a window-specific point value.
+
+In rare ocasions BUFFER may have been already killed.  It's therefore
+advisable to always check the return value for the occurrence of dead
+buffers before using it.  */)
   (Lisp_Object window)
 {
   return decode_live_window (window)->prev_buffers;
diff --git a/test/manual/cedet/semantic-tests.el b/test/manual/cedet/semantic-tests.el
index 4bd29ebcfee..48b747f79f8 100644
--- a/test/manual/cedet/semantic-tests.el
+++ b/test/manual/cedet/semantic-tests.el
@@ -100,7 +100,7 @@ global enabled."
     (condition-case err
 	(semanticdb-enable-gnu-global-in-buffer)
       (error (if standardfile
-		 (error err)
+		 (signal err)
 	       (save-match-data
 		 (set-buffer (find-file-noselect semanticdb-test-gnu-global-startfile)))
 	       (semanticdb-enable-gnu-global-in-buffer))))
diff --git a/test/src/undo-tests.el b/test/src/undo-tests.el
index 55d3bfe8930..24fd47b88a7 100644
--- a/test/src/undo-tests.el
+++ b/test/src/undo-tests.el
@@ -58,7 +58,7 @@
       (error
        (unless (string= "No further undo information"
                         (cadr err))
-         (error err))))
+         (signal err))))
     (undo-boundary)
     (insert "This")
     (undo-boundary)