Emacs: Fix ANSI color application in logfiles.
This commit is contained in:
parent
b459881bd6
commit
e6a6bd812c
|
@ -1,6 +1,6 @@
|
|||
;;; 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:
|
||||
|
||||
|
@ -193,12 +193,17 @@
|
|||
|
||||
;; Translate ANSI escape color codes.
|
||||
(use-package ansi-color
|
||||
:config (defun my/display-ansi-colors ()
|
||||
(interactive)
|
||||
(let ((inhibit-read-only t))
|
||||
(ansi-color-apply-on-region compilation-filter-start (point))))
|
||||
:mode ("\\.log$" . my/display-ansi-colors)
|
||||
:hook (compilation-filter . my/display-ansi-colors))
|
||||
:config (progn
|
||||
(defun my/apply-ansi-colors-on-buffer ()
|
||||
"Apply ANSI colors in the current buffer."
|
||||
(interactive)
|
||||
(ansi-color-apply-on-region (point-min) (point-max)))
|
||||
(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.
|
||||
(use-package gemini-mode
|
||||
|
|
Loading…
Reference in New Issue
Block a user