Community
    • Login

    Default file name for save?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    13 Posts 4 Posters 4.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Michael VincentM
      Michael Vincent @PeterJones
      last edited by

      @peterjones said in Default file name for save?:

      There is no current way to change the default name

      @John-English

      Actually, you can change the default name by editing the tab-untitled-string value in your localization language file. For me, I’m using ‘localization\english_customizable.xml’ and I have the value set as:

                  <tab-untitled-string value="new-" />
      

      The default is "new " , notice the space after the “w”. I just put a dash instead of the space.

      For me to get this to work, I have to copy english_customizable.xml to $(NPP_DIR)\nativeLang.xml.

      Cheers.

      PeterJonesP Alan KilbornA John EnglishJ 3 Replies Last reply Reply Quote 4
      • PeterJonesP
        PeterJones @Michael Vincent
        last edited by

        @michael-vincent ,

        Actually, you can change the default name by editing the tab-untitled-string value in your localization language file.

        Cool, I didn’t know that. Apparently, that was changed in v8.0 – it was item #26 in the v8.0 announcement – but I don’t always notice the implications of all listed changes from the announcements.

        1 Reply Last reply Reply Quote 4
        • Alan KilbornA
          Alan Kilborn @Michael Vincent
          last edited by Alan Kilborn

          @michael-vincent said in Default file name for save?:

          for me to get this to work, I have to copy english_customizable.xml to $(NPP_DIR)\nativeLang.xml.

          Don’t you just edit english_customizable.xml and then go into Preferences > Settings… > General > Localization and then choose it, or re-choose it if it is already chosen? (That’s how I do it)

          1 Reply Last reply Reply Quote 2
          • John EnglishJ
            John English @Alan Kilborn
            last edited by John English

            @alan-kilborn
            You’re right, I don’t agree.

            1. Spaces in filenames are evil IMHO, there are too many things that break if you use them – so why have an unchangeable default that includes a space?
            2. By your logic files shouldn’t have a default name at all. You may be right, but since there is one I’d like to be able to configure it.
            3. If there’s a name conflict, the save dialog will warn you that the file already exists and ask if you want to overwrite it.

            And as it happens, what I am trying to do is provide a bundled copy of portable NPP with a compiler to distribute to some students, who are indeed complete noobs. And if they just hit “save”, NPP saves the file successfully as “New 1.cpp”, and gcc then chokes. I’m trying to prevent gcc choking if this happens, that’s all. Sorry you disapprove of me trying to do this.

            PeterJonesP Alan KilbornA 2 Replies Last reply Reply Quote 1
            • John EnglishJ
              John English @Michael Vincent
              last edited by

              @michael-vincent
              Excellent, that worked. Many thanks.

              I had to change the language from “English” to “English (customisable)” – originally I was using “English” so I edited english.xml then started up NPP, but it appeared to have no effect.

              1 Reply Last reply Reply Quote 1
              • PeterJonesP
                PeterJones @John English
                last edited by

                @john-english ,

                so why have an unchangeable default that includes a space?

                It’s not unchangable, as Michael proved, and you acknowledged in your next post.

                spaces in filesnames are evil IMHO

                You can choose to avoid spaces if you desire. But just because you choose to not handle them the way that both Linux and Windows want you to handle spaces in filenames (with using quotes around the names from command lines) doesn’t make them unusable.

                NPP saves the file successfully as “New 1.cpp”, and gcc then chokes.

                gcc doesn’t choke. The command line environment doesn’t pass them as a single token to gcc, so gcc properly treats them as multiple tokens. If you correctly use your command line environment (whether it’s cmd.exe or powershell, or a bash or similar shell in Linux) and put quotes around filenames with spaces, gcc (and other programs, including builtin’s like Windows’ cmd.exe’s type command) will properly handle filenames with spaces.

                Here’s an example of me showing that I have gcc, and that both gcc and type have the same difficulty if I misuse cmd.exe and don’t put quotes around spaced filenames, and both gcc and type work if I correctly use cmd.exe and do put quotes around spaced filenames.

                D:\Users\Peter\Downloads\NppCommunity>where gcc
                c:\usr\local\apps\berrybrew\perls\system\c\bin\gcc.exe
                
                D:\Users\Peter\Downloads\NppCommunity>gcc new 1.c
                gcc: error: new: No such file or directory
                gcc: error: 1.c: No such file or directory
                gcc: fatal error: no input files
                compilation terminated.
                
                D:\Users\Peter\Downloads\NppCommunity>gcc "new 1.c"
                
                D:\Users\Peter\Downloads\NppCommunity>a.exe
                Hello world
                
                D:\Users\Peter\Downloads\NppCommunity>type new 1.c
                The system cannot find the file specified.
                Error occurred while processing: new.
                The system cannot find the file specified.
                Error occurred while processing: 1.c.
                
                D:\Users\Peter\Downloads\NppCommunity>type "new 1.c"
                #include <stdio.h>
                int main() {
                    fprintf(stdout, "Hello world\n");
                }
                

                If you are trying to help noob students, I don’t disagree that changing Notepad++'s defaults to not include a space is a good idea – I think it is, so go ahead and make that change – but you should also teach them the right way to handle names with spaces, because otherwise they are going to learn your prejudices against spaced filenames and think they have a basis in fact rather than in opinion. But the fact is, if those noobs are taught correctly, they can move beyond your spaceless limitation into the world of modern filenames, just by typing a couple extra quote marks on the command line.

                John EnglishJ 1 Reply Last reply Reply Quote 3
                • Alan KilbornA
                  Alan Kilborn @John English
                  last edited by

                  @john-english said in Default file name for save?:

                  a compiler to distribute to some students, who are indeed complete noobs.

                  Then teach them well by following my previous advice to give their files meaningful names, and not just blindly accept obvious defaults (“new 4”) that are meant to be changed.

                  Really, you’re a teacher… so teach.

                  John EnglishJ 1 Reply Last reply Reply Quote 2
                  • John EnglishJ
                    John English @Alan Kilborn
                    last edited by

                    @alan-kilborn
                    I’d prefer to save my energy to teach things that are worthwhile, not just bodging arond problems in the tools they have to use.

                    Alan KilbornA 1 Reply Last reply Reply Quote 0
                    • John EnglishJ
                      John English @PeterJones
                      last edited by

                      @peterjones said in Default file name for save?:

                      It’s not unchangable, as Michael proved, and you acknowledged in your next post.

                      Yes, once I saw that the problem was solved. Pity it’s such a non-obvious way to change a setting.

                      gcc doesn’t choke. The command line environment doesn’t pass them as a single token to gcc, so gcc properly treats them as multiple tokens. If you correctly use your command line environment (whether it’s cmd.exe or powershell, or a bash or similar shell in Linux) and put quotes around filenames with spaces, gcc (and other programs, including builtin’s like Windows’ cmd.exe’s type command) will properly handle filenames with spaces.

                      I have put quotes around the name, but I am invoking gcc indirectly via another tool (which I have no control over) which strips spaces and doesn’t replace them. Not an uncommon thing, in my experience, which is why I’m prejudiced against the use of spaces – not that spaces are inherently evil but there is a lot of badly-written software out there that doesn’t play nicely when spaces are used. (There is also a lot of software that still doesn’t grok UTF-8 – another of my pet gripes, after lo these many years.)

                      If you are trying to help noob students, I don’t disagree that changing Notepad++'s defaults to not include a space is a good idea – I think it is, so go ahead and make that change – but you should also teach them the right way to handle names with spaces, because otherwise they are going to learn your prejudices against spaced filenames and think they have a basis in fact rather than in opinion. But the fact is, if those noobs are taught correctly, they can move beyond your spaceless limitation into the world of modern filenames, just by typing a couple extra quote marks on the command line.

                      My prejudice is that too many programs do not handle spaces correctly, so it is they you should be delivering your lecture to, not me.

                      1 Reply Last reply Reply Quote 0
                      • Alan KilbornA
                        Alan Kilborn @John English
                        last edited by

                        @john-english said in Default file name for save?:

                        I’d prefer to save my energy to teach things that are worthwhile, not just bodging around problems in the tools they have to use.

                        With this sort of attitude, it’s no wonder today’s students aren’t well-prepared for being out in the real world, dealing with problems that they will encounter.

                        I don’t know…this whole thread is filled with your complaints about other tools that do things poorly, but you are taking out your frustrations on poor Notepad++, that is really only trying to give you a hint to give your files a good name (and not new 4.cpp, not new-4.cpp) when you save them. That point, which I’ve tried to make twice now, seems to be lost on you.

                        Pity it’s such a non-obvious way to change a setting.

                        Software developers don’t have infinite time to develop a nice and tidy solution that makes everyone happy, for everything that anyone might possibly want. On this one, if I were you, I’d be grateful that there is a way to do what’s wanted, even if “non obvious”.

                        My prejudice is that too many programs do not handle spaces correctly, so it is they you should be delivering your lecture to, not me.

                        So the people that are providing support for Notepad++ get chided, even though Notepad++ handles spaces just fine; nice.

                        There really isn’t anything more to say here (it’s all too dumb), except “I’m blocking the poster”.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors