From 7d71f2feb008f99909fec2b6def231b1ee8f73b0 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Thu, 3 Nov 2016 17:28:22 -0700 Subject: [PATCH] [Emacs] Fix colorize-compilation-mode read-only settings --- dotfiles/emacs.d/README.org | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index c05ea36d..c240284f 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -4422,13 +4422,17 @@ Set the character used to represent spaces to ยท, and the character used for tab This automatically applies ansi-color interpretation of terminal escape sequences to compilation buffers. #+BEGIN_SRC emacs-lisp -(defun colorize-compilation-buffer () - (let ((was-read-only read-only-mode)) - (when was-read-only (read-only-mode -1)) - (ansi-color-apply-on-region (point-min) (point-max)) - (when was-read-only (read-only-mode +1)))) +(defun imalison:colorize-compilation-buffer () + (let ((was-read-only buffer-read-only)) + (unwind-protect + (progn + (when was-read-only + (read-only-mode -1)) + (ansi-color-apply-on-region (point-min) (point-max))) + (when was-read-only + (read-only-mode +1))))) -(add-hook 'compilation-filter-hook 'colorize-compilation-buffer) +(add-hook 'compilation-filter-hook 'imalison:colorize-compilation-buffer) #+END_SRC ** Automatic Theme Changer Disabled for now