bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Man-fontify-manpage does not handle MKS man ANSI escape sequences


From: Brian D. Carlstrom
Subject: Man-fontify-manpage does not handle MKS man ANSI escape sequences
Date: Thu, 19 Jun 2003 20:06:27 -0400

In GNU Emacs 21.3.1 (i386-msvc-nt5.1.2600)
 of 2003-03-27 on buffy
configured using 'configure --with-msvc (12.00)'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Running emacs 21.3.1 on W32 with MKS toolkit, I found that there were
some ANSI sequences not handled by Man-fontify-manpage. I was able to
work around with Man-cooked-hook, but I though others would appreciate
having this done by default in Man-fontify-manpage. 

I've appended our local workaround. I tried to contact the man.el Author:
Barry A. Warsaw <bwarsaw@cen.com> but the email bounced.

-bri

;;; man
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; MKS man now outputs color sequences, we tried to respect them
;;; If you don't want any of this
;;;     (setq Man-fontify-manpage-flag nil)
;;; in your .emacs before you load this file and restart Emacs
(require 'man)
(defface Man-color-face '((((class color)) 
                           (:foreground "dark cyan"))
                          (t (:bold t)))
  "The face used for ANSI color highlighting of man pages")
(defface Man-reverse-face '((((class color)) 
                             (:foreground "white" :background "black"))
                            (t (:reverse-video t)))
  "The face used for ANSI reverse video highlighting of man pages")

(if Man-fontify-manpage-flag
    (add-hook 'Man-cooked-hook
              (lambda ()
                ;; code based on man.el's Man-fontify-manpage
                (goto-char (point-min))
                (while (search-forward "\e[4m" nil t)
                  (delete-backward-char 4)
                  (put-text-property 
                   (point)
                   (progn (if (search-forward "\e[0m" nil 'move)
                              (delete-backward-char 4))
                          (point))
                   'face 'Man-color-face))
                (goto-char (point-min))
                (while (search-forward "\e[7m" nil t)
                  (delete-backward-char 4)
                  (put-text-property
                   (point)
                   (progn (if (search-forward "\e[0m" nil 'move)
                              (delete-backward-char 4))
                          (point))
                   'face 'Man-reverse-face)))))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]