瀏覽代碼

Code cleanup: always use 'backend instead of htmlp, latexp, etc.

Bastien Guerry 14 年之前
父節點
當前提交
d03d3575cb
共有 4 個文件被更改,包括 9 次插入17 次删除
  1. 3 8
      lisp/org-exp-blocks.el
  2. 4 5
      lisp/org-exp.el
  3. 0 1
      lisp/org-latex.el
  4. 2 3
      lisp/org-special-blocks.el

+ 3 - 8
lisp/org-exp-blocks.el

@@ -76,11 +76,6 @@
   (require 'cl))
 (require 'org)
 
-(defvar htmlp)
-(defvar latexp)
-(defvar docbookp)
-(defvar asciip)
-
 (defun org-export-blocks-set (var value)
   "Set the value of `org-export-blocks' and install fontification."
   (set var value)
@@ -247,7 +242,7 @@ passed to the ditaa utility as command line arguments."
 			    "\n")))
     (prog1
     (cond
-     ((or htmlp latexp docbookp)
+     ((member backend '(html latex docbook))
       (unless (file-exists-p out-file)
         (mapc ;; remove old hashed versions of this file
          (lambda (file)
@@ -306,7 +301,7 @@ digraph data_relationships {
 	 (out-file (concat (car out-file-parts) "_" hash "." (cdr out-file-parts))))
     (prog1
     (cond
-     ((or htmlp latexp docbookp)
+     ((member backend '(html latex docbook))
       (unless (file-exists-p out-file)
 	(mapc ;; remove old hashed versions of this file
 	 (lambda (file)
@@ -338,7 +333,7 @@ other backends, it converts the comment into an EXAMPLE segment."
   (let ((owner (if headers (car headers)))
 	(title (if (cdr headers) (mapconcat 'identity (cdr headers) " "))))
     (cond
-     (htmlp ;; We are exporting to HTML
+     ((eq backend 'html) ;; We are exporting to HTML
       (concat "#+BEGIN_HTML\n"
 	      "<div class=\"org-comment\""
 	      (if owner (format " id=\"org-comment-%s\" " owner))

+ 4 - 5
lisp/org-exp.el

@@ -1033,8 +1033,7 @@ to export.  It then creates a temporary buffer where it does its job.
 The result is then again returned as a string, and the exporter works
 on this string to produce the exported version."
   (interactive)
-  (let* ((docbookp (eq (plist-get parameters :for-backend) 'docbook))
-	 (backend (plist-get parameters :for-backend))
+  (let* ((backend (plist-get parameters :for-backend))
 	 (archived-trees (plist-get parameters :archived-trees))
 	 (inhibit-read-only t)
 	 (drawers org-drawers)
@@ -1610,7 +1609,7 @@ from the buffer."
 
     (while formatters
       (setq fmt (pop formatters))
-      ;; Handle #+Backend: stuff
+      ;; Handle #+backend: stuff
       (goto-char (point-min))
       (while (re-search-forward (concat "^\\([ \t]*\\)#\\+" (cadr fmt)
 					":[ \t]*\\(.*\\)") nil t)
@@ -1620,7 +1619,7 @@ from the buffer."
 	  (add-text-properties
 	   (point-at-bol) (min (1+ (point-at-eol)) (point-max))
 	   '(org-protected t))))
-      ;; Delete #+attr_Backend: stuff of another backend. Those
+      ;; Delete #+attr_backend: stuff of another backend. Those
       ;; matching the current backend will be taken care of by
       ;; `org-export-attach-captions-and-attributes'
       (goto-char (point-min))
@@ -1628,7 +1627,7 @@ from the buffer."
 					":[ \t]*\\(.*\\)") nil t)
 	(when (not (eq (car fmt) backend))
 	  (delete-region (point-at-bol) (min (1+ (point-at-eol)) (point-max)))))
-      ;; Handle #+begin_Backend and #+end_Backend stuff
+      ;; Handle #+begin_backend and #+end_backend stuff
       (goto-char (point-min))
       (while (re-search-forward (concat "^[ \t]*#\\+" (caddr fmt) "\\>.*\n?")
 				nil t)

+ 0 - 1
lisp/org-latex.el

@@ -73,7 +73,6 @@
 	  org-closed-string"\\)")
   "Regexp matching special time planning keywords plus the time after it.")
 
-(defvar latexp)    ; dynamically scoped from org.el
 (defvar re-quote)  ; dynamically scoped from org.el
 (defvar commentsp) ; dynamically scoped from org.el
 

+ 2 - 3
lisp/org-special-blocks.el

@@ -45,12 +45,11 @@
 by org-special-blocks.  These blocks will presumably be
 interpreted by other mechanisms.")
 
-(defvar htmlp)
-(defvar latexp)
+(defvar backend)
 (defun org-special-blocks-make-special-cookies ()
   "Adds special cookies when #+begin_foo and #+end_foo tokens are
 seen.  This is run after a few special cases are taken care of."
-  (when (or htmlp latexp)
+  (when (or (eq backend 'html) (eq backend 'latex))
     (goto-char (point-min))
     (while (re-search-forward "^[ \t]*#\\+\\(begin\\|end\\)_\\(.*\\)$" nil t)
       (unless (org-string-match-p org-special-blocks-ignore-regexp (match-string 2))