Browse Source

Introduce org-lparse-unregister-backend and use it

* contrib/lisp/org-lparse.el (org-lparse-unregister-backend):
New.
* contrib/lisp/org-odt.el (org-odt-unload-function):
New. De-register from org-lparse on unload.
* contrib/lisp/org-xhtml.el (org-xhtml-unload-function):
New. De-register from org-lparse on unload.
Jambunathan K 13 years ago
parent
commit
4db8048a23
3 changed files with 18 additions and 0 deletions
  1. 8 0
      contrib/lisp/org-lparse.el
  2. 5 0
      contrib/lisp/org-odt.el
  3. 5 0
      contrib/lisp/org-xhtml.el

+ 8 - 0
contrib/lisp/org-lparse.el

@@ -366,6 +366,14 @@ Add BACKEND to `org-lparse-native-backends'."
 		   (t (error "Error while registering backend: %S" backend))))
     (add-to-list 'org-lparse-native-backends backend)))
 
+(defun org-lparse-unregister-backend (backend)
+  (setq org-lparse-native-backends
+	(remove (cond
+		 ((symbolp backend) (symbol-name backend))
+		 ((stringp backend) backend))
+		org-lparse-native-backends))
+  (message "Unregistered backend %S" backend))
+
 (defun org-lparse-get-other-backends (native-backend)
   (org-lparse-backend-get native-backend 'OTHER-BACKENDS))
 

+ 5 - 0
contrib/lisp/org-odt.el

@@ -143,6 +143,11 @@ OpenDocument xml files.")
 ;; register the odt exporter with org-lparse library
 (org-lparse-register-backend 'odt)
 
+(defun org-odt-unload-function ()
+  ;; notify org-lparse library on unload
+  (org-lparse-unregister-backend 'odt)
+  nil)
+
 (defcustom org-export-odt-automatic-styles-file nil
   "Automatic styles for use with ODT exporter.
 If unspecified, the file under `org-odt-data-dir' is used."

+ 5 - 0
contrib/lisp/org-xhtml.el

@@ -1197,6 +1197,11 @@ make any modifications to the exporter file.  For example,
 ;; register the xhtml exporter with org-lparse library
 (org-lparse-register-backend 'xhtml)
 
+(defun org-xhtml-unload-function ()
+  ;; notify org-lparse library on unload
+  (org-lparse-unregister-backend 'xhtml)
+  nil)
+
 (defun org-xhtml-begin-document-body (opt-plist)
   (let ((link-up (and (plist-get opt-plist :link-up)
 		      (string-match "\\S-" (plist-get opt-plist :link-up))