Skip to main content
remove erroneous line
Source Link

Perhaps what follows will be useful to you. I use a variant of this in my emacs setup. (I don't use screen but another program that logs screen output.)

As is, it instructs emacs, whenever you open a file which filename looks like screenlog.n with n a number, to enable rendering ANSI sequences in color. (It does not process cursor movement and the like, which I prefer anyway.)

(add-hook 'text-mode-hook
          (lambda ()
        (when (string-match "screenlog\.[0-9]*$" (buffer-name))
              (progn
        (format-decode-buffer 'backspace-overstrike)
        (format-decode-buffer 'ansi-colors)
        (my-buffer-face-mode-fixed)
        (hide-dos-eol)
        (face-remap-add-relative 'default '((:foreground "white" :background "black")))
        ))))

It has some drawbacks, e.g. you cannot save buffers (you get "Sorry, 'ansi-colors' format is read-only."), but it allows what you asked for, rendering shell escape codes.

Perhaps what follows will be useful to you. I use a variant of this in my emacs setup. (I don't use screen but another program that logs screen output.)

As is, it instructs emacs, whenever you open a file which filename looks like screenlog.n with n a number, to enable rendering ANSI sequences in color. (It does not process cursor movement and the like, which I prefer anyway.)

(add-hook 'text-mode-hook
          (lambda ()
        (when (string-match "screenlog\.[0-9]*$" (buffer-name))
              (progn
        (format-decode-buffer 'backspace-overstrike)
        (format-decode-buffer 'ansi-colors)
        (my-buffer-face-mode-fixed)
        (hide-dos-eol)
        (face-remap-add-relative 'default '((:foreground "white" :background "black")))
        ))))

It has some drawbacks, e.g. you cannot save buffers (you get "Sorry, 'ansi-colors' format is read-only."), but it allows what you asked for, rendering shell escape codes.

Perhaps what follows will be useful to you. I use a variant of this in my emacs setup. (I don't use screen but another program that logs screen output.)

As is, it instructs emacs, whenever you open a file which filename looks like screenlog.n with n a number, to enable rendering ANSI sequences in color. (It does not process cursor movement and the like, which I prefer anyway.)

(add-hook 'text-mode-hook
          (lambda ()
        (when (string-match "screenlog\.[0-9]*$" (buffer-name))
              (progn
        (format-decode-buffer 'backspace-overstrike)
        (format-decode-buffer 'ansi-colors)
        (hide-dos-eol)
        (face-remap-add-relative 'default '((:foreground "white" :background "black")))
        ))))

It has some drawbacks, e.g. you cannot save buffers (you get "Sorry, 'ansi-colors' format is read-only."), but it allows what you asked for, rendering shell escape codes.

Source Link

Perhaps what follows will be useful to you. I use a variant of this in my emacs setup. (I don't use screen but another program that logs screen output.)

As is, it instructs emacs, whenever you open a file which filename looks like screenlog.n with n a number, to enable rendering ANSI sequences in color. (It does not process cursor movement and the like, which I prefer anyway.)

(add-hook 'text-mode-hook
          (lambda ()
        (when (string-match "screenlog\.[0-9]*$" (buffer-name))
              (progn
        (format-decode-buffer 'backspace-overstrike)
        (format-decode-buffer 'ansi-colors)
        (my-buffer-face-mode-fixed)
        (hide-dos-eol)
        (face-remap-add-relative 'default '((:foreground "white" :background "black")))
        ))))

It has some drawbacks, e.g. you cannot save buffers (you get "Sorry, 'ansi-colors' format is read-only."), but it allows what you asked for, rendering shell escape codes.