[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#5566: 23.1.92; man page header ugly on narrow terminals
From: |
Juri Linkov |
Subject: |
bug#5566: 23.1.92; man page header ugly on narrow terminals |
Date: |
Fri, 12 Feb 2010 23:57:34 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.92 (x86_64-pc-linux-gnu) |
>> Emacs doesn't process such `man' output. `Man-fontify-manpage' removes
>> ^H's only when the character before ^H is the same as the character after ^H:
>>
>> (while (re-search-forward "\\(.\\)\\(\b+\\1\\)+" nil t)
>> (replace-match "\\1")
>> (put-text-property (1- (point)) (point) 'face Man-overstrike-face))
>>
>> But in this case the characters before ^H and after ^H are different.
>
> As I mentioned before, emacs could improve its output and make it more
> consistent with typical terminal emulators by displaying X^HY as Y when
> X != Y.
>From your explanation I gather that for legacy reasons it's unlikely
that the groff's output will be fixed any time soon. So below is
a patch for man.el that removes these ^H:
=== modified file 'lisp/man.el'
--- lisp/man.el 2010-02-11 20:57:10 +0000
+++ lisp/man.el 2010-02-12 21:56:49 +0000
@@ -1105,6 +1105,11 @@ (defun Man-fontify-manpage ()
(while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t)
(replace-match "+")
(put-text-property (1- (point)) (point) 'face 'bold))
+ ;; When the header is longer than the manpage name, groff tries to
+ ;; condense it to a shorter line interspered with ^H. Remove ^H with
+ ;; their preceding chars (but don't put Man-overstrike-face). (Bug#5566)
+ (goto-char (point-min))
+ (while (re-search-forward ".\b" nil t) (backward-delete-char 2))
(goto-char (point-min))
;; Try to recognize common forms of cross references.
(Man-highlight-references)
@@ -1192,6 +1197,11 @@ (defun Man-cleanup-manpage (&optional in
))
(goto-char (point-min))
(while (re-search-forward "[-|]\\(\b[-|]\\)+" nil t) (replace-match "+"))
+ ;; When the header is longer than the manpage name, groff tries to
+ ;; condense it to a shorter line interspered with ^H. Remove ^H with
+ ;; their preceding chars (but don't put Man-overstrike-face). (Bug#5566)
+ (goto-char (point-min))
+ (while (re-search-forward ".\b" nil t) (backward-delete-char 2))
(Man-softhyphen-to-minus)
(message "%s man page cleaned up" Man-arguments))
--
Juri Linkov
http://www.jurta.org/emacs/