org-export: Fix menu leak when reloading Org

* contrib/lisp/org-export.el (org-export-define-backend,
  org-export-define-derived-backend): Make sure a given entry won't be
  added to menu more than once.
This commit is contained in:
Nicolas Goaziou 2012-10-06 21:51:51 +02:00
parent 36306bae4e
commit 956858a395
1 changed files with 4 additions and 6 deletions

View File

@ -832,9 +832,8 @@ See `org-export-filters-alist' for more information."))
',export-block))
;; Add an entry for back-end in `org-export-dispatch'.
,(when menu-entry
(let ((menu (assq (car menu-entry) org-export-dispatch-menu-entries)))
(unless menu
`(push ',menu-entry org-export-dispatch-menu-entries))))
`(unless (assq (car ',menu-entry) org-export-dispatch-menu-entries)
(add-to-list 'org-export-dispatch-menu-entries ',menu-entry)))
;; Splice in the body, if any.
,@body)))
@ -965,9 +964,8 @@ structure of the values."
"Alist between element or object types and translators.")
;; Add an entry for back-end in `org-export-dispatch'.
,(when menu-entry
(let ((menu (assq (car menu-entry) org-export-dispatch-menu-entries)))
(unless menu
`(push ',menu-entry org-export-dispatch-menu-entries))))
`(unless (assq (car ',menu-entry) org-export-dispatch-menu-entries)
(add-to-list 'org-export-dispatch-menu-entries ',menu-entry)))
,(when sub-menu-entry
(let ((menu (nth 2 (assq (car sub-menu-entry)
org-export-dispatch-menu-entries))))