emacs-31 df60bad1652: Update to Org 9.8.6

Kyle Meyer <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit df60bad16529e3709ef200adbf599da456509332
Author: Kyle Meyer <[email protected]>
Commit: Kyle Meyer <[email protected]>

    Update to Org 9.8.6
---
 etc/refcards/orgcard.tex | 2 +-
 lisp/org/ob-core.el      | 5 ++++-
 lisp/org/org-version.el  | 4 ++--
 lisp/org/org.el          | 9 ++++++---
 lisp/org/ox-latex.el     | 2 +-
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 8b38b98897e..300af8d9d8c 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -1,5 +1,5 @@
 % Reference Card for Org Mode
-\def\orgversionnumber{9.8.5}
+\def\orgversionnumber{9.8.6}
 \def\versionyear{2026}          % latest update
 \input emacsver.tex
 
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index a8ca1ccd080..13fa3a2c236 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -2976,6 +2976,7 @@ used as a string to be appended to #+begin_example line."
 		   (forward-line 0) (insert ": ") (forward-line 1)))
 		(t
 		 (goto-char beg)
+		 (unless (bolp) (insert "\n"))
 		 (insert (if results-switches
 			     (format "%s%s\n"
 				     (funcall maybe-cap "#+begin_example")
@@ -2984,7 +2985,9 @@ used as a string to be appended to #+begin_example line."
 		 (let ((p (point)))
 		   (if (markerp end) (goto-char end) (forward-char (- end beg)))
 		   (org-escape-code-in-region p (point)))
-		 (insert (funcall maybe-cap "#+end_example\n")))))))))
+		 (unless (bolp) (insert "\n"))
+		 (insert (funcall maybe-cap "#+end_example"))
+		 (unless (eolp) (insert "\n")))))))))
 
 (defun org-babel-update-block-body (new-body)
   "Update the body of the current code block to NEW-BODY."
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index f0a212f2ef0..25cbd97621b 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.5"))
+   (let ((org-release "9.8.6"))
      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.5"))
+   (let ((org-git-version "release_9.8.6"))
      org-git-version))
 
 (provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index ba31ad67bd1..be9f31ecc9e 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.5
+;; Version: 9.8.6
 
 ;; This file is part of GNU Emacs.
 ;;
@@ -9551,6 +9551,7 @@ When foo is written as FOO, upcase the #+BEGIN/END as well."
 	  (goto-char region-end)
 	  ;; Ignore empty lines at the end of the region.
 	  (skip-chars-backward " \r\t\n")
+	  (unless (eolp) (insert "\n") (forward-line -1))
 	  (end-of-line))
 	(unless (bolp) (insert "\n"))
 	(indent-to column)
@@ -9877,7 +9878,8 @@ When called through Elisp, arg is also interpreted in the following way:
 	      (org-update-parent-todo-statistics))
 	    (when (bound-and-true-p org-clock-out-when-done)
 	      (org-clock-out-if-current))
-	    (run-hooks 'org-after-todo-state-change-hook)
+            (save-excursion
+	      (run-hooks 'org-after-todo-state-change-hook))
 	    (when (and arg (not (member org-state org-done-keywords)))
 	      (setq head (org-get-todo-sequence-head org-state)))
             (put-text-property (line-beginning-position)
@@ -10583,7 +10585,8 @@ enough to shift date past today.  Continue? "
 		  (org-timestamp-change n (cdr (assoc what whata)) nil t))
 		(setq msg
 		      (concat msg type " " org-last-changed-timestamp " ")))))))
-      (run-hooks 'org-todo-repeat-hook)
+      (save-excursion
+        (run-hooks 'org-todo-repeat-hook))
       (setq org-log-post-message msg)
       (message msg))))
 
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index 1feddac37cd..d07af9e63ad 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -1712,7 +1712,7 @@ Return the new header."
 	 ;; exclusively through ini files, return HEADER as-is.
 	 (header (if (or language-ini-only
 			 (not (stringp language-code))
-			 (not (string-match "\\\\usepackage\\[\\(.*\\)\\]{babel}" header)))
+			 (not (string-match "\\\\usepackage\\[\\([^]]*\\)\\]{babel}" header)))
 		     header
 		   (let ((options (save-match-data
 				    (org-split-string (match-string 1 header) ",[ \t]*"))))
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.