Emacs 24 shows drop-down menu - emacs

I use emacs in terminal mode. I know how to get the menu through F10 key. Emacs used to show the menu in terminal mode as text in a separate buffer. Either since a recent update, or I installed some package, I notice emacs starts to create a graphic drop-down list for menu items (see the screenshot). However, I only see it on one of my computer (Mac OS), my other computers still show the menu in "text mode". Can anyone tell me how to enable the graphic dropdown list menu feature? Is this a new feature of latest Emacs 24.3 or it can be enabled via some package?

This is described in the NEWS file for Emacs 24.4:
* Emacs now supports menus on text-mode terminals.
If the terminal supports a mouse, clicking on the menu bar, or on
sensitive portions of the mode line or header line, will drop down the
menu defined at that position. Likewise, clicking C-mouse-2 or
C-mouse-2 or C-mouse-3 on the text area will pop up the menus defined
for those locations.
If the text terminal does not support a mouse, you can activate the
first menu-bar menu by typing F10, which invokes `menu-bar-open'.
If you want the previous behavior, whereby F10 invoked `tmm-menubar',
customize the option `tty-menu-open-use-tmm' to a non-nil value.
(Typing M-` always invokes `tmm-menubar', even if `tty-menu-open-use-tmm'
is nil.)
Looks like a nice feature.

Related

Can I configure VS Code to disable Breakpoint by middle click?

I am switching from PyCharm to VS Codium. I want to be able to disable breakpoints by middle mouse click, like in pycharm.
Currently, I can disable a breakpoint by right click at breakpoint and select Disable Breakpoint:
Another way is to disable it in list in Breakpoints view.
But I want to be able to quickly enable/disable it by just clicking with mouse wheel (middle button). Is it possible to configure VS Code this way? Currently, when I middle click on breakpoint, this is ignored, and instead a text from selection clipboard is pasted (it is the default behavior in linux). Visual Studio Code version is 1.66.1.
There is no way at the moment to customize mouse click events. There are a few hardcoded options you can change in the settings, but it is extremely limited like pressing ctrl and the mouse wheel for zoom. As far as I am aware, disabling breakpoints is not among those options.
Check out: https://github.com/microsoft/vscode/issues/3130
I currently use the following workaround.
Remap the middle click to some button.
For wayland several utilities can be used for that. Let's take kbct.
Add such config (edit for your needs)
/etc/kbct/config.yml:
- keyboards: [ "Logitech MX Master" ]
keymap:
btn_middle: f15
Then start kbct.service.
Create the ruler script
Make the file choose_press.sh:
#!/bin/bash
class=$(xdotool getactivewindow getwindowclassname)
if [ "x$class" == "xVSCodium" ]; then
ydotool click 0xC1 # right click
sleep 0.2
ydotool key 107:1 107:0 28:1 28:0 # End, Enter
else
ydotool click 0xC2 # middle click
fi
Do not forget to add executable permissions.
Bind shortcut to the script
To assign a command to shortcut in KDE, go to System Settings -> Shortcuts -> Custom Shortcuts, right click, choose New -> Global Shortcut -> Command/URL. Go to Action tab and fill in the command. In this case it will be the path to choose_press.sh. Note: do not use ~ there.
And in Trigger tab assign the shortcut. In this case we use f15 (use some way to simulate it, if it is not presented on the keyboard).
Start VS Codium
Use vs codium in X11 mode. This is because I currently do not know how to get active window class in wayland.
Result
Now if you middle click in vscodium window, it will receive the sequence of input that leads to enabling/disabling breakpoint. In any other window, the middle click will behave as normal.
There is debug.enableOrDisableBreakpoint in codium, but toggling that with shortcut only works when the cursor is on the line with breakpoint. I did not found a way to move cursor to the line where you pressed (method to get the mouse over line?). So I made that complex thing with ydotool choose_press.sh.
I also tried to start stop kbct by window activation, but that is unfortunately broken in kde wayland currently.

