Browse Source

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.
Nicolas Goaziou 12 years ago
parent
commit
faa2be8d57
1 changed files with 7 additions and 5 deletions
  1. 7 5
      contrib/lisp/org-export.el

+ 7 - 5
contrib/lisp/org-export.el

@@ -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)))