Bug 163220 - makefiles should have preconfigured mode to always insert tabs instead of spaces
Summary: makefiles should have preconfigured mode to always insert tabs instead of spaces
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
: 163281 163315 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-06-04 18:31 UTC by Maik Beckmann
Modified: 2009-10-26 00:23 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maik Beckmann 2008-06-04 18:31:16 UTC
Version:            (using Devel)
Installed from:    Compiled sources
Compiler:          gcc-4.3.0 
OS:                Linux

I encountered this in kdevelop4 and kwrite.  I gonna explain it referring to kwrite. 

Be n_indent the number of spaces selected at Editing->Indentation->Indentation width
Be n_spaces the number of spaces selected at Editing->General->Tab width

If n_indent < n_spaces is true kate always inserts spaces for tabs.

Since the default is
  n_indent = 2 , n_spaces = 8
always replacing tabs spaces is the default as well.  

This leads to a bad user experience if Makefiles are used to be edited.


-- Maik
Comment 1 Erlend Hamberg 2008-06-05 14:20:02 UTC
I can confirm this.
Pressing tab at the start of line inserts spaces unless tab width = indentation width.

(As a sidenote: This in illegal syntax for Makefiles and should be marked as an error by the syntax highlighter.)
Comment 2 Robin Pedersen 2008-06-05 14:30:28 UTC
I think this is by design.

If you press tab four times, one tab character will be used as four intents.

You can change this behaviour in Editing->Indentation->Tab key action (Always advance to next tab)
Comment 3 Maik Beckmann 2008-06-05 15:39:48 UTC
Thank you Robin.  My first thought when reading your comment was this should really be the default to ensure editing Makefiles isn't broken by the defaults.

But Erlend mentioned on irc that a missing indention script for Makefiles it the actual reason.  

However, an editor that cannot edit Makefiles out of the box is IMHO worth a bug report :) . But the title of this bug report is should be: 

   "kate by default inserts spaces for a tab in Makefiles"

I suggest this one stays open until an indention script for Makefiles is included in trunk.

Best,
 -- Maik
Comment 4 Erlend Hamberg 2008-06-05 16:05:29 UTC
> But Erlend mentioned on irc that a missing indention script for Makefiles it the actual reason.

Well, IF there was an indeting script for Makefiles (which would be quite easy to write I guess) and it was possible to insert tabs, that would solve the problem since the rule would be: always use a literal tab character for indentation.
Comment 5 Soroush 2008-06-05 16:08:36 UTC
I have this problem in kde 3.5.9.5 and i hope this problem be solved.

it is a stupid to go to configuration and change indention type when having different files open  and it is very usual for me to have many files(html,css,c++,bash script, python, ...) open in different languages in different kde invironments including kate and quanta.


moreover i see kate has missed indention for many scripts  including bash
Comment 6 Soroush 2008-06-05 16:57:15 UTC
according to my irc chat in #kate i made a wish for my comment instead of this bug.

http://bugs.kde.org/show_bug.cgi?id=163281

so my above comment can be removed and be considered as that bug.
Comment 7 Dominik Haumann 2008-06-06 18:03:47 UTC
With regard to the Makefile problem: In KDE3 there is a File Type for 
Makefiles. The file type says
kate: space-indent off; indent-width 8; replace-tabs off;
      replace-tabs-save off;

This would be the right fix for KDE4, too. There we switched to modes, every 
highlighting leads to a mode. The mode for Makefiles should be 
preconfigured. Where do we ship this kind of information? In KDE3 we had 
kdelibs/kate/data/katefiletyperc that had the predefined one:

[Makefiles]
Mimetypes=text/x-makefile
Priority=5
Section=Other
Variables=kate: space-indent off; indent-width 8; replace-tabs off; 
replace-tabs-save off;
Wildcards=*Makefile*;*makefile*

and several others. We have to reintroduce this to have proper defaults in 
KDE4, too. Just open the config dialog and go to Open/Save > Modes & 
Filestypes and changes something. Now save it by clicking OK. Now you will 
have the file $HOME/.kde.../share/config/katemoderc, that has the correct 
content.

The correct fix imho is to install a katemoderc file with sane defaults. 
KConfig & friends will merge the options then. Any volunteers to add it to 
svn and try whether it works? :)
Comment 8 Matthew Woehlke 2008-06-20 03:55:45 UTC
Any reason this can't be closed as a dup of bug 163315?
Comment 9 Matthew Woehlke 2008-06-25 02:28:00 UTC

