Remove useless Language Folders



  • I have no need for the huge language list in N++'s “Languages” menu.
    I didn’t even know many of the languages mentioned in there existed at all.
    So I removed most of them using Settings >> Preferences… >> Language.
    Assuming that thus the list would be reduced and easier to access and to keep an overview of.

    However, though languages are removed alright, the containing “folders” remain untouched.
    (instead of N++ removing them when empty, or offering the user the opportunity to intervene according to his own preferences, e.g. by creating a folder “X-Y-Z”, in which he could group all “X, Y, or Z languages”.)
    I’m still left with a list of 18 letters/folders, but I can’t even see straight away if these “letter folders” contain sth. at all! I have to open them to find out.
    So, can I get rid of those folders, or are they hardcoded?
    (which is in fact what I fear, because N++ doesn’t seem to test the number of languages sitting in such a “letter folder”. E.g. XML and YAML don’t have a dedicated “X” or “Y” folder in N++'s default installation, because they are the only covered languages starting with that letter. However, when I remove all “N” languages safe “Normal text”, the latter will not appear as an isolated language, but remains in the “N” folder.)

    N++'s default installation seems to target developers only, and even very knowledgeable ones, given the unseen range of covered languages.
    However, I’m not a developer at all, and at best I would never need more than a handful of language types, hence would very much prefer them to sit at the top of the menu, only one click away.
    Is this at all posible?

    PS:
    Almost 2 years ago, @Peter-Brand asked a similar question here .
    However, I don’t think our aims are the same, for I was able to remove the languages I’m not interested in.

    GH-2017
    (N++ v7.8.5)



  • @GH-2017,

    N++'s default installation seems to target developers

    You are correct, programmers and developers are a major audience for Notepad++.

    I’m still left with a list of 18 letters/folders, …
    So, can I get rid of those folders, or are they hardcoded?

    Actually, you can. After following @Claudia-Frank’s advice, in the same dialog where you got rid of the unused languages (Settings > Preferences > Language), there is the ☑ Make language menu compact checkbox: disable that, exit Notepad++ and re-run, and now your language menu will be nearly empty:

    35c24dea-6d6d-4a0c-9832-c5f1da5f3b33-image.png

    Personally, I only use a couple languges: the UDLs I’ve created for proprietary languages/formats I use at my job, C/C++, Perl, and Python. Thus, you might think I’d’ve shrunk my list down to just those. Nope; I’d never seen a reason for shrinking the list . I rarely use that Language menu except when answering questions on the Forum, because the Language lexer / syntax highlighter is correctly chosen based on the extension; I create new file, do a Save As to give it a name with the right extension, and from the moment of the save onward, the right syntax highlighter is active.

    If you like frequently toggling between a couple of languges (like HTML vs JavaScript), you can add them to the Macros menu and then assign keyboard shortcuts (as described in my post from the beginning of this month), or you can make a script for the PythonScript plugin that will toggle between two using the same keyboard shortcut (as described later in the same topic).



  • You can edit the context menu file (contextMenu.xml), the required syntax is always at hand.

    Imgur



  • @PeterJones

    Great, this works!

    I had been there, but it seems my understanding of “Make language menu compact” is the exact opposite of what this turns out to mean!
    Hence though @Claudia-Frank’s advice was correct, I misinterpreted it.
    Indeed, my sense of “compact” is not 18 folders + some isolated languages with unique first letters.
    It would rather be like your cosey mini-list of personal favorite languages.

    As we are to it:
    is there a way to influence the order of appearance of these languages?
    The Menu is completely alphabetical, but the setting window seems random (without possibility to move selected items up or down the list). IMHO it would make sense if it reflected some true order.

    Finally, thx for the other hints. They may come in handy later on.

    BTW, I don’t have an IT background (as you had gathered): I have no idea what a “lexer” is.



  • @GH-2017 said in Remove useless Language Folders:

    @PeterJones

    Great, this works!

    I had been there, but it seems my understanding of “Make language menu compact” is the exact opposite of what this turns out to mean!
    Indeed, my sense of “compact” is not 18 folders + some isolated languages with unique first letters.

    It’s exactly what it means, and it’s exactly the opposite of what it means. Under normal circumstances, when you have all 80+ languages enabled, “make language menu compact” does make it compact: it compacts it from 80 entries down to about 22 – that’s ~75% reduction in space, which is exactly the intent of that checkmark. Unfortunately, you found the circumstance when it doesn’t quite work as intended: when you’ve already pared down the number of entries that are visible, to then use the submenus that were generated using the entire list, it’s not going to seem very compact.

    is there a way to influence the order of appearance of these languages?

    Not as far as I know

    The Menu is completely alphabetical, but the setting window seems random (without possibility to move selected items up or down the list). IMHO it would make sense if it reflected some true order.

    It would be nice if the settings page had the languages sorted (keeping Normal Text first, so it doesn’t get lost).

    BTW, I don’t have an IT background (as you had gathered): I have no idea what a “lexer” is.

    Lexer” is a software/computer-science word for the code that reads a stream of characters and breaks it into chunks (“tokens”). In the Notepad++ case, the lexer is used to figure out what words need highlighting for syntax highlighting.



  • @andrecool-68

    I don’t have a “Language Syntax” group in my Context Menu.
    Should that be there by default?
    I was able to add my own UDL in the CMenu, though.

    BTW, small aside: I’m impressed by your combination of Western and Cyrillic characters in the CMenu.
    Is that possible owing to the UTF-8 declaration in the first line of “contextMenu.xml”?
    I.e. are both alphabets covered by that encoding?



  • @GH-2017 said in Remove useless Language Folders:

    @andrecool-68

    I don’t have a “Language Syntax” group in my Context Menu.
    Should that be there by default?

    Not by default, it’s a folder @andrecool-68 added. One of the attributes of the <Item> tag is the FolderName="...". If you have one or more <Item>s with the same FolderName in a row, they will all be put into the same submenu of the context menu. There’s a section in the official docs dedicated to Grouping [Context Menu] items into sub-menus.

    BTW, small aside: I’m impressed by your combination of Western and Cyrillic characters in the CMenu.
    Is that possible owing to the UTF-8 declaration in the first line of “contextMenu.xml”?
    I.e. are both alphabets covered by that encoding?

    Yes, the UTF-8 encoding can handle any defined Unicode character, which contains a lot more than just the standard western Latin alphabet and the Cyrillic alphabet. Now, whether the font that’s used by Notepad++ menus will be able to handle those characters (ie, have glyphs for those codepoints) is another question altogether.



  • @GH-2017 You can take my file (as a sample) and edit as you like.

    <?xml version="1.0" encoding="UTF-8" ?>
    <!--
    By modifying this file, you can customize your context menu popuped as right clicking on the edit zone.
    It may be more convinient to access to your frequent used commands via context menu than via the top menu.
    
    Please check "How to Customize the Context Menu" on:
    http://docs.notepad-plus-plus.org/index.php/Context_Menu
    -->
    <NotepadPlus>
    	<ScintillaContextMenu>
    		<!-- 
    		Use MenuEntryName and MenuItemName to localize your commands to add. 
    		The values should be in English but not in translated language.
    		(You can set Notepad++ language back to English from Preferences dialog via menu "Settings->Preferences...")
    		-->
    		<Item MenuEntryName="Edit" MenuItemName="Cut"/>
    		<Item MenuEntryName="Edit" MenuItemName="Copy"/>
    		<Item MenuEntryName="Edit" MenuItemName="Paste"/>
    		<Item MenuEntryName="Edit" MenuItemName="Delete"/>
    		<Item MenuEntryName="Edit" MenuItemName="Select all"/>
    		<Item MenuEntryName="Edit" MenuItemName="Begin/End Select"/>
    		
    		<!-- id="0" is the separator -->
    		<Item id="0"/>
    		
    		<!-- You can use command id to add the commands you want. 
    		Check english.xml to get commands id:
    		https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/installer/nativeLang/english.xml
    		
    		Use FolderName (optional) to create sub-menu. FolderName can be used in any type of item.
    		FolderName value can be in any language.
    		-->
    
    		<Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="CSS"/>
    		<Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="HTML"/>
    		<Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="XML"/>
    		<Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="Batch"/>
    		<Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="Normal Text"/>
    		<!-- <Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="Normal Text" ItemNameAs="TXT"/> -->
    		<Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="JavaScript"/>
    		<Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="INI file"/>
    		<!-- <Item  FolderName="Language Syntax" MenuEntryName="Language" MenuItemName="INI file" ItemNameAs="INI"/> -->
    		
    		<!-- <Item  FolderName="Своё имя группы" MenuEntryName="Language" MenuItemName="CSS" ItemNameAs="Своё имя команды" /> -->
    		<Item id="0"/>
    
    		<Item FolderName="Style token" id="43022"/>
    		<Item FolderName="Style token" id="43024"/>
    		<Item FolderName="Style token" id="43026"/>
    		<Item FolderName="Style token" id="43028"/>
    		<Item FolderName="Style token" id="43030"/>
    		
    		<Item FolderName="Remove style" id="43023"/>
    		<Item FolderName="Remove style" id="43025"/>
    		<Item FolderName="Remove style" id="43027"/>
    		<Item FolderName="Remove style" id="43029"/>
    		<Item FolderName="Remove style" id="43031"/>
    		<Item FolderName="Remove style" id="43032"/>
    		<Item id="0"/>
    
    		<!--
    		To add plugin commands, you have to use PluginEntryName and PluginCommandItemName to localize the plugin commands
    		-->
    		<Item FolderName="Plugin commands" PluginEntryName="MIME Tools" PluginCommandItemName="Base64 Encode" />
    		<Item FolderName="Plugin commands" PluginEntryName="MIME Tools" PluginCommandItemName="Base64 Decode" />
    		
    		<!--
    		Use ItemNameAs (optional) to rename the menu item name in the context menu 
    		ItemNameAs can be used in any type of item. ItemNameAs value can be in any language.
    		-->
    		<Item FolderName="Plugin commands" PluginEntryName="NppExport" PluginCommandItemName="Copy all formats to clipboard" ItemNameAs="Copy Text with Syntax Highlighting" />
    		<Item id="0"/>
    
    		<Item MenuEntryName="Edit" MenuItemName="UPPERCASE"/>
    		<Item MenuEntryName="Edit" MenuItemName="lowercase"/>
    		<Item id="0"/>
    
    		<Item MenuEntryName="Edit" MenuItemName="Open File"/>
    		<Item MenuEntryName="Edit" MenuItemName="Search on Internet"/>
    		<Item MenuEntryName="Run" MenuItemName="Search Microsoft Update Catalog"/>
    		<Item id="0"/>
    
    		<Item MenuEntryName="Edit" MenuItemName="Toggle Single Line Comment"/>
    		<Item MenuEntryName="Edit" MenuItemName="Block Comment"/>
    		<Item MenuEntryName="Edit" MenuItemName="Block Uncomment"/>
    		<Item id="0"/>
    
    		<Item MenuEntryName="View" MenuItemName="Hide lines"/>
    	</ScintillaContextMenu>
    </NotepadPlus>


  • @andrecool-68

    I don’t think this “contextMenu.xml” fully corresponds with your screen shot earlier in this topic, but the "Language Syntax " does, and that’s sufficient. Also, your commented-out example on how to get Russian output clearly illustrates that mechanism.
    Thx for sharing!



  • @PeterJones said in Remove useless Language Folders:

    It’s exactly what it means, and it’s exactly the opposite of what it means.

    I have issued doc PR#77, which among other things, clarifies the “Make Language menu compact” so it’s understood that combing that option with disabled languages might cause there to be empty-letter menus.


Log in to reply