emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 609319da87 3/3: Merge from origin/emacs-29


From: Stefan Kangas
Subject: master 609319da87 3/3: Merge from origin/emacs-29
Date: Mon, 13 Feb 2023 00:45:09 -0500 (EST)

branch: master
commit 609319da870eac75cf4715de8abfaac9233d98f9
Merge: b3dda79fac f2114e8d89
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Merge from origin/emacs-29
    
    f2114e8d89f Fix indentation for closing bracket in c-ts-mode (bug#61398)
    f49caaa8925 ; * src/pdumper.c (dump_buffer): Update hash.
    fe2ea5ddd8d Update to Org 9.6.1-31-gaf1bb1
---
 doc/misc/org.org                                   | 16 ++++----
 lisp/org/ob-eval.el                                |  2 +-
 lisp/org/ob-sql.el                                 |  2 +-
 lisp/org/org-agenda.el                             |  2 +-
 lisp/org/org-compat.el                             | 12 +++---
 lisp/org/org-element.el                            | 45 ++++++++++++++--------
 lisp/org/org-footnote.el                           |  2 +-
 lisp/org/org-version.el                            |  2 +-
 lisp/org/org.el                                    | 12 ++++--
 lisp/progmodes/c-ts-mode.el                        | 11 ++++--
 src/pdumper.c                                      |  2 +-
 .../lisp/progmodes/c-ts-mode-resources/indent.erts | 27 +++++++++++++
 12 files changed, 94 insertions(+), 41 deletions(-)

diff --git a/doc/misc/org.org b/doc/misc/org.org
index 14699e7739..ad889a5c62 100644
--- a/doc/misc/org.org
+++ b/doc/misc/org.org
@@ -5291,7 +5291,7 @@ The following commands help to work with properties:
   Set a property in the current entry.  Both the property and the
   value can be inserted using completion.
 
-- {{{kbd(S-RIGHT)}}} (~org-property-next-allowed-values~),  {{{kbd(S-LEFT)}}} 
(~org-property-previous-allowed-value~) ::
+- {{{kbd(S-RIGHT)}}} (~org-property-next-allowed-value~),  {{{kbd(S-LEFT)}}} 
(~org-property-previous-allowed-value~) ::
 
   #+kindex: S-RIGHT
   #+kindex: S-LEFT
@@ -10252,9 +10252,9 @@ the other commands, point needs to be in the desired 
line.
 
   Unmark entry for bulk action.
 
-- {{{kbd(U)}}} (~org-agenda-bulk-remove-all-marks~) ::
+- {{{kbd(U)}}} (~org-agenda-bulk-unmark-all~) ::
   #+kindex: U
-  #+findex: org-agenda-bulk-remove-all-marks
+  #+findex: org-agenda-bulk-unmark-all
 
   Unmark all marked entries for bulk action.
 
@@ -11692,9 +11692,9 @@ When the variable ~org-export-dispatch-use-expert-ui~ 
is set to
 a non-~nil~ value, Org prompts in the minibuffer.  To switch back to
 the hierarchical menu, press {{{kbd(?)}}}.
 
-- {{{kbd(C-c C-e)}}} (~org-export~) ::
+- {{{kbd(C-c C-e)}}} (~org-export-dispatch~) ::
   #+kindex: C-c C-e
-  #+findex: org-export
+  #+findex: org-export-dispatch
 
   Invokes the export dispatcher interface.  The options show default
   settings.  The {{{kbd(C-u)}}} prefix argument preserves options from
@@ -12232,7 +12232,7 @@ with the custom ID =theory=, you can use
 
 The following command allows navigating to the included document:
 
-- {{{kbd(C-c ')}}} (~org-edit~special~) ::
+- {{{kbd(C-c ')}}} (~org-edit-special~) ::
   #+kindex: C-c '
   #+findex: org-edit-special
 
@@ -14363,10 +14363,10 @@ executable.  Without it, export cannot finish.
 :DESCRIPTION: Invoking export.
 :END:
 
-- {{{kbd(C-c C-e o o)}}} (~org-export-to-odt~) ::
+- {{{kbd(C-c C-e o o)}}} (~org-odt-export-to-odt~) ::
 
   #+kindex: C-c C-e o o
-  #+findex: org-export-to-odt
+  #+findex: org-odt-export-to-odt
   Export as OpenDocument Text file.
 
   #+cindex: @samp{EXPORT_FILE_NAME}, property
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index 6f6edb949c..07e5307725 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -59,7 +59,7 @@ Writes QUERY into a temp-buffer that is processed with
   (let ((error-buffer (get-buffer-create " *Org-Babel Error*")) exit-code)
     (with-current-buffer error-buffer (erase-buffer))
     (with-temp-buffer
-      (insert query)
+      (insert query "\n")
       (setq exit-code
             (org-babel--shell-command-on-region
              command error-buffer))
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
index 39a4573a54..f73e7003f6 100644
--- a/lisp/org/ob-sql.el
+++ b/lisp/org/ob-sql.el
@@ -234,7 +234,7 @@ database connections."
                                   (:database . sql-database)))
                   (mapped-name (cdr (assq name name-mapping))))
              (cadr (assq mapped-name
-                         (cdr (assoc dbconnection sql-connection-alist))))))))
+                         (cdr (assoc-string dbconnection sql-connection-alist 
t))))))))
 
 (defun org-babel-execute:sql (body params)
   "Execute a block of Sql code with Babel.
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 63107e8e6a..3db33c4d63 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -8211,7 +8211,7 @@ filter."
   (if (and org-agenda-filtered-by-category
           org-agenda-category-filter)
       (org-agenda-filter-show-all-cat)
-    (let ((cat (org-no-properties (org-get-at-eol 'org-category 1))))
+    (let ((cat (org-no-properties (org-agenda-get-category))))
       (cond
        ((and cat strip)
         (org-agenda-filter-apply
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index 6c50852553..d5bf2191ae 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -196,11 +196,13 @@ removed."
 
 ;;; Emacs < 27.1 compatibility
 
-(unless (fboundp 'combine-change-calls)
-  ;; A stub when `combine-change-calls' was not yet there.
-  (defmacro combine-change-calls (_beg _end &rest body)
-    (declare (debug (form form def-body)) (indent 2))
-    `(progn ,@body)))
+(if (version< emacs-version "29")
+    ;; A stub when `combine-change-calls' was not yet there or had
+    ;; critical bugs (see Emacs bug#60467).
+    (defmacro org-combine-change-calls (_beg _end &rest body)
+      (declare (debug (form form def-body)) (indent 2))
+      `(progn ,@body))
+  (defalias 'org-combine-change-calls 'combine-change-calls))
 
 (if (version< emacs-version "27.1")
     (defsubst org-replace-buffer-contents (source &optional _max-secs 
_max-costs)
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index 389acf8250..4f4eebfcc2 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -7406,14 +7406,16 @@ the cache."
         (org-element-at-point to-pos)
         (cl-macrolet ((cache-root
                         ;; Use the most optimal version of cache available.
-                        () `(if (memq granularity '(headline 
headline+inlinetask))
-                                (org-element--headline-cache-root)
-                              (org-element--cache-root)))
+                        () `(org-with-base-buffer nil
+                              (if (memq granularity '(headline 
headline+inlinetask))
+                                  (org-element--headline-cache-root)
+                                (org-element--cache-root))))
                       (cache-size
                         ;; Use the most optimal version of cache available.
-                        () `(if (memq granularity '(headline 
headline+inlinetask))
-                                org-element--headline-cache-size
-                              org-element--cache-size))
+                        () `(org-with-base-buffer nil
+                              (if (memq granularity '(headline 
headline+inlinetask))
+                                  org-element--headline-cache-size
+                                org-element--cache-size)))
                       (cache-walk-restart
                         ;; Restart tree traversal after AVL tree re-balance.
                         () `(when node
@@ -7443,8 +7445,9 @@ the cache."
                               ;; Avoid extra staff like timer cancels et al
                               ;; and only call 
`org-element--cache-sync-requests' when
                               ;; there are pending requests.
-                              (when org-element--cache-sync-requests
-                                (org-element--cache-sync (current-buffer)))
+                              (org-with-base-buffer nil
+                                (when org-element--cache-sync-requests
+                                  (org-element--cache-sync (current-buffer))))
                               ;; Call `org-element--parse-to' directly 
avoiding any
                               ;; kind of `org-element-at-point' overheads.
                               (if restrict-elements
@@ -7515,8 +7518,9 @@ the cache."
                               tmpnext-start))
                       ;; Check if cache does not have gaps.
                       (cache-gapless-p
-                        () `(eq org-element--cache-change-tic
-                                (alist-get granularity 
org-element--cache-gapless))))
+                        () `(org-with-base-buffer nil
+                              (eq org-element--cache-change-tic
+                                  (alist-get granularity 
org-element--cache-gapless)))))
           ;; The core algorithm is simple walk along binary tree.  However,
           ;; instead of checking all the tree elements from first to last
           ;; (like in `avl-tree-mapcar'), we begin from FROM-POS skipping
@@ -7644,7 +7648,9 @@ the cache."
                         ;; In the process, we may alter the buffer,
                         ;; so also keep track of the cache state.
                         (progn
-                          (setq modified-tic org-element--cache-change-tic)
+                          (setq modified-tic
+                                (org-with-base-buffer nil
+                                  org-element--cache-change-tic))
                           (setq cache-size (cache-size))
                           ;; When NEXT-RE/FAIL-RE is provided, skip to
                           ;; next regexp match after :begin of the current
@@ -7678,7 +7684,7 @@ the cache."
                               ;;
                               ;; Call FUNC.  FUNC may move point.
                               (setq org-element-cache-map-continue-from nil)
-                              (if org-element--cache-map-statistics
+                              (if (org-with-base-buffer nil 
org-element--cache-map-statistics)
                                   (progn
                                     (setq before-time (float-time))
                                     (push (funcall func data) result)
@@ -7697,7 +7703,15 @@ the cache."
                               (when org-element-cache-map-continue-from
                                 (goto-char 
org-element-cache-map-continue-from))
                               (when (> (point) start)
-                                (move-start-to-next-match nil))
+                                (move-start-to-next-match nil)
+                                ;; (point) inside matching element.
+                                ;; Go further.
+                                (when (> (point) start)
+                                  (setq data (element-match-at-point))
+                                  (if (not data)
+                                      (cache-walk-abort)
+                                    (goto-char (next-element-start))
+                                    (move-start-to-next-match 
next-element-re))))
                               ;; Drop nil.
                               (unless (car result) (pop result)))
                             ;; If FUNC did not move the point and we
@@ -7710,8 +7724,9 @@ the cache."
                                            start))
                               (setq start nil))
                             ;; Check if the buffer has been modified.
-                            (unless (and (eq modified-tic 
org-element--cache-change-tic)
-                                         (eq cache-size (cache-size)))
+                            (unless (org-with-base-buffer nil
+                                      (and (eq modified-tic 
org-element--cache-change-tic)
+                                           (eq cache-size (cache-size))))
                               ;; START may no longer be valid, update
                               ;; it to beginning of real element.
                               ;; Upon modification, START may lay
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index c83026d1d8..6bdd0b32fe 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -853,7 +853,7 @@ to `org-footnote-section'.  Inline definitions are ignored."
          ;; Insert un-referenced footnote definitions at the end.
           ;; Combine all insertions into one to create a single cache
           ;; update call.
-          (combine-change-calls (point) (point)
+          (org-combine-change-calls (point) (point)
            (pcase-dolist (`(,label . ,definition) definitions)
              (unless (member label inserted)
                (insert "\n" definition "\n"))))))))))
diff --git a/lisp/org/org-version.el b/lisp/org/org-version.el
index 8372a0be4a..5f587fb3fd 100644
--- a/lisp/org/org-version.el
+++ b/lisp/org/org-version.el
@@ -11,7 +11,7 @@ Inserted by installing Org mode or when a release is made."
 (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.6.1-23-gc45a05"))
+   (let ((org-git-version "release_9.6.1-31-gaf1bb1"))
      org-git-version))
 
 (provide 'org-version)
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 1b829d837c..9a4f7803cf 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -723,6 +723,10 @@ defined in org-duration.el.")
   (set-default-toplevel-value var value)
   (when (featurep 'org)
     (org-load-modules-maybe 'force)
+    ;; FIXME: We can't have all the requires at top-level due to
+    ;; circular dependencies.  Yet, this function might sometimes be
+    ;; called when 'org-element is not loaded.
+    (require 'org-element)
     (org-element-cache-reset 'all)))
 
 (defcustom org-modules '(ol-doi ol-w3m ol-bbdb ol-bibtex ol-docview ol-gnus 
ol-info ol-irc ol-mhe ol-rmail ol-eww)
@@ -6556,7 +6560,7 @@ See also `org-promote'."
   (interactive)
   (save-excursion
     (org-back-to-heading t)
-    (combine-change-calls (point) (save-excursion (org-end-of-subtree t))
+    (org-combine-change-calls (point) (save-excursion (org-end-of-subtree t))
       (org-with-limited-levels (org-map-tree 'org-promote))))
   (org-fix-position-after-promote))
 
@@ -6566,7 +6570,7 @@ See `org-demote' and `org-promote'."
   (interactive)
   (save-excursion
     (org-back-to-heading t)
-    (combine-change-calls (point) (save-excursion (org-end-of-subtree t))
+    (org-combine-change-calls (point) (save-excursion (org-end-of-subtree t))
       (org-with-limited-levels (org-map-tree 'org-demote))))
   (org-fix-position-after-promote))
 
@@ -7135,7 +7139,7 @@ When REMOVE is non-nil, remove the subtree from the 
clipboard."
        (setq beg (point))
        ;; Avoid re-parsing cache elements when i.e. level 1 heading
        ;; is inserted and then promoted.
-       (combine-change-calls beg beg
+       (org-combine-change-calls beg beg
          (when (fboundp 'org-id-paste-tracker) (org-id-paste-tracker txt))
          (insert txt)
          (unless (string-suffix-p "\n" txt) (insert "\n"))
@@ -18844,7 +18848,7 @@ Alignment is done according to `org-property-format', 
which see."
   (when (save-excursion
          (beginning-of-line)
          (looking-at org-property-re))
-    (combine-change-calls (match-beginning 0) (match-end 0)
+    (org-combine-change-calls (match-beginning 0) (match-end 0)
       (let ((newtext (concat (match-string 4)
                             (org-trim
                              (format org-property-format (match-string 1) 
(match-string 3))))))
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index dbee53cd7a..6db28459c3 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -272,6 +272,11 @@ MODE is either `c' or `cpp'."
                  ;; Indent the body of namespace definitions.
                  ((parent-is "declaration_list") parent-bol 
c-ts-mode-indent-offset)))
 
+           ;; Closing bracket.  This should be before initializer_list
+           ;; (and probably others) rule because that rule (and other
+           ;; similar rules) will match the closing bracket.  (Bug#61398)
+           ((node-is "}") point-min c-ts-common-statement-offset)
+
            ;; int[5] a = { 0, 0, 0, 0 };
            ((parent-is "initializer_list") parent-bol c-ts-mode-indent-offset)
            ;; Statement in enum.
@@ -281,8 +286,6 @@ MODE is either `c' or `cpp'."
 
            ;; Statement in {} blocks.
            ((parent-is "compound_statement") point-min 
c-ts-common-statement-offset)
-           ;; Closing bracket.
-           ((node-is "}") point-min c-ts-common-statement-offset)
            ;; Opening bracket.
            ((node-is "compound_statement") point-min 
c-ts-common-statement-offset)
            ;; Bug#61291.
@@ -799,7 +802,9 @@ the semicolon.  This function skips the semicolon."
   (setq-local c-ts-common-indent-type-regexp-alist
               `((block . ,(rx (or "compound_statement"
                                   "field_declaration_list"
-                                  "enumerator_list")))
+                                  "enumerator_list"
+                                  "initializer_list"
+                                  "field_declaration_list")))
                 (if . "if_statement")
                 (else . ("if_statement" . "alternative"))
                 (do . "do_statement")
diff --git a/src/pdumper.c b/src/pdumper.c
index 11704ca876..2c3828081f 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -2748,7 +2748,7 @@ dump_hash_table (struct dump_context *ctx,
 static dump_off
 dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
 {
-#if CHECK_STRUCTS && !defined HASH_buffer_DB34E5D09F
+#if CHECK_STRUCTS && !defined HASH_buffer_85D317CE74
 # error "buffer changed. See CHECK_STRUCTS comment in config.h."
 #endif
   struct buffer munged_buffer = *in_buffer;
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts 
b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 21b84c2e7e..05d59c10a4 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -182,6 +182,20 @@ else if (false)
   return 3;
 =-=-=
 
+Name: Initializer List (Bug#61398)
+
+=-=
+int main()
+{
+  const char *emoticons[][2] =
+    {
+      {":-)", "SLIGHTLY SMILING FACE"},
+      {";-)", "WINKING FACE"},
+      {":-(", "SLIGHTLY FROWNING FACE"},
+    };
+}
+=-=-=
+
 Name: Multiline Block Comments 1 (bug#60270)
 
 =-=
@@ -327,3 +341,16 @@ void foo(
     }
 }
 =-=-=
+
+Name: Initializer List (Linux Style) (Bug#61398)
+
+=-=
+int main()
+{
+  const char *emoticons[][2] = {
+    {":-)", "SLIGHTLY SMILING FACE"},
+    {";-)", "WINKING FACE"},
+    {":-(", "SLIGHTLY FROWNING FACE"},
+  };
+}
+=-=-=



reply via email to

[Prev in Thread] Current Thread [Next in Thread]