Emacs: Fix ANSI color application in logfiles.

This commit is contained in:
tastytea 2020-10-14 00:01:47 +02:00
parent b459881bd6
commit e6a6bd812c
1 changed files with 12 additions and 7 deletions

View File

@ -1,6 +1,6 @@
;;; misc.el --- Miscellaneous file formats. -*- lexical-binding: t; -*- ;;; misc.el --- Miscellaneous file formats. -*- lexical-binding: t; -*-
;; Time-stamp: <2020-10-13T23:36:21+0200> ;; Time-stamp: <2020-10-14T00:01:20+0200>
;;; Commentary: ;;; Commentary:
@ -193,12 +193,17 @@
;; Translate ANSI escape color codes. ;; Translate ANSI escape color codes.
(use-package ansi-color (use-package ansi-color
:config (defun my/display-ansi-colors () :config (progn
(interactive) (defun my/apply-ansi-colors-on-buffer ()
(let ((inhibit-read-only t)) "Apply ANSI colors in the current buffer."
(ansi-color-apply-on-region compilation-filter-start (point)))) (interactive)
:mode ("\\.log$" . my/display-ansi-colors) (ansi-color-apply-on-region (point-min) (point-max)))
:hook (compilation-filter . my/display-ansi-colors)) (defun my/apply-ansi-colors-compilation ()
"Apply ANSI colors in the compilation window."
(let ((inhibit-read-only t))
(ansi-color-apply-on-region compilation-filter-start (point)))))
:mode ("\\.log$" . my/apply-ansi-colors-on-buffer)
:hook (compilation-filter . my/apply-ansi-colors-compilation))
;; Syntax-highlighting mode for text/gemini. ;; Syntax-highlighting mode for text/gemini.
(use-package gemini-mode (use-package gemini-mode