[Openmcl-devel] Tab character in indented Lisp code, turn it off how?
gb at clozure.com
Tue Nov 27 00:50:42 PST 2007
Googling for 'tabs "coding style"'suggests that there are many different
conventions in widespread use (which would have been my guess even if
I hadn't just Googled ...)
Guessing whether "tabs" or "spaces" is the approprate default for a given
user probably doesn't have more than a 50% chance of being right.
Making it easy to customize default editor behavior and to adapt to
different conventions seems more important at this point than changing
the default. When that's no longer true and it's time to think about
what the default should be, I propose that a coin be flipped.
[If anyone's convinced that they have some compelling argument that's
more persuasive than a coin flip would be, Googling for 'tabs "coding
style" "endless flame war"' might dissuade them of that belief. Then
again, it might not: didn't the people involved in those discussions
Google first ?]
On Tue, 27 Nov 2007, Hans Hübner wrote:
> All code style guides that I have come accross in commercial projects
> during the years require that no Tabs are present in source files. I
> would make indenting using spaces the default.
> On Nov 26, 2007 7:08 PM, Gary Byers <gb at clozure.com> wrote:
>> On Mon, 26 Nov 2007, Rainer Joswig wrote:
>>> I see that indenting Lisp code inserts tab characters for spaces.
>>> I'll guess that there is a switch to turn that off?
>> There's a Hemlock variable that contains a function used
>> to insert whitespace for indentation. (Somewhat confusingly,
>> the name of the variable suggests that tabs would be used
>> for indentation; whether they are or not depends on the
>> value of that variable):
>> ? (hemlock::variable-value hemlock::indent-with-tabs)
>> #<Compiled-function HEMLOCK::INDENT-USING-TABS #x3000416FD4EF>
>> ? (setf (hemlock::variable-value hemlock::indent-with-tabs) #'hemlock::indent-using-spaces)
>> #<Compiled-function HEMLOCK::INDENT-USING-SPACES #x3000416FCF1F>
>> ? (hemlock::variable-value hemlock::spaces-per-tab)
>> Hemlock variables can be buffer-local (the examples above just
>> accessd the global values.) Whatever one may think of the way
>> that they're implemented in Hemlock, the concept of buffer-local
>> variables (or something very much like them) is certainly useful.
>>> Personally I would prefer to not have tab characters
>>> in a Lisp file. What do you think?
>> It's been about 10 years since I cared either way (long enough that
>> I've forgotten why I ever did.)
>> I think that most of the reasons for this blissful indifference had
>> to do with using an editor that provided a rich set of features
>> ("entab", "detab", "set tab width", "use/don't-use tabs", ...)
>> for dealing with this. (Even if I rarely had occasion to deal
>> with any of it.)
>> I don't have any strong opinion about whether the default behavior
>> should involve using tabs or not; I do believe that it should be
>> easy to change the default behavior and to override the default
>> as needed.
>>> Tab characters are inserted at least by
>>> * Hemlock command: Indent Region
>>> * Pressing Tab in a Hemlock window
>>> Rainer Joswig
>>> Openmcl-devel mailing list
>>> Openmcl-devel at clozure.com
>> Openmcl-devel mailing list
>> Openmcl-devel at clozure.com
More information about the Openmcl-devel