emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] Check argument is a string before calling string-match


From: Bernt Hansen
Subject: [O] [PATCH] Check argument is a string before calling string-match
Date: Mon, 19 Sep 2011 19:20:02 -0400

* lisp/org-html.el (org-export-as-html): Check string-match argument
(org-html-handle-time-stamps): Check string-match argument

Avoid wrong-type-argument errors during exporting.
---

This may or may not be the same error you are getting - but I ran into 
this during exporting back in August and it was sitting in my queue.

Please report if this fixes your issue or not.

-Bernt

 lisp/org-html.el |   30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/lisp/org-html.el b/lisp/org-html.el
index fde563b..6492c2f 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -1598,7 +1598,8 @@ lang=\"%s\" xml:lang=\"%s\">
          (setq line (org-html-handle-links line opt-plist))
 
          ;; TODO items
-         (if (and (string-match org-todo-line-regexp line)
+         (if (and org-todo-line-regexp
+                  (string-match org-todo-line-regexp line)
                   (match-beginning 2))
 
              (setq line
@@ -2213,19 +2214,20 @@ for further information."
   "Format time stamps in string S, or remove them."
   (catch 'exit
     (let (r b)
-      (while (string-match org-maybe-keyword-time-regexp s)
-       (or b (setq b (substring s 0 (match-beginning 0))))
-       (setq r (concat
-                r (substring s 0 (match-beginning 0))
-                " @<span class=\"timestamp-wrapper\">"
-                (if (match-end 1)
-                    (format "@<span class=\"timestamp-kwd\">%s @</span>"
-                            (match-string 1 s)))
-                (format " @<span class=\"timestamp\">%s@</span>"
-                        (substring
-                         (org-translate-time (match-string 3 s)) 1 -1))
-                "@</span>")
-             s (substring s (match-end 0))))
+      (when org-maybe-keyword-time-regexp
+       (while (string-match org-maybe-keyword-time-regexp s)
+         (or b (setq b (substring s 0 (match-beginning 0))))
+         (setq r (concat
+                  r (substring s 0 (match-beginning 0))
+                  " @<span class=\"timestamp-wrapper\">"
+                  (if (match-end 1)
+                      (format "@<span class=\"timestamp-kwd\">%s @</span>"
+                              (match-string 1 s)))
+                  (format " @<span class=\"timestamp\">%s@</span>"
+                          (substring
+                           (org-translate-time (match-string 3 s)) 1 -1))
+                  "@</span>")
+               s (substring s (match-end 0)))))
       ;; Line break if line started and ended with time stamp stuff
       (if (not r)
          s
-- 
1.7.7.rc1.3.g5593




reply via email to

[Prev in Thread] Current Thread [Next in Thread]