forked from mirrors/org-mode
org-element-at-point: Demote error to warning when called from non-Org buffer
* lisp/org-element.el (org-element-at-point): Do not throw an error when `org-element-at-point' is called from non-Org buffer. A number of third-party packages are incorrectly using `org-element-at-point' this way, relying upon `org-element-at-point' working in certain scenarios. Throwing an error (as was done previously) made an urgent call to fix this problem, even when `org-element-at-point' happened to work in a particular scenario. Now, we just display a warning to give package author more time to address or work around this. See https://github.com/alphapapa/org-web-tools/issues/61: @yantar92 I understand why this change was made, but perhaps it was a bit premature, given how much breakage it's causing downstream? It would seem appropriate to at least make it a warning for a full major version before making it an error, to give downstream devs and users a break.
This commit is contained in:
parent
459a10979d
commit
fac55324ac
|
@ -8287,7 +8287,7 @@ This function may modify the match data."
|
|||
(setq epom (or epom (point)))
|
||||
(org-with-point-at epom
|
||||
(unless (derived-mode-p 'org-mode)
|
||||
(error "`org-element-at-point' cannot be used in non-Org buffer %S (%s)"
|
||||
(warn "`org-element-at-point' cannot be used in non-Org buffer %S (%s)"
|
||||
(current-buffer) major-mode))
|
||||
;; Allow re-parsing when the command can benefit from it.
|
||||
(when (and cached-only
|
||||
|
|
Loading…
Reference in New Issue