4

This is a simplified version of a function in my .emacs file: (defun ml/bash () "Start a terminal emulator in a new window." (interactive) (split-window-sensibly) (other-window 1) (ansi-term (executable-find "bash"))) You can bind it to C-c a: (global-set-key (kbd "C-c a") #'ml/bash)


2

From my point of view you should accept Cyberbisson's most useful answer. I'll give you a formal one and the way to determine that information for yourself. Why can't I use this key (global-set-key (kbd "M-o") 'other-window) defined in my emacs config, in ansi-term char mode? Are all meta keybindings simply passed raw to the terminal process? F1 ...


2

It may be helpful for you to know that in char-mode, all C-x key sequences are mapped to C-c. You don't need to define your own key sequence for what you want, therefore, you can just do C-c C-o. As you suspected, this mode passes just about everything along to the terminal that is not prefixed.


2

I am wondering if one could adjust the above so that the ansi-term behaves like M-x shell in the sense of opening in a new window (in the current frame -- at the bottom, just like M-x shell does). The canonical and most flexible way to customise such rules is via display-buffer-alist (see (emacs) Displaying Buffers and its subnodes, as well as the nodes ...


1

This command should do steps 1 and 3, run it in the buffer you open in step 2 (bind to a key, or rename to something shorter, as you like). (defun isend-with-ansi-term () (interactive) (let ((term-buf (get-buffer "*ansi-term*"))) (unless term-buf (display-buffer (save-window-excursion ; Work around term.el's use of `switch-to-buffer'. ...


1

As user @wasamasa suggested in the comments, the solution is to apply a "process filter" function to the buffer that is receiving the STDOUT and STDERR output from the process. An example walk-through for the procedure would be this: 1) Create a list to maintain your processes and their related buffers: (setq your-proc-list nil) 2) Start with a generic ...


1

Something like this? (defvar run-terminal-app-history nil) (defun run-terminal-app (command &optional name) "Runs COMMAND in a `term' buffer." (interactive (list (read-from-minibuffer "$ " nil nil nil 'run-terminal-app-history))) (let* ((name (or name command)) (switches (split-string-and-unquote command)) (command (pop ...


1

This isn't the special case that you think it is. In general, Meta key sequences can be used in terminals (and the inferior process might have its own use for M-x), so term char mode sends these keys to the terminal. Just like M-x itself, M-f and M-b are bound to term-send-raw-meta in term char mode. The inferior process running in the terminal is simply ...


1

Found the answer, it was a conflict with autopair, solved by adding the following to .emacs (add-hook 'term-mode-hook (lambda() (autopair-mode -1) ))


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