org-export: Don't overwrite menus or add redundant entries

* contrib/lisp/org-export.el (org-export-define-backend,
  org-export-define-derived-backend): Don't overwrite menus or add
  redundant entries.
This commit is contained in:
Nicolas Goaziou 2012-09-09 15:39:28 +02:00
parent fe02e60789
commit faa2be8d57
1 changed files with 7 additions and 5 deletions

View File

@ -840,7 +840,7 @@ See `org-export-filters-alist' for more information."))
;; Add an entry for back-end in `org-export-dispatch'.
,(when menu-entry
(let ((menu (assq (car menu-entry) org-export-dispatch-menu-entries)))
(if menu `(setcdr ',menu ',(cdr menu-entry))
(unless menu
`(push ',menu-entry org-export-dispatch-menu-entries))))
;; Splice in the body, if any.
,@body)))
@ -973,12 +973,14 @@ structure of the values."
;; Add an entry for back-end in `org-export-dispatch'.
,(when menu-entry
(let ((menu (assq (car menu-entry) org-export-dispatch-menu-entries)))
(if menu `(setcdr ',menu ',(cdr menu-entry))
(unless menu
`(push ',menu-entry org-export-dispatch-menu-entries))))
,(when sub-menu-entry
(let ((menu (assq (car sub-menu-entry)
org-export-dispatch-menu-entries)))
(when menu `(nconc ',(nth 2 menu) ',(cdr sub-menu-entry)))))
(let ((menu (nth 2 (assq (car sub-menu-entry)
org-export-dispatch-menu-entries))))
(when menu `(nconc ',menu
',(org-remove-if (lambda (e) (member e menu))
(cdr sub-menu-entry))))))
;; Splice in the body, if any.
,@body)))