See unsaved changes in vscode

Sometimes when closing vscode, or a tab therein, I get a dialogue asking "Do you want to save the changes you made to filename?" However, the unsaved edits are actually from a previous session that was closed without such a query, probably when turning off the computer, so I can't remember if it was meaningful edits, or maybe just an accidental key-press, like a shortcut gone wrong; and doing undo to revisit the last edits doesn't work either.
My question: How can I see the diff between the saved version of a file, and the version in the editor window? I think it would be nicest just to have a "show diff" option in the dialogue, but for now I'm also happy with a command line diff command.
I'm using ubuntu 20.04.
I'm using VSCode version 1.52.1 on MacOS and I had a similar problem that may not be the same problem, but I'm guessing it will work for you as well.
When you're in the Explorer view, in the upper left part of Explorer you have your "Open Editors." If that shows a dot to the left indicating that the buffer has changes in it, you can right click the file name and select "Compare with Saved." This will open another buffer to the side that will show you any unsaved changes.
To get rid of that window (it took me a bit to figure this out I'm sorry to say!), you can click the 'X' to the left of the extra buffer in "Open Editors."
Hope this works for you!
A few bright notes for the keyboard players out there:
The command you are asking about has a default shortcut. Unless you've applied a keyboard map extension, the Ctrl+Kd arpeggio opens the very same diff view between the active and saved versions of the current file. The default shortcut to close an editor tab (be it the diff or a file or anything at all) is Ctrl+W.
The command, like any command in VSCode, is also accessible via the Ctrl+Shift+P command dropdown (on Linux, F1 opens it too). Start typing e.g. compa sav (it saves your keyboard wear and tear to shorten words to a prefix which is unambiguous enough), and the list will shrink dynamically to just a few commands. Yours is File: Compare Active File with Saved. When it's close to the top enough, navigate the list of commands with the down arrow and execute it with Enter. As a bonus, you may click on the little gear to the right of the command currently highlighted in the list and redefine its shortcut, if you use it very often and prefer a chord shortcut to the default arpeggio one. Sorry, there does not seem to be a shortcut in lieu of the gear click. If there is, please let me know!
But if you really, really want to right-click on the filename in the Open Editors view of the Explorer sidebar, you can open that view directly with, you guessed it, a shortcut: Ctrl+Ke. And if you change your mind on a dime right at this moment, or realize that you in fact never had a mouse to do the right-click in the first place, use Shift+F10 to drop down the "right-click menu", properly called the context menu, which you navigate with arrows and execute with Enter (that's kinda a common theme, as you probably noticed). This works mostly anywhere the right-click does.
While in the Open Editors view, to switch to an editor file tab, move the selection to the desired file. Press Space to bring the file into view but stay in the Open Editors view, or Enter to bring the file into view and shift the keyboard focus to it. Pressing Ctrl+Shift+E brings focus back to the editor from any view in the Explorer sidebar. The same shortcut moves focus to the Explorer sidebar from the editor.
Happy ♬ k'boarding ♬!
ctrl+shift+P (or command+shift+P on mac) and fuzzy search for "compare changes with saved files"

VSCode: "Markdown Preview" SHIFT-COMMAND-P not working

Setup:
VSCode 1.50.1
MacOS High Sierra (10.13.6) - but I think this applies to any OS
Steps to Reproduce:
this is a quick simple one...
click on/hghlight/open a markdown file (.MD extension) in VSCode / from the Explorer tree hierarchy in the Left Nav Pane,
hit SHIFT-COMMAND-V per numerous instructional posts/tutorials - (you can also find the shortcut clearly labeled with that very same Shortcut Key-Combo:
if you RIGHT-CLICK on the file in question...
you will get a Context Menu with several options, include Markdown Preview
hitting the stated key combo of SHIFT-COMMAND-V does nothing,i.e.:
no observable effect in current window or tab
does not open any other tabs
does not render markdown
BEFORE YOU DO ANYTHING:
--
This may seem STUPID/OBVIOUS to most of you... I think I was still asleep when I first tried this... so:
make sure that your cursor is ACTIVE in your .MD markdown document, and NOT active on the filename in the Explorer
Tree in the left-hand Nav
apparently, in VSCode this shortcut SHIFT-COMMAND-V only works when you are ACTIVELY EDITING the file.
using the mouse on the RIGHT-CLICK context menu works fine
even if the .MD file isn't open AT ALL / in ANY EDITOR
even if you're actually actively editing A DIFFERENT FILE, if you hover over the filename in the Explorer/File-Folder Hierarchy,
RIGHT-CLICK and launch Mark Preview, it will work.
Quick Solution:
You most likely have a VSCode "Extension" installed and enabled within VSCode that is blocking the default VSCode shortcuts
in my case, this was Atom Keymap Extension (Here's link to extension in VS Marketplace)
IN VSCode, go to Extensions, find (you can search in the search bar at the top of the Extensions list/Nav Pane) Atom Keymap and UNINSTALL IT
alternately, you can just simplt DISABLE IT if you prefer to use it another time.
restart VSCode
SHIFT-COMMAND-V shortcut SHOULD BE WORKING NOW!
Troubleshooting:
Key Combo not recognized in VSCode (at least in VSCode, see#2 if blocked elsewhere)
If you look at the very bottom-middle/bottom-right of the VSCode window, you will notice the Status Bar (by default the whole bar is bright blue with white text)..
the status bar has several different sections, symbols, and text messages...
you will notice it changes/will indicate when you press a VALID Key-Combo... and that SHIFT-COMMAND-V literally does not result in ANY message on the status bar
But hitting COMMAND-V for instance is reflected in a real-time corresponding message in the status bar telling you that you DID press COMMAND-V
It appears NOT for any Key-Combo that includes SHIFT isn't recognized
confirm it's a VSCode thing only
go to your MacOS System Preferences > Keyboard > Shortcuts > look through each category of shortcuts - you should NOT SEE a key mapping for SHIFT-COMMAND-V

Disable multi cursor functionality

I do not like the Visual Studio multi cursor options, and I never use them.
Inevitably, I phantom-pressing some key combination that brings up a multi cursor option, then I write some code, and then the code is destroyed afterward. Please tell me how to completely disable all such functionality in Visual Studio Code. I am running on Ubuntu, but also interested in how to accomplish this on Windows (if there is any difference).
I should mention, that this happens literally once every 5 minutes to me on Ubuntu, but in Windows it happens much less frequently (like once an hour).
Un-check Selection->Column Selection Mode
You can remove the keyboard shortcut(s) that trigger this functionality.
Click on the gear on the bottom-left corner of the window and choose "Keyboard Shortcuts" from the menu. Type "Add Cursor" into the "Search" box and it shows only the commands that contain "Add Cursor" in their name.
Right-click on each command that add a cursor and has a keyboard shortcut associated and select "Remove Keybinding".
Also search for "Multi-Cursor". It could return the command "Toggle Multi-Cursor Modifier" that is associated to a combination of modifier keys (one or more of Ctrl, Alt, Shift). If such a combination of keys is pressed when you click in the editor window it adds a new text cursor at the click position. You should also removed these key bindings.
Set this settings in editor settings :
"editor.columnSelection": false,
In Android Studio :
Un-check Selection->Column Selection Mode

Drop-down menus in Emacs.app 23 (Lion) only work after several clicks

I am using Emacs.app 23.3.1 on MacOS 10.7.1 (Lion). When I try to use the GUI drop-down menus, they will not appear unless I click on the menu several times. The top-level menu item (e.g., File, Edit, Options) will highlight to acknowledge the click, but the menu will not appear. I have seen this question, but no fix ever appeared. I am not using Synergy. It is obviously not the end of the world, but it is an annoyance. I would prefer not to use the text-only menubar system. This behavior does not appear in Aquamacs.