Editing HAML sets istep to 4 spaces?

2009-05-28
2015-03-16
  • Brian Candler
    Brian Candler
    2009-05-28

    Joe is my all-time favourite editor. I love it, and use it all the time.

    However I have noticed a strange thing. When I'm editing HAML, which is an indentation-sensitive language which requires indenting and outdenting in units of 2 spaces, sometimes the indent step changes to 4 spaces for no apparent reason.

    To replicate, edit "foo.haml" with the following content:

    %h1 Upload results

    %ul
      %li
        = hello

    (note there are 2 spaces before %li, and 4 spaces before = hello)

    Save, exit then reload, and you'll find the indent step has changed to 4. Of course it can be changed back to 2 manually, but this has to be done each time the file is opened.

    I am using the standard joe-3.7-1 package from Ubuntu Jaunty. I can see the default istep is set to 2, and I can't see anything in the configuration which would set the istep to 4:

    $ find /etc/joe -type f | xargs grep istep
    /etc/joe/jpicorc:    -smartbacks        Backspace key deletes 'istep' number of
    /etc/joe/jpicorc:    -istep nnn        Number of indentation columns
    /etc/joe/jpicorc:-istep 2
    /etc/joe/jpicorc:mode,"istep",rtn    % % Indent step %Zistep%
    /etc/joe/jstarrc:    -smartbacks        Backspace key deletes 'istep' number of
    /etc/joe/jstarrc:    -istep nnn        Number of indentation columns
    /etc/joe/jstarrc:-istep 2
    /etc/joe/jstarrc:mode,"istep",rtn    % % Indent step %Zistep%
    /etc/joe/rjoerc:    -smartbacks        Backspace key deletes 'istep' number of
    /etc/joe/rjoerc:    -istep nnn        Number of indentation columns
    /etc/joe/rjoerc:-istep 2
    /etc/joe/rjoerc:mode,"istep",rtn    % % Indent step %Zistep%
    /etc/joe/joerc:    -smartbacks        Backspace key deletes 'istep' number of
    /etc/joe/joerc:    -istep nnn        Number of indentation columns
    /etc/joe/joerc:-istep 2
    /etc/joe/joerc:mode,"istep",rtn    % % Indent step %Zistep%
    /etc/joe/jicerc.ru:    -smartbacks        ������� Backspace ������� 'istep' �������
    /etc/joe/jicerc.ru:    -istep nnn        ���������� ������� ������
    /etc/joe/jicerc.ru:-istep 2
    /etc/joe/jicerc.ru:mode,"istep",rtn    % % Indent step %Zistep%
    /etc/joe/jmacsrc:    -smartbacks        Backspace key deletes 'istep' number of
    /etc/joe/jmacsrc:    -istep nnn        Number of indentation columns
    /etc/joe/jmacsrc:-istep 2
    /etc/joe/jmacsrc:mode,"istep",rtn    % % Indent step %Zistep%
    /etc/joe/syntax/joerc.jsf:    "istep"            nopt
    /etc/joe/ftyperc:-istep 2
    /etc/joe/ftyperc:-istep 2
    /etc/joe/ftyperc:-istep 2
    /etc/joe/ftyperc:-istep 2
    /etc/joe/ftyperc:-istep 2
    /etc/joe/ftyperc:-istep 2
    /etc/joe/ftyperc:-istep 2
    /etc/joe/ftyperc:-istep 2
    /etc/joe/ftyperc:-istep 3

    Most bizarre!

    Regards,

    Brian.

     
    • Brian Candler
      Brian Candler
      2009-05-28

      Also, I find that putting

      *.haml
      -istep 2

      in /etc/joe/ftyperc does not make any difference. But I get the right behaviour if I force it from the command line with

          joe -istep 2 foo.haml

      How odd... without the command line flag, something is overriding the istep set in joerc.

       
  • Joe Allen
    Joe Allen
    2015-03-16

    JOE tries to guess the indentation based on what it finds in the file (guess_indent). Maybe this is failing for some reason. Maybe guess_indent should be disabled for .haml.

     
  • John J. Jordan
    John J. Jordan
    2015-03-16

    pisindentg finds the '%' and ignores the line: counts it as 0, and only sees the last one with the '='.