Use tabs instead of spaces for Makefile

Use tabs instead of spaces for Makefile

3
NewbieNewbie
3

    Apr 11, 2014#1

    A file used by GCC Make is typically called "Makefile". It is essential that a Makefile contains tab characters. It won't work with spaces.

    My default UltraEdit setting is to use spaces instead of tabs. I can enter an exception for different file extensions:



    Is there a way to tell UltraEdit to use tabs for files called "Makefile", without an extension?

    6,603548
    Grand MasterGrand Master
    6,603548

      Apr 11, 2014#2

      It is currently in UE v21.10 not possible to define a tab stop / indent / word wrap /auto-complete file configuration based on file name instead of file extension.

      Workaround solution 1:

      Default is used for Makefile and other files without extension. And 1 or more separate configuration(s) is(are) defined for all files usually edited with an extension, see file extension based word wrap, tab and indent settings. The disadvantage of this solution is that a horizontal tab character is inserted into a new file on hitting key TAB as long as the new file is not saved with a file name and extension. And of course all 20+ file extensions of the files usually edited in UltraEdit must be added to one or more list items in the Word Wrap/Tab Settings configuration dialog.


      Workaround solution 2:

      An UltraEdit macro is created and saved into a macro file which is defined next to be executed on every file save at Macro - Set Macro for File Loade/Save. The macro executed on save converts multiple (leading) spaces to tabs before save, but only for files with name Makefile (not case-sensitive). The code for such a macro could be for example

      Code: Select all

      IfNameIs "makefile"
      SpacesToTabs
      EndIf
      The command SpacesToTabs is the same as Format - Spaces to Tabs (Leading) which I think is the right command here as tabs are used in Makefiles only for indentation.

      The disadvantage of this solution is that the macro is not executed by UltraEdit on Save As, only on Save.
      Best regards from an UC/UE/UES for Windows user from Austria

      3
      NewbieNewbie
      3

        Apr 11, 2014#3

        Thanks Mofi!

        A bit surprised this isn't supported, this feels like a common scenario :)
        I'll try the Macro approach.