I propose the attached patch, which fixes the following problem: 1. M-x shell 2. grep -R -n --color=always 'some-search-string-which-yeilds-resuts' File names and line numbers output by grep should be in color 3. M-x compilation-shell-minor-mode File names and line numbers are now underlined by compile.el 4. M-x compilation-shell-minor-mode, to turn it back off File names and line numbers lose their fontification completely, that is, they are now in the default face. The attached patch makes them return to the face they had after step 2, as specified by the grep command. It also "name-spaces" other text properties used by compile.el, such as keymap and mouse-face. If other minor or major modes make use of these text properties, turning off compilation-shell-minor-mode or compilation-minor-mode should now leave them alone. (Though the ones from compile.el take precedence as long as compilation-*-mode is active.)