Posts

Showing posts with the label emacs

Setting Emacs tab stops for Java

I have a problem with Java code: with classes, methods, exception blocks, loops, etc, there's a lot of indentation. Especially when I'm posting code to this blog, with its narrow text column, things quickly flow off the right side of the page. And it's so unnecessary. I don't think 4-column tab stops, which I was using, is needed to produce readable code. The key to solve this is in the following file on my Linux system: ~/.emacs.d/init.el This contains "elisp" commands which are executed upon emacs start-up. Elisp is the Emacs variant of LISP. Honestly, even though I am good with basic MIT Scheme, and also the Elk Scheme I use at work, I find Elisp fairly challenging. But Google is my friend, so I inserted the following: ;Basic unit of spaces for each indentation level. ; c-basic-offset: sets offset for "C-class" languages ; I specifically set it smaller in Java, which tends to have extra indents ; with its class structure. (setq c-basic...