Subject: bug#20564: 24.5; bug in csv-set-comment-start

From: Leo Liu <[email-masked]>
Date: Wed, 13 May 2015 13:42:33 +0800

Using csv-mode version: 1.3.

    (defun csv-set-comment-start (string)
      "Set comment start for this CSV mode buffer to STRING.
    It must be either a string or nil."
      (interactive
       (list (edit-and-eval-command
              "Comment start (string or nil): " csv-comment-start)))
      ;; Paragraph means a group of contiguous records:
      (setq csv-comment-start string)
      (set (make-local-variable 'paragraph-separate) "[:space:]*$") ; White space.
      (set (make-local-variable 'paragraph-start) "\n");Must include \n explicitly!
      (if string
          (progn
            (setq paragraph-separate (concat paragraph-separate "\\|" string)
                  paragraph-start (concat paragraph-start "\\|" string))
            (set (make-local-variable 'comment-start) string)
            (modify-syntax-entry
             (string-to-char string) "<" csv-mode-syntax-table)
            (modify-syntax-entry ?\n ">" csv-mode-syntax-table))
        (with-syntax-table text-mode-syntax-table
          (modify-syntax-entry (string-to-char string)
                               (string (char-syntax (string-to-char string)))
                               csv-mode-syntax-table)
          (modify-syntax-entry ?\n
                               (string (char-syntax ?\n))
                               csv-mode-syntax-table))))

The ELSE branch of the IF form doesn't make any sense and generates an
error on NIL, i.e. (csv-set-comment-start nil)

Another question is why set a comment syntax. I checked RFC 4180 and
nothing is said on comment syntax.

Leo