2

Can I set the field seperator(s) for the current buffer in Emacs 23?

2

Sure -- although, by default, you can only do so globally. To do so, customize the variable csv-separators (M-x customize-variable RET csv-separators RET) and add the separator characters of your choice to the list. (See C-h v csv-separators RET/M-x describe-variable RET csv-separators RET for documentation on the variable, including some caveats worth knowing if you're going to change its value.)

If you really need to apply the change only to a given buffer, you can try making the variable buffer-local by means of make-local-variable (e.g. M-: (make-local-variable 'csv-separators) RET), then setting the value for the current buffer directly (e.g. M-: (setq csv-separators (append '(":") csv-separators))). Be warned, though: I haven't tried this, and don't know whether or not it will work.

|improve this answer|||||
  • The make-local-variable approach was what I was looking for! – Arne Nov 12 '13 at 9:19
1

This expands on the accepted answer. I would have commented there, but need >50 rep for that. I just found this and the make-local-variable approach did not work for me. I found the variable csv-separator-chars and its doc says

Set by customizing ‘csv-separators’ -- do not set directly!

So using customize-variable on csv-separators worked for me as this also set the csv-separator-chars which seems to be the one really used when aligning CSVs.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.