Please find the attached patches which enable fontification and indentation in M-x shell and ielm. The main fontification and indentation machinery is implemented in comint.el and should be general enough for use by other comint derived modes. It works by making an indirect buffer, putting it in a suitable major mode (sh-mode in M-x shell buffers, for example) and fontifying and indenting user input that buffer. The fourth patch also implements highlighting of non-existent or misspelled commands in M-x shell, which I find particularly useful to immediately spot typos. This functionality is disabled by default because it sacrifices a bit of performance.