branch: externals/org commit 6ca685c3c566ccdee917f8d620d1185fc3282646 Author: Ihor Radchenko <yanta...@gmail.com> Commit: Ihor Radchenko <yanta...@gmail.com>
org-element.el: Encourage bug reports in case of cache issues * lisp/org-element.el (org-element--cache-remove, org-element--cache-sync, org-element--cache-process-request, org-element--parse-to, org-element--cache-for-removal, org-element--cache-verify-element, org-element-at-point): Update warning messages. --- lisp/org-element.el | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index f36aff1..7a8625a 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -5717,7 +5717,8 @@ Assume ELEMENT belongs to cache and that a cache is active." (progn ;; This should not happen, but if it is, would be better to know ;; where it happens. - (org-element--cache-warn "Failed to delete %S element in %S at %S. The element cache key was %S." + (org-element--cache-warn "Failed to delete %S element in %S at %S. The element cache key was %S. +If this warning appears regularly, please report it to Org mode mailing list (M-x org-submit-bug-report)." (org-element-type element) (current-buffer) (org-element-property :begin element) @@ -5803,7 +5804,9 @@ updated before current modification are actually submitted." (if (/= org-element--cache-change-tic (buffer-chars-modified-tick)) (progn - (org-element--cache-warn "Unregistered buffer modifications detected. Resetting\n The buffer is: %s\n Current command: %S" + (org-element--cache-warn "Unregistered buffer modifications detected. Resetting. +If this warning appears regularly, please report it to Org mode mailing list (M-x org-submit-bug-report). +The buffer is: %s\n Current command: %S" (buffer-name (current-buffer)) this-command) (org-element-cache-reset)) @@ -6153,7 +6156,7 @@ request." ;; such error happens within ;; `org-element--cache-process-request' or somewhere ;; else. - (org-element--cache-warn "Added org-data parent to non-headline element: %S" data) + (org-element--cache-warn "Added org-data parent to non-headline element: %S\nIf this warning appears regularly, please report it to Org mode mailing list (M-x org-submit-bug-report)." data) (org-element-cache-reset) (throw 'quit t)) (org-element-put-property data :parent parent) @@ -6222,7 +6225,8 @@ the process stopped before finding the expected result." ;; file. ((and (not cached) (org-element--cache-active-p)) (setq element (org-element-org-data-parser)) - (unless (org-element-property :begin element) (org-element--cache-warn "Error parsing org-data. Got %S" element)) + (unless (org-element-property :begin element) + (org-element--cache-warn "Error parsing org-data. Got %S\nPlease report to Org mode mailing list (M-x org-submit-bug-report)." element)) (org-element--cache-log-message "Nothing in cache. Adding org-data: %S" (org-element--format-element element)) (org-element--cache-put element) @@ -6604,7 +6608,7 @@ known element in cache (it may start after END)." (when robust-flag (setq robust-flag nil)))) (unless (or (org-element-property :parent up) (eq 'org-data (org-element-type up))) - (org-element--cache-warn "Got element without parent.\n%S" up)) + (org-element--cache-warn "Got element without parent. Please report it to Org mode mailing list (M-x org-submit-bug-report).\n%S" up)) (setq up (org-element-property :parent up))) ;; We're at top level element containing ELEMENT: if it's ;; altered by buffer modifications, it is first element in @@ -6784,7 +6788,9 @@ Return non-nil when verification failed." (org-element-with-disabled-cache (org-up-heading-or-point-min)) (unless (or (= (point) (org-element-property :begin (org-element-property :parent element))) (eq (point) (point-min))) - (org-element--cache-warn "Cached element has wrong parent in %s. Resetting.\n The element is: %S\n The parent is: %S\n The real parent is: %S" + (org-element--cache-warn "Cached element has wrong parent in %s. Resetting. +If this warning appears regularly, please report it to Org mode mailing list (M-x org-submit-bug-report). +The element is: %S\n The parent is: %S\n The real parent is: %S" (buffer-name (current-buffer)) (org-element--format-element element) (org-element--format-element (org-element-property :parent element)) @@ -6810,7 +6816,9 @@ Return non-nil when verification failed." (eq (org-element-property :contents-end real-element) (org-element-property :contents-end element)) (or (not (org-element-property :ID real-element)) (string= (org-element-property :ID real-element) (org-element-property :ID element)))) - (org-element--cache-warn "(%S) Cached element is incorrect in %s. (Cache tic up to date: %S) Resetting.\n The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" + (org-element--cache-warn "(%S) Cached element is incorrect in %s. (Cache tic up to date: %S) Resetting. +If this warning appears regularly, please report it to Org mode mailing list (M-x org-submit-bug-report). +The element is: %S\n The real element is: %S\n Cache around :begin:\n%S\n%S\n%S" this-command (buffer-name (current-buffer)) (if (/= org-element--cache-change-tic @@ -7369,7 +7377,7 @@ element ending there." (condition-case err (org-element--parse-to pom) (error - (org-element--cache-warn "Cache corruption detected in %s. Resetting.\n The error was: %S" + (org-element--cache-warn "Cache corruption detected in %s. Resetting.\n The error was: %S\n Please report this to Org mode mailing list (M-x org-submit-bug-report)." (buffer-name (current-buffer)) err) (org-element-cache-reset)