0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-09-29 18:36:26 +00:00

Fix multiple calls to `org-dynamic-block-alist'.

* lisp/org.el (org-dynamic-block-define): Update entry instead of
  piling up entries of the same type.
This commit is contained in:
Nicolas Goaziou 2019-03-22 18:32:51 +01:00
parent a39ee98873
commit 6c88d8e406

View file

@ -9593,8 +9593,12 @@ TYPE is the dynamic block type, as a string."
(mapcar #'car org-dynamic-block-alist))
(defun org-dynamic-block-define (type func)
"Define dynamic block TYPE with FUNC."
(push (cons type func) org-dynamic-block-alist))
"Define dynamic block TYPE with FUNC.
TYPE is a string. FUNC is the function creating the dynamic
block of such type."
(pcase (assoc type org-dynamic-block-alist)
(`nil (push (cons type func) org-dynamic-block-alist))
(`(,def . ,_) (setcdr def func))))
(defun org-dynamic-block-insert-dblock (type)
"Insert a dynamic block of type TYPE.