2

Use a keyboard macro. Keyboard macros are explained in chapter 17 of the Emacs manual, which is available online as well as inside emacs (type C-h i and select the Emacs manual). In your case, you want to start recording the keyboard macro by typing F3, then typing out the keys you want the macro to execute (C-a C-SPC C-e M-w). Finally, end the recording by ...


1

The following demonstrates the most commonly used method to define a keyboard shortcut using global-set-key. The function bh/switch-to-scratch is okay "as-is". Keep in mind that we are defining SHIFT+F11 in this example: (defun bh/switch-to-scratch () (interactive) (switch-to-buffer "*scratch*")) (global-set-key (kbd "<S-...


1

Emacs commands are usually interactive function, but keyboard macro (i.e., a string or vector) works too, so you can write: (global-set-key (kbd "C-o") (kbd "C-a C-SPC C-e M-w")) An better (more rebust and efficient) option is writing some Lisp code, e.g., (defun your-copy-current-line () (interactive) (kill-new (buffer-substring (...


1

The cleanest way is to not reuse Evil-specific commands or keystrokes unless absolutely necessary. Looking at the definition of :w, which happens to be the evil-write command, one can see that it parses the file name argument and calls shell-command-on-region if it starts with a bang. Here's the equivalent specialized command: (defun my-evil-run-python-...


1

The comments clarified that the question was about the behaviour of holding down the Shift modifier key while Caps Lock was on. It's common for the shift key to invert the state of caps lock, rather than to unconditionally enable caps. Hence: t => t SHIFT + t => T CAPS + t => T CAPS + SHIFT + t => t In that latter case, Emacs sees only a lower-...


1

I experienced the same problem, this is what helped me make it work (although I could not find out why): Generate zh_TW.UTF-8 locale (uncomment in /etc/locale.gen and run locale-gen) Run emacs with LC_CTYPE set to this locale (env LC_CTYPE=zh_TW.UTF-8 emacs)


Only top voted, non community-wiki answers of a minimum length are eligible