*** This bug has been marked as a duplicate of 163315 ***
Comment 10 Dominik Haumann 2008-06-29 15:27:52 UTC
please close the other way round, as the other report has much more info... 
even info how to fix it.
Comment 11 Leo Savernik 2008-06-30 19:15:48 UTC
Duping other way round.
Comment 12 Leo Savernik 2008-06-30 19:16:18 UTC
*** Bug 163281 has been marked as a duplicate of this bug. ***
Comment 13 Matthew Woehlke 2008-07-07 23:39:53 UTC
> please close the other way round, as the other report has much more info...

IMO this one has too *much* info which is why I closed it as I did. For now, I'm changing the summary of this. Someone please either re-close this, or close bug 163315 as duplicating this.
Comment 14 Malte S. Stretz 2009-06-16 12:09:09 UTC
*** Bug 163315 has been marked as a duplicate of this bug. ***
Comment 15 Maik Beckmann 2009-10-19 00:19:21 UTC
I just asked at the #kate channel about this bug report.  The response was, that there is no value in putting time into full Makefile editing support.  

IMO, this rules an editor component out from being an serious development tool.  Makefiles are all around and will stay for a long time (CMake i.e. generates Makefiles for the most of us).

Many beginners will go though the Makefile road before they learn to embrace an full featured build tool, like CMake.


Regards,
 -- Maik
Comment 16 Milian Wolff 2009-10-19 00:36:33 UTC
No Maik, this is _not_ what I said. And additionally, it was just _my_ opinion. I don't know whether other people want to work on it. I never said that this is a WONTFIX!

To reiterate what I said to Maik:

1) I _personally_ don't see the need to fix this bug as so grave. Especially not with so many _easy_ workarounds available.
2) Makefile editing is _in my eyes_ not crucial for a "serious development tool". And even if it is, it's imo pretty bold to say that just because Kate is lacking in this regard it's broken/rubbish in it's whole.
3) It's hard to accept, but in FOSS many people just don't share your opinion. You'll have to discuss it with them and accept if someone disagrees with you. I tried explaining you what I repeated above, and you just went away. Again: If someone comes up with a fix, it will be integrated in Kate. It's just not _me_ who does it.
Comment 17 Maik Beckmann 2009-10-21 10:15:16 UTC
Milian Wolff:
> I _personally_ don't see the need to fix this bug as so grave. Especially
> not with so many _easy_ workarounds available.

_easy_ workarounds are workarounds non the less. 

I did not make this bug report because I didn't know how to get around it, I'm not a noob.  I made it, because many people tasting kate for the fist time will face this problem and a good portion of them will just walk away.

Another reason was, that I was curious how you guys deal with such little flaws, before I start work on kate myself.


>If someone comes up with a fix, it will be integrated in Kate. 
> It's just not _me_ who does it.

The age of this bug report tells me, that there is nobody in the kate community who cares very much about this, not just you.


Regards.
Comment 18 Andreas Pakulat 2009-10-21 11:59:18 UTC
(In reply to comment #17)
> Milian Wolff:
> >If someone comes up with a fix, it will be integrated in Kate. 
> > It's just not _me_ who does it.
> 
> The age of this bug report tells me

Its just a bit more than a year. There are much much older bugreports open for kate.

>, that there is nobody in the kate community
> who cares very much about this, not just you.

That may very well be because none of the developers uses plain Makefile's these days and only few of them (if any) have time for kate development at all.

Personally I _never_ even tried to learn them, I do know a bit so I can understand the easy ones, but I don't see a single reason for writing Makefile's manually. Or even looking at the generated Makefile from CMake.
Comment 19 Dominik Haumann 2009-10-21 22:03:38 UTC
SVN commit 1038772 by dhaumann:

Makefiles always use tabs -> add predefined mode:
kate: tab-width 8; indent-width 8; replace-tabs off; replace-tabs-save off;
BUG:163220

 M  +3 -0      katemoderc  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1038772
Comment 20 Dominik Haumann 2009-10-21 23:24:47 UTC
SVN commit 1038801 by dhaumann:

Makefiles always use tabs -> add predefined mode:
kate: tab-width 8; indent-width 8; replace-tabs off; replace-tabs-save off;

Far too much bla bla in the bug report. Why don't you just fix it. Moo.
CCBUG:163220


 M  +3 -0      katemoderc  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1038801
Comment 21 Maik Beckmann 2009-10-26 00:23:47 UTC
Thank you Dominik!