[Geany-Devel] Smart tabs

Lex Trotman elextr at xxxxx
Tue Jul 16 01:02:28 UTC 2013


On 16 July 2013 08:09, Thrawn <shell_layer-geany at yahoo.com.au> wrote:

>
> Hi, folks.
>
> I recently came across some articles on the Emacs wiki about spaces vs
> tabs:
> http://www.emacswiki.org/emacs/SmartTabs
> http://www.emacswiki.org/emacs/TabsAreEvil
>
> Their argument is that tabs should be used for indentation, while spaces
> should be used to align text when a long line is split. Makes sense to me.
>

Thats one style, if you *must* use tabs then its probably the best one,
since it stays aligned no matter what size a tab is considered to be.
 Better just not to use tabs of course, you don't actually save much in the
default case of 4 spaces per tab.  But I understand that editing old code
would have to conform to its standard.

>
> Is there, or should there be, support for this idea in Geany (or more
> likely in a plugin)? Probably this would not be suitable for Python, of
> course, but it works for C-style languages.
>

1) No there isn't, probably there should be, but...
2) There has been much discussion on the ML and several actual prototypes
of improved indentation/alignment schemes that are flexible enough to
address many languages (even just many C style languages is a hard
problem).  None of them have been sufficiently correct, enough of the time,
to overcome the problems of being really annoying when they are incorrect.
 Therefore anything would have to be a plugin so that it can simply not be
loaded if the user didn't want it.  Also it would need to only operate when
the correct language was being edited.
3) But there is no way to tell Geany to not apply indentation per file, so
Geany will still do its thing independent of the plugin (and that includes
moving } not just on enter).
4) So the plugin would have to keep changing the indentation settings in
Geany to turn off Geany indentation as the user changed to/from a tab
containing a C file to one containing some other language, but would
somehow have to ensure that the right value is saved in the config file
(not sure this is possible).


>
> I could probably write a Lua script that would split a long line using
> this idea: same number of tabs as the original, then spaces to align the
> new line with the last bracket on the previous one. Maybe bound to
> Shift+Enter.
>

Splitting a line on user command is certainly an easier way to do it, I
assume you mean last *unmatched* bracket on the line (that is not in a
string or comment).  Oh and don't forget C++ uses <> as brackets for
templates, but don't confuse that with the places it uses them for gt and
lt :)

Finally plugins should *not* bind keys by default, they have no way of
knowing if the user has already bound that key to something else (and of
course multiple plugins binding the same key :).

Cheers
Lex


>
> Any thoughts?
>
> Thrawn
>
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130716/16b092c3/attachment.html>


More information about the Devel mailing list