vscode-emacs-mcx icon indicating copy to clipboard operation
vscode-emacs-mcx copied to clipboard

Please support M-l, M-u

Open ganaware opened this issue 6 years ago • 5 comments

Please support M-l, M-u:

https://www.gnu.org/software/emacs/manual/html_node/emacs/Case.html

  • M-l
    • Convert following word to lower case (downcase-word).
  • M-u
    • Convert following word to upper case (upcase-word).

ganaware avatar Jan 11 '19 01:01 ganaware

I will simply assign M-l and M-u to editor.action.transformToLowercase and editor.action.transformToUppercase respectively, to which C-x C-l and C-x C-u are now assigned.

Strictly speaking, this is different from the original behavior of Emacs, on which M-l and M-u work on a different manner from C-x C-l and C-x C-u. However, on VSCode, editor.action.transformToLowercase and editor.action.transformToUppercase work very similarly to both commands according to selection state:

  • If some regions are selected, editor.action.transformTo(Lower|Upper)case converts the region.
  • If no regions are selected, editor.action.transformTo(Lower|Upper)case converts the word next to the cursor.

I think this is more convenient than to set keybindings to emulate the original Emacs' behavior strictly.

whitphx avatar Jan 13 '19 11:01 whitphx

Assigning M-l and M-l to editor.action.transformToLowercase and editor.action.transformToUppercase is good work.

But I think, what is important for M-u and M-l is that they move cursor in additon to upcase (or downcase) word. For example, I can upcase all words of "awesome emacs keymap" only by typing M-u M-u M-u.

If M-u and M-l executed the following command sequences, they would be more resemble to the original Emacs, I think.

  1. emacs-mcx.cursorWordRight
  2. editor.action.transformTo(Lower|Upper)case

ganaware avatar Jan 14 '19 14:01 ganaware

Thank you for good suggestion! I will fix it.

whitphx avatar Jan 18 '19 14:01 whitphx

Hi, v0.2.0 has been released which includes this functionality.

As explained in #53, the current implementation has a drawback which I think though can be ignored in almost all practical cases. Then I remain this issue opened and will fix it, but the priority is not so high since I think the drawback is not a big problem.

whitphx avatar Jan 20 '19 06:01 whitphx

This feature works very good in most cases. Thank you.

ganaware avatar Jan 20 '19 13:01 ganaware

Close this issue giving up implementing the "hard" emulation of Emacs. This extension is going to be intended to mildly map Emacs keybindings to VSCode features.

whitphx avatar Nov 17 '23 16:11 whitphx