Community
    • Login

    How can you make All types (*.*) the default, when saving

    Scheduled Pinned Locked Moved General Discussion
    41 Posts 15 Posters 11.8k 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.
    • Marcel AbeleM
      Marcel Abele @PeterJones
      last edited by Marcel Abele

      @PeterJones
      I’m sorry for not replying to your macro.
      I’m new to this forum. I would describe myself as a simple user, certainly not a developer.
      If I have to write a macro as a workaround for a functionality that previous versions had as a default feature, I think this is certainly over-complicating things. Using workarounds that work with macros, as shown in your post, don’t really work, if you have to change your machine frequently. Every time you jump on another computer, you have to install your macro again. This is just not gonna happen.

      If I want a workaround, I can always select “All types (*.*)” from the SaveAs dropdown-menu. That still works. It just adds another step, which wasn’t necessary in previous versions.

      Also, adding the extensions in langs.xml seems to be excessive. I could add common extensions, I regularly use, but it wouldn’t work with new extensions I might want to choose. Again I would have to fix this on every machine I’m working on, and have to edit this every time I’m creating a new extension.

      I totally agree with @Michael-Vincent. I would also call it an “easy fix”, if it was available in the dropdown-menu for default language in the settings.

      So, thanks for your replies @PeterJones. I made this post to find out, if there was an easy way to change this that I couldn’t see. But if this is not the case, I will have a look and try to find out, how to make this a feature request.

      Thanks for everyone, who replied.

      1 Reply Last reply Reply Quote 0
      • guy038G
        guy038
        last edited by

        Hi, @peterjones,

        The new auto-apply-extensions-in-both-dialog-modes was implemented to make the majority more happy, which had the side effect of making the minority more unhappy.

        I particularly appreciate your formulation ! Always the same story ;-))

        BR

        guy038

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

          Also said well as:

          “You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
          ― John Lydgate

          The attribution is just something found on the internet; decide for yourself if it is accurate – if it matters. :-)

          Anyway, how about a different approach on this?: How does one tell Windows that an extension it currently doesn’t know about is one that it SHOULD know about, and then Notepad++ would not append .txt (in the default case) to it when saving such a file for the first time?

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @Alan Kilborn
            last edited by

            @Alan-Kilborn said in How can you make All types (*.*) the default, when saving:

            Anyway, how about a different approach on this?: How does one tell Windows that an extension it currently doesn’t know about is one that it SHOULD know about, and then Notepad++ would not append .txt (in the default case) to it when saving such a file for the first time?

            regedit: RightClick on HKEY_CLASSES_ROOT in the left pane, New > Key, give it the name of the extension (like .main or .xyzzy from my previous examples). That was sufficient to tell Windows that it should know that extension exists. If you also want to make a file association, add a (Default) value – using (Default) = txtfile will make it the same “type” as .txt under normal circumstances… you can look at HKEY_CLASSES_ROOT\.txt to see if it still points to txtfile on your system.

            PeterJonesP 1 Reply Last reply Reply Quote 0
            • Michael VincentM
              Michael Vincent @PeterJones
              last edited by

              @PeterJones said in How can you make All types (*.*) the default, when saving:

              I haven’t looked at the code, but if that pulldown is statically generated (in resource files) rather than dynamically generated, it might be hard to add the UDL, which are dynamic.

              @Alan-Kilborn - thoughts below keep with your “way Windows functions” sentiment - which is true. This just allows users to pick a default file type that equals . rather than *.txt or *.cpp or …
              @guy038 - value your opinion as a “power user” on this sight and already chiming in on this discussion.

              The list I highlight in my above post dynamically generated and purposefully ignores L_USER (which is the default User Defined Language):

              https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp#L1219

              			size_t index = 0;
              			for (int i = L_TEXT ; i < nppParam.L_END ; ++i)
              			{
              				str.clear();
              				if (static_cast<LangType>(i) != L_USER)
              				{
              					int cmdID = nppParam.langTypeToCommandID(static_cast<LangType>(i));
              					if ((cmdID != -1))
              					{
              						getNameStrFromCmd(cmdID, str);
              						if (str.length() > 0)
              						{
              							_langList.push_back(LangID_Name(static_cast<LangType>(i), str));
              							::SendDlgItemMessage(_hSelf, IDC_COMBO_DEFAULTLANG, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(str.c_str()));
              							if (ndds._lang == i)
              								index = _langList.size() - 1;
              						}
              					}
              				}
              			}
              			::SendDlgItemMessage(_hSelf, IDC_COMBO_DEFAULTLANG, CB_SETCURSEL, index, 0);
              

              I see your point about confusion why not all custom UDLs would be added - and to me (and probably you and other “power users”) it would be obvious - because those custom UDLs are not in the Notepad++ L_* language ID list and they don’t have a build-in parser, etc. But alas, one fix to help those complaining now will lead to others complaining later.

              Still, I wonder if an if ... else that identifies L_USER and then instead of ignoring it or adding it with its default name “User Defined Language”, it is added to that combo box as “All Files (.)” or “No Default Type”. Of course the Language menu and the bottom left status bar would still show “User Defined Language”, but maybe that would make it less obvious the two are “tied” together and thus squelch the cries for all custom UDLs to be added to the combo box?

              Comments, thoughts?

              Cheers.

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

                …
                I experimented and verified the following:

                In Notepad++ v7.8.9-64bit

                • I added HKEY_CLASSES_ROOT\.xyzzy with (Default) = txtfile, and Windows treated it as a text file, and Notepad++ Save As allowed me to type that extension (even when it’s not in the langs.xml list)
                • I added HKEY_CLASSES_ROOT\.main with nothing for (Default), and Windows didn’t treat it as a text file, but Notepad++ Save As still allowed me to type that extension
                • I verified HKEY_CLASSES_ROOT\.magnify did not exist, and Notepad++ Save As appended .txt after the .magnify that I typed.

                I then switched to Microsoft Notepad, with the same three entries in my registry:

                • Save As ms.xyzzy => created ms.xyzzy
                • Save As ms.main => created ms.main
                • Save As ms.magnify =>created ms.magnify.txt

                So the Notepad++ Save As behaves similarly to Notepad Save As with regard to extensions.

                —
                PS: picked .magnify because I saw .mag just before .main in the registry, so “magnify” popped into my mind, and I knew that .magnify didn’t exist

                PeterJonesP 1 Reply Last reply Reply Quote 2
                • PeterJonesP
                  PeterJones @Michael Vincent
                  last edited by

                  @Michael-Vincent said in How can you make All types (*.*) the default, when saving:

                  Still, I wonder if an if … else that identifies L_USER and then instead of ignoring it or adding it with its default name “User Defined Language”, it is added to that combo box as “All Files (.)” or “No Default Type”

                  That’s a great idea. Thanks for the research.

                  If we can convince @Marcel-Abele to submit the Feature Request issue, and you chime in with your notes there, you might be able to convince someone (maybe Scott) to add the else to the code you quoted.

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

                    I recently said,

                    Save As ms.magnify =>created ms.magnify.txt

                    Just to make sure there wasn’t a difference between 3-letter extensions and long-extensions, I also tried ms.max (checking that regedit didn’t show a .max key) in Microsoft Notepad, with Save As Type = Text Documents (*.txt), and Windows still added the extra .txt, naming it ms.max.txt.

                    In Notepad, I also went to Save As Type = All Files (*.*), and typed ms.max, and it saved as ms.max without appending .txt.

                    In Notepad++, the Text type appended .txt so blah.txt became blah.max.txt, but with All Types (*.*) selected, blah.max became blah.max, no extra extension.

                    In other words, the Microsoft Save / Save As dialog behaves identically with regard to type and extension in Microsoft Notepad as it does in Notepad++.

                    Michael VincentM 1 Reply Last reply Reply Quote 1
                    • Michael VincentM
                      Michael Vincent @PeterJones
                      last edited by

                      @PeterJones said in How can you make All types (*.*) the default, when saving:

                      In other words, the Microsoft Save / Save As dialog behaves identically with regard to type and extension in Microsoft Notepad as it does in Notepad++.

                      I did some basic research (read: not as exhaustive and documented as yours) when this feature first was introduced and I was convinced it behaved like Windows notepad.exe. Glad to see proper documented research that upholds my claim.

                      Still, I think the (perceived) “issue” is that Notepad++ let’s a user pick the default language from a rather exhaustive list (Windows notepad.exe offers “*.* or *.txt”) so there is this assumption (right or wrong) that typing any extension will result in “myfile.anyExtension”, not “myfile.anyExtension.txt”.

                      Of course, your research shows that if Windows knows about the extension - even though Notepad++ doesn’t have it in its language list, the assumption proves correct. If however Windows doesn’t know about it (maybe you’re creating your own user-defined file type, maybe you don’t have the program whose file you’re editing installed in your Windows so the filetype was not registered, whatever …) then the assumption proves wrong.

                      It seems with Notepad++ set to *.* then any extension typed, whether Windows knows about it or not results in “myfile.anyExtension” - so making the option to set *.* as the default would “fix” the (perceived) “issue”. The current combo box just doesn’t have that option now and the easiest way to add it is with L_USER (User Defined Language), but I see the unintended consequences that may arise.

                      Cheers.

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

                        @Michael-Vincent said in How can you make All types (*.*) the default, when saving:

                        so making the option to set . as the default would “fix” the (perceived) “issue”

                        But then wouldn’t the people that want .txt, or whatever fixed/known extension, to be added automatically–when no extension is manually appended by them–start complaining?

                        Perhaps this is a “no win” situation, without the addition of a setting to control it, but I personally find that somewhat distasteful–one more confusing setting – probably would be confusing due to a complicated thing being explained in a short text blurb on the UI).

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

                          @Alan-Kilborn said in How can you make All types (*.*) the default, when saving:

                          But then wouldn’t the people that want .txt, or whatever fixed/known extension, to be added automatically–when no extension is manually appended by them

                          If I understand correctly, any new file saved will default to the extension specified by the first extension option based on what they have selected in the combo box we’re taking about. For me, I have “Normal Text” selected so any “new 1” file I have open and save for the first time as “myfile” (no extension), .txt is automatically appended for me. If I save as “myfile.xyzzy” (unknown brand new extension) then I get “myfile.xyzzy.txt” which is what the OP was asking about. Letting a user select “No Default Type” from that pull down would result in my examples:

                          myfile => myfile
                          myfile.xyzzy => myfile.xyzzy

                          Selecting the default of Normal Text would result in:

                          myfile => myfile.txt
                          myfile.xyzzy => myfile.xyzzy.txt

                          I won’t argue either is right - they both behave according to Windows default Save As behavior as @PeterJones shows above. My proposal just gives users the option to select *.* as the default new document type if that’s the way they want to operate.

                          Cheers.

                          1 Reply Last reply Reply Quote 2
                          • Alan KilbornA
                            Alan Kilborn
                            last edited by

                            FWIW (probably nothing), I noticed that if you do a Rename… operation on a file, the Save as type: box seems to always be set to All types (*.*) when the Save As box appears.

                            1 Reply Last reply Reply Quote 1
                            • remus_roanR
                              remus_roan
                              last edited by

                              I just updated my Notepad++ on my Windows 10 laptop and hit this issue. Why is this issue? Because I use NppFTP to edit files on a lot of linux hosts. Now when I save files to my hosts after editing it applies useless .txt extension to all files.

                              PeterJonesP dennis mcmanamonD 2 Replies Last reply Reply Quote 0
                              • PeterJonesP
                                PeterJones @remus_roan
                                last edited by

                                @remus_roan ,

                                Did you try any of the workarounds mentioned above? Because for the near future (until someone makes an official feature request, and the developers decide to implement and release it), your choices are to use one of those workarounds or downgrade to an earlier Notepad++.

                                If the workarounds don’t work for you, please explain exactly what you did, and we’ll try to help you get it working.

                                1 Reply Last reply Reply Quote 1
                                • dennis mcmanamonD
                                  dennis mcmanamon @remus_roan
                                  last edited by

                                  This post is deleted!
                                  1 Reply Last reply Reply Quote 0
                                  • Tom CavenderT
                                    Tom Cavender @PeterJones
                                    last edited by

                                    @PeterJones Respectfully, if there was simply an option to choose “no extension” or “. All file types” in settings, this would be much, much less frustrating.

                                    I understand that some, maybe even a majority may want “*.txt” as their default, but it should be far simpler for those of us who want no extension as their default. In any case, thanks for listening.

                                    Alan KilbornA PeterJonesP 2 Replies Last reply Reply Quote 0
                                    • Alan KilbornA
                                      Alan Kilborn @Tom Cavender
                                      last edited by

                                      @Tom-Cavender

                                      Version 7.9.1 has:

                                      608e2783-cbb6-4b86-838b-133cf1afab3a-image.png

                                      Maybe that helps?

                                      Tom CavenderT Hillarie FurmanH 2 Replies Last reply Reply Quote 2
                                      • PeterJonesP
                                        PeterJones @Tom Cavender
                                        last edited by

                                        @Tom-Cavender

                                        Respectfully, I called them workarounds, which implicitly acknowledges it might not be the best way to implement it, but it was the only way available at the time.

                                        The good news is that someone did follow my advice, and put in the feature request; moreover, that feature has been implemented, and the version with it implemented has been released: v7.9.1. If you want that feature, install the new version.

                                        1 Reply Last reply Reply Quote 1
                                        • Tom CavenderT
                                          Tom Cavender @Alan Kilborn
                                          last edited by

                                          @Alan-Kilborn That helped immensely. Thank you thank you thank you thank you!!!

                                          Alan KilbornA 1 Reply Last reply Reply Quote 0
                                          • Alan KilbornA
                                            Alan Kilborn @Tom Cavender
                                            last edited by

                                            @Tom-Cavender

                                            Well, I didn’t do the work to make it happen, just pointed it out!
                                            That part was very easy.
                                            Praise to the developers, who do the hard parts!
                                            :-)

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