(ietf-drums-remove-comments): Fix bug with single
authorTeodor Zlatanov <tzz@lifelogs.com>
Fri, 31 Oct 2008 03:13:20 +0000 (03:13 +0000)
committerTeodor Zlatanov <tzz@lifelogs.com>
Fri, 31 Oct 2008 03:13:20 +0000 (03:13 +0000)
quotes contained.  Make it more robust regardless by an extra
condition-case wrapper.

lisp/ChangeLog
lisp/ietf-drums.el

index 567a722..a41ea47 100644 (file)
@@ -1,3 +1,9 @@
+2008-10-31  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * ietf-drums.el (ietf-drums-remove-comments): Fix bug with single
+       quotes contained.  Make it more robust regardless by an extra
+       condition-case wrapper.
+
 2008-10-03  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * lpath.el: No need to fbind codepage-setup for Emacs 23.
index 4f2e9af..37e33b5 100644 (file)
@@ -119,15 +119,24 @@ backslash and doublequote.")
   (with-temp-buffer
     (let (c)
       (ietf-drums-init string)
-      (while (not (eobp))
-       (setq c (char-after))
-       (cond
-        ((eq c ?\")
-         (forward-sexp 1))
-        ((eq c ?\()
-         (delete-region (point) (progn (forward-sexp 1) (point))))
-        (t
-         (forward-char 1))))
+      (condition-case err
+         (while (not (eobp))
+           (setq c (char-after))
+           (cond
+            ((eq c ?\")
+             (forward-sexp 1))
+            ((eq c ?\()
+             (delete-region
+              (point)
+              (condition-case nil
+                  (with-syntax-table (copy-syntax-table ietf-drums-syntax-table)
+                    (modify-syntax-entry ?\" "w")
+                    (forward-sexp 1)
+                    (point))
+                (error (point-max)))))
+            (t
+             (forward-char 1))))
+       (error nil))
       (buffer-string))))
 
 (defun ietf-drums-remove-whitespace (string)