New answers tagged


In order to know that a buffer represents a remote connection, you can use file-remote-p. You can read about this function Here For example, in a shell buffer, (file-remote-p default-directory) will allow you to differentiate between a local shell and a remote shell. In order to toggle company-mode, you can call the company-mode function with a parameter ...


As regards Linux, the behaviour can be controlled by with: (setenv "LANG" ENCODING) before calling M-x shell and after from the shell buffer with: (set-buffer-process-coding-system INPUT-ENCODING OUTPUT-ENCODING) Both should be set to a value compatible with the string to be represented. UTF-8 encoding family should work in most of the cases. To ...


You could use M-x compile with an appropriate compile-command value. e.g. as a file-local variable: # -*- compile-command: "python"; -*- Emacs will prompt you to save (or not) the file before running the command.


Use M-! (M-x shell-command) if you want to run a shell command, e.g. python and print the output in a new buffer (*Shell Command Output*). That does not open a shell in a new buffer. Use M-x shell to run a shell in a new buffer as pointed by @NickD.

Top 50 recent answers are included