3 (defun csv-set-separator (value)
4 (interactive "cSeparator char <press key> ?")
5 (csv-unalign-fields nil (point-min) (point-max))
6 (set (make-variable-buffer-local 'csv-separators) (list (char-to-string value)))
7 (set (make-variable-buffer-local 'csv-separator-chars) (list value))
8 (set (make-variable-buffer-local 'csv-skip-regexp) (apply 'concat "^\n" csv-separators))
9 (set (make-variable-buffer-local 'csv-separator-regexp) (apply 'concat `("[" ,@csv-separators "]")))
10 (set (make-variable-buffer-local 'csv-font-lock-keywords) `((,csv-separator-regexp . csv-separator-face)))
11 (csv-align-fields nil (point-min) (point-max))
12 (font-lock-refresh-defaults)
13 (font-lock-fontify-buffer))
15 (defun csv-mode-init ()
16 (set (make-variable-buffer-local 'truncate-lines) t)
17 (csv-align-fields nil (point-min) (point-max)))
19 (define-key csv-mode-map "\C-c;" 'csv-set-separator)
20 (define-key csv-mode-map "\C-ch" 'dpservice-csv-insert-header) ;; siehe dpservice-dbspec.el
22 (add-to-list 'auto-mode-alist '("\\.[Aa][Ss][Cc]\\'" . csv-mode))
23 (add-hook 'csv-mode-hook 'csv-mode-init)