Skip to content

Commit

Permalink
feat: Make separator customizable (#5)
Browse files Browse the repository at this point in the history
* feat: Make separator customizable

* Add changelog
  • Loading branch information
jcs090218 authored Mar 20, 2024
1 parent e6213ce commit 414631d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Change Log

All notable changes to this project will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.



## 0.2.0 (Unreleased)
> Released N/A
* N/A

## 0.1.0
> Released Mar 19, 2024
* Initial release
36 changes: 21 additions & 15 deletions rainbow-csv.el
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,28 @@
"#B1364F"
"#A96329"
"#0BB8B8"))
(t
'("#CCCCCC"
"#569CD6"
"#DCCD79"
"#529955"
"#CE834A"
"#8CDCFE"
"#B5C078"
"#4EC9B0"
"#569CD6"
"#F44747")))
(t
'("#CCCCCC"
"#569CD6"
"#DCCD79"
"#529955"
"#CE834A"
"#8CDCFE"
"#B5C078"
"#4EC9B0"
"#569CD6"
"#F44747")))
"List of colors to use."
:type 'list
:group 'rainbow-csv)

(defcustom rainbow-csv-separators
'((tsv-mode . ?\t)
(csv-mode . ?\,))
"Alist map mode to separator."
:type 'list
:group 'rainbow-csv)

(defvar rainbow-csv--old-csv-font-lock-keywords nil
"Store the old value for variable `csv-font-lock-keywords'.")

Expand Down Expand Up @@ -111,10 +118,9 @@
(interactive (list (when current-prefix-arg (read-char "Separator: "))))
(rainbow-csv--revert-font-lock-keywords)
(font-lock-mode 1)
(let* ((separator (or separator (cl-case major-mode
(`tsv-mode ?\t)
(`csv-mode ?\,)
(t ?\,))))
(let* ((separator (or separator
(cdr (assoc major-mode rainbow-csv-separators))
?\,))
(n (save-excursion
(goto-char (point-min))
(search-forward "," nil t)
Expand Down

0 comments on commit 414631d

Please sign in to comment.