Community
    • Login

    UDL languages keep disappearing

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    3 Posts 2 Posters 272 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.
    • Nils-Petter OlsenN
      Nils-Petter Olsen
      last edited by

      Hello,

      I’m trying to get into UDLs.

      But why does it disappear everytime I restart the program? Do I have to rewrite the udl every time? I tried saving as, too. Doesn’t help. I’ve rebuilt my language two times now.

      Nils-Petter OlsenN 1 Reply Last reply Reply Quote 0
      • Nils-Petter OlsenN
        Nils-Petter Olsen @Nils-Petter Olsen
        last edited by

        I am going to answer myself and say I figured it out.
        I had clicked “save as” in the define udl window, and saved it in my own folder. Fixed it by moving the saved file to the appdata/ userdefined folder for NPP.

        I learned that this file contained all my UDLs.

        PeterJonesP 1 Reply Last reply Reply Quote 0
        • PeterJonesP
          PeterJones @Nils-Petter Olsen
          last edited by PeterJones

          @Nils-Petter-Olsen said in UDL languages keep disappearing:

          I had clicked “save as” in the define udl window, and saved it in my own folder

          You need to be more precise in your description, because that’s not what happens (under normal circumstances).

          1. You open Language > User Defined Language > Define Your Language
          2. You create your new definition (though it’s currently under the “User Defined Language” name
            • at this point, if you were to exit Notepad++, it would be lost; Notepad++ never stores the UDL named “User Defined Language” – it’s only there as a test bed
          3. Hit Save As. You give it a name. There is still no file defined. It’s just got an internal name.
            • An alternate for Steps 2 and 3 would be to start by hitting Create New, which will immediately request a name; you can then define the language after that.
            • Either way, it’s named, but no config file is written yet.
          4. Exit Notepad++: with a normal installation, it will write a file called userDefineLang.xml in your %AppData%\Notepad++ directory, assuming it has permission, with the new language(s) that you’ve defined. You should not have to move the file anywhere; it’s in the right spot to begin with.

          If this isn’t the behavior you experienced, then either those weren’t the steps you followed, or you didn’t have write permission to your %AppData%\Notepad++ directory, or your Notepad++ wasn’t set up to use %AppData% – sharing your ?-menu’s Debug Info could give us insight into any non-standard config you have in that regard. If it wasn’t in the right spot in step 4 for you, you should have told us where it was, so that we could help you debug why it was in the wrong spot (but I personally doubt it was in the wrong spot, unless you have a weird configuration… or maybe if you were in Admin mode)

          ((Hmm, maybe if you had multiple instances of Notepad++ open, it wouldn’t save properly, if the one you saved it in wasn’t the instance that had the permissions to save configs; that might be the umpteenth reason to not use multi-instance Notepad++; I haven’t tried, and won’t bother. See the Alternate section below for a procedure that will be immune to this, even if only the primary N++ instance can write to the default UDL file, which I’m not sure if there is such a limitation or not.))

          I learned that this file contained all my UDLs.

          When created that way, yes.

          A few years back, Notepad++ added a new %AppData%\Notepad++\userDefineLangs\ folder to hold individual UDL per file, to make it easier to make use of someone else’s UDL definition (like from the UDL Collection). But when you create a new UDL using the sequence above, it makes use of the old, combined file, rather than standalone files in the subdirectory.

          So if, in your original report, by “disappear”, you meant "no file shows up in %AppData%\Notepad++\userDefineLangs\, then that’s expected behavior. But when you restart Notepad++, they should have still shown up in the Language menu, whether you created it with Save As or Create New from the UDL dialog.

          Alternate

          That said, I dislike Notepad++'s default behavior of keeping them all in the single userDefineLang.xml file, and much prefer using the userDefineLangs\ folder. So I use a slightly modified sequence:

          1. Open Language > User Defined Language > Define Your Language
          2. Immediately hit Save As (or Create New) and give it a name (in this example, I will use MyName)
          3. Before inputting any keywords or stylers, I hit Export, and save to %AppData%\Notepad++\userDefineLangs\MyName.xml
          4. Confusingly, I now hit Remove to delete the current copy of MyName from the UDL dialog (if you skip this step, you will soon have two copies of the same UDL name)
          5. Exit Notepad++ and restart
          6. Language > MyName will exist (though it won’t do any highlighting yet)
          7. Go to Language > User Defined Language > Define Your Language and pick MyName from the dropdown.
          8. Edit the Stylers and Keywords, etc, to make the UDL do what I want.
          9. Notepad++ automatically saves any changes made to the UDL to the right config file when you exit Notepad++ (assuming not in multi-instance mode; I make no guarantees or warranties about behavior in that confusing mode)

          … Hmm, the User Manual isn’t clear enough on that in the UDL File Locations section. I should fix that.

          Update: new section “Keeping UDL Files Separate” using a variant of that sequence of steps.